From f51b6edfbf0021014c589f9bc31c3c462e431b97 Mon Sep 17 00:00:00 2001 From: Kittycannon Date: Wed, 18 Mar 2026 09:36:45 -0600 Subject: [PATCH] things for today --- .gitignore | 6 ++ makefile | 65 ++++++++++++++++++++ pygen.ipynb | 88 +++++++++++++++++++++++++++ spider-runtime.code-workspace | 8 +++ src/spider/SpiderRuntime.cpp | 14 +++++ src/spider/runtime/cpu/CPU.hpp | 15 +++++ src/spider/runtime/native/machine.hpp | 8 +-- 7 files changed, 200 insertions(+), 4 deletions(-) create mode 100644 makefile create mode 100644 pygen.ipynb create mode 100644 src/spider/SpiderRuntime.cpp diff --git a/.gitignore b/.gitignore index e69de29..f07a0cd 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,6 @@ +# For now, ignore user builds +# We will eventually change to a custom +# build system. +# So hold on +/bin +/out diff --git a/makefile b/makefile new file mode 100644 index 0000000..8ec5941 --- /dev/null +++ b/makefile @@ -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 \ No newline at end of file diff --git a/pygen.ipynb b/pygen.ipynb new file mode 100644 index 0000000..b9c5052 --- /dev/null +++ b/pygen.ipynb @@ -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 +} diff --git a/spider-runtime.code-workspace b/spider-runtime.code-workspace index 5ba9520..33de8c3 100644 --- a/spider-runtime.code-workspace +++ b/spider-runtime.code-workspace @@ -5,6 +5,14 @@ } ], "settings": { + "gitlens.remotes": [ + { + "domain": "git.sintekanalytics.com", + "type": "Gitea", + "name": "Sintek Analytics' Git", + "protocol": "https", + } + ], "C_Cpp.default.includePath": [ "./src" ] diff --git a/src/spider/SpiderRuntime.cpp b/src/spider/SpiderRuntime.cpp new file mode 100644 index 0000000..5151a6b --- /dev/null +++ b/src/spider/SpiderRuntime.cpp @@ -0,0 +1,14 @@ +#include "SpiderRuntime.hpp" + +#include + +namespace spider { + + + +} + +int main() { + std::cout << "Hello World" << std::endl; + return 0; +} diff --git a/src/spider/runtime/cpu/CPU.hpp b/src/spider/runtime/cpu/CPU.hpp index a7aa96d..1e342f8 100644 --- a/src/spider/runtime/cpu/CPU.hpp +++ b/src/spider/runtime/cpu/CPU.hpp @@ -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: + + // // + // // + }; } \ No newline at end of file diff --git a/src/spider/runtime/native/machine.hpp b/src/spider/runtime/native/machine.hpp index 2509368..5d049b6 100644 --- a/src/spider/runtime/native/machine.hpp +++ b/src/spider/runtime/native/machine.hpp @@ -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 {}