things for today
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -0,0 +1,6 @@
|
||||
# For now, ignore user builds
|
||||
# We will eventually change to a custom
|
||||
# build system.
|
||||
# So hold on
|
||||
/bin
|
||||
/out
|
||||
|
||||
65
makefile
Normal file
65
makefile
Normal file
@@ -0,0 +1,65 @@
|
||||
#Compiler and Linker
|
||||
CC := g++
|
||||
|
||||
#The Target Binary Program
|
||||
TARGET := out.exe
|
||||
|
||||
#The Directories, Source, Includes, Objects, Binary and Resources
|
||||
SRCDIR := src
|
||||
BUILDDIR := bin
|
||||
TARGETDIR := out
|
||||
SRCEXT := cpp
|
||||
DEPEXT := d
|
||||
OBJEXT := o
|
||||
|
||||
#Flags, Libraries and Includes
|
||||
ROOT := ./
|
||||
CFLAGS := -Wall -std=c++20 -DSPIDER_COMPILING
|
||||
LFLAGS := -Wall -std=c++20 -static
|
||||
LIB :=
|
||||
INC := -I./src/
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
#DO NOT EDIT BELOW THIS LINE
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
|
||||
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
|
||||
|
||||
#Defauilt Make
|
||||
all: directories $(TARGET)
|
||||
|
||||
#Remake
|
||||
remake: cleaner all
|
||||
|
||||
#Make the Directories
|
||||
directories:
|
||||
@mkdir -p $(TARGETDIR)
|
||||
@mkdir -p $(BUILDDIR)
|
||||
|
||||
#Clean only Objecst
|
||||
clean:
|
||||
@$(RM) -rf $(BUILDDIR)
|
||||
|
||||
#Full Clean, Objects and Binaries
|
||||
cleaner: clean
|
||||
@$(RM) -rf $(TARGETDIR)
|
||||
|
||||
#Pull in dependency info for *existing* .o files
|
||||
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
|
||||
|
||||
#Link
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CC) $(LFLAGS) -o $(TARGETDIR)/$(TARGET) $^ $(LIB)
|
||||
|
||||
#Compile
|
||||
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
|
||||
@$(CC) $(CFLAGS) -MM $(SRCDIR)/$*.$(SRCEXT) > $(BUILDDIR)/$*.$(DEPEXT)
|
||||
@cp -f $(BUILDDIR)/$*.$(DEPEXT) $(BUILDDIR)/$*.$(DEPEXT).tmp
|
||||
@sed -e 's|.*:|$(BUILDDIR)/$*.$(OBJEXT):|' < $(BUILDDIR)/$*.$(DEPEXT).tmp > $(BUILDDIR)/$*.$(DEPEXT)
|
||||
@sed -e 's/.*://' -e 's/\\$$//' < $(BUILDDIR)/$*.$(DEPEXT).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(BUILDDIR)/$*.$(DEPEXT)
|
||||
@rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
|
||||
|
||||
#Non-File Targets
|
||||
.PHONY: all remake clean cleaner resources
|
||||
88
pygen.ipynb
Normal file
88
pygen.ipynb
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "21877801",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Python Generator\n",
|
||||
"\n",
|
||||
"This python notebook will serve to generate the necessary code to\n",
|
||||
"generate some things from Spider.\n",
|
||||
"\n",
|
||||
"Specifically, it will generate the CPU instructions (currently)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b0fcd533",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# setup directories"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b33de8ac",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Implement here some kind of \"C++\" printer"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "58645013",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# read the instruction sheet with pandas"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "452bc76c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# well, then export the masks (TODO)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "5aaebef0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# print the CPU Instructions"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.13.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -5,6 +5,14 @@
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"gitlens.remotes": [
|
||||
{
|
||||
"domain": "git.sintekanalytics.com",
|
||||
"type": "Gitea",
|
||||
"name": "Sintek Analytics' Git",
|
||||
"protocol": "https",
|
||||
}
|
||||
],
|
||||
"C_Cpp.default.includePath": [
|
||||
"./src"
|
||||
]
|
||||
|
||||
14
src/spider/SpiderRuntime.cpp
Normal file
14
src/spider/SpiderRuntime.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "SpiderRuntime.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace spider {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -21,9 +21,24 @@ namespace spider {
|
||||
u64 RV;
|
||||
u64 RM;
|
||||
|
||||
public:
|
||||
/**
|
||||
* These are private registers, which are only used
|
||||
* whenever constant things are used.
|
||||
* This way we don't "write" into constant values, rather
|
||||
* we write into a writeable var which is "hidden"
|
||||
*/
|
||||
register_t ALU0, ALU1;
|
||||
|
||||
public:
|
||||
CPU();
|
||||
~CPU();
|
||||
|
||||
public:
|
||||
|
||||
// <pygen-target name=cpu-instructions> //
|
||||
// </pygen-target> //
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -40,16 +40,16 @@
|
||||
#define SPIDER_LITTLE_ENDIAN 1
|
||||
#define SPIDER_BIG_ENDIAN 0
|
||||
#else
|
||||
#error "Unsupported or unknown architecture endianness!"
|
||||
#error "[Spider Machine] Unsupported or unknown architecture endianness!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Safety checks
|
||||
#if !defined(SPIDER_LITTLE_ENDIAN) || !defined(SPIDER_BIG_ENDIAN)
|
||||
#error "Missed at least one little/big endian macros"
|
||||
#error "[Spider Machine] Missed at least one little/big endian macros"
|
||||
#endif
|
||||
#if SPIDER_LITTLE_ENDIAN == 1 && SPIDER_BIG_ENDIAN == 1
|
||||
#warning "Mixed endian machine detected, unsupported! Be cautious adventurer!"
|
||||
#warning "[Spider Machine] Mixed endian machine detected, unsupported! Be cautious adventurer!"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
#define SPIDER_BEGIN_PACKED
|
||||
#define SPIDER_END_PACKED
|
||||
#define SPIDER_PACKED_STRUCT(decl) decl
|
||||
#warning "MODEM: Compiler packing not supported. Memory layout may be unstable!"
|
||||
#warning "[Spider Machine] Compiler packing not supported. Memory layout may be unstable!"
|
||||
#endif
|
||||
|
||||
namespace spider {}
|
||||
|
||||
Reference in New Issue
Block a user