How harsha-vardhan-r/synthbite16 works
Main Components
• Assembler (Compiler) Module – This is implemented in a single C++ source file (main.cpp) and built using CMake (see the Assembler directory and its CMakeLists.txt). Its job is to take an input assembly program and produce an output binary/ROM file.
• SynthBite16 Simulation – The hardware design is provided as a Logisim circuit file (SynthBite16.circ). The ROM produced by the assembler is loaded into this simulated computer.
• Documentation & Examples – Files like Docs.txt, LOOKUP.txt, and examples/ directory illustrate the instruction set, usage, and program examples to guide the user.
• Supporting & Build Infrastructure – This includes configuration files (in .vscode, .idea) and build directories for the CMake and ninja build systems.
Relationships and Flow
• User writes a program in the assembly language as per the instruction set detailed in Docs.txt.
• The Assembler processes the file and produces a binary output (RAM file) that follows the ROM/ROM.txt structure.
• This assembled binary is then loaded into the SynthBite16 Logisim circuit (SynthBite16.circ) to simulate the 16-bit computer.
• The simulation is executed in Logisim-evolution where the computer’s registers, clock settings (with the simulation recommended to start from a low clock value), stack operations, and instruction executions are observed.
• An optional feedback loop exists where the user can test, find bugs, and then modify the source assembly or even tweak the assembler code.
Architectural Patterns and Technologies
• Monolithic Assembler: The assembler is simple and self-contained (a single C++ file) but leverages CMake for building and can be extended if necessary.
• Hardware Simulation: The project uses Logisim-evolution as an external simulator. The .circ file captures the digital hardware design and maps exactly how the 38 instructions, addressing modes, and register stack operate.
• Clear Separation: There is a clear separation between the “software” side (writing and compiling programs) and the “hardware” simulation side (emulating the computer via a circuit file).