How elaine-ch/comparch-project works
Project type and purpose
• This is a hybrid tool‐chain + hardware design project for a simple CPU in SystemVerilog, accompanied by a Java‐based assembler.
• The Java assembler (in Assembler/) translates .sv assembly text into machine code and JLUT entries. The hardware RTL (in “SystemVerilog code/” and “myHardware/”) implements the CPU datapath and control. Testbenches (in testbenches/) simulate the design with the generated machine code.
File structure
Top level:
• Assembler/ – Java source (Assembler.java, Converter.java, Translator.java, CommentRemover.java) plus sample assembly input and machine‐code outputs.
• Programs/ – Example SV programs, data memory initial contents, input test cases and their text‐based JLUT and machine‐code files.
• SystemVerilog code/ and myHardware/ – RTL modules of the CPU: ALU.sv, Ctrl.sv, DatMem.sv, InstROM.sv, JLUT.sv, ProgCtr.sv, RegFile.sv, Top.sv, mux2x1.sv.
• testbenches/ – SV testbenches for individual modules and full CPU runs.
Architectural patterns:
• A two‐stage toolchain: assembler → hardware.
• A simple single‐cycle CPU datapath with separate instruction ROM (InstROM) and jump‐lookup (JLUT).
• Manual post‐processing step for branch target resolution (labels and beq conversions).
Insights from the README
• Core workflow: edit assembly1.txt → run Java assembler → get mach_code1.txt + jlut.txt → manually fix branch instructions/labels → update InstROM.sv and JLUT.sv → run SV testbench.
• No CI/CD or automated integration; the code-to-hardware handoff is file‐based.