How shehrozkashif/vermithor works
Project type and purpose
• This is a hardware‐design project written in Scala using Chisel: it describes and generates a 5-stage pipelined RISC-V RV-32I core (“Vermithor”).
• It’s not a web or database app but a hardware generator: Scala/Chisel code → Verilog → simulation via Verilator → testbenches.
File structure
• src/main/scala/core/Memory: instruction memory (Imem.scala)
• src/main/scala/core/Modules: individual pipeline stage modules (fetch, decode, execute, mem, wb), plus ALU, register file, control unit, PC, immediate generator
• src/main/scala/core/Pipelines: pipeline registers (“reg1”..“reg4”) that separate stages
• topcore.scala: instantiates modules, stitches pipeline registers into the full processor datapath
• src/test/scala/core: unit tests for each module and full top-level tests
• build.sbt, project/: SBT build definition
• Dependencies: Chisel (Scala), Verilator (for simulation)
Key insights from README
• The build pipeline: sbt → compile Scala/Chisel → emit Verilog → run tests → optionally simulate in Verilator
• The core is a textbook 5-stage RISC-V pipeline
Main components
a. Development tools & flow
• Scala/Chisel source code (src/)
• sbt build system
• Verilog output
• Verilator simulation/testbench
b. Core hardware modules & pipeline
• IF stage: PC register → Imem
• ID stage: pipeline register (reg1) → Control Unit + Register File → immediate generator
• EX stage: pipeline register (reg2) → ALU
• MEM stage: pipeline register (reg3) → Data Memory
• WB stage: pipeline register (reg4) → write back into Register File
c. Interconnections
• Pipeline registers between each stage
• Control signals from Control Unit to ALU, memories, register file
• Data paths (instructions, operand buses, result buses) flowing forward
Architectural patterns & design principles
• Classic 5-stage pipeline: fetch, decode, execute, memory, writeback
• Separation of concerns: each stage in its own Scala file
• Parameterized modules in Scala/Chisel for reusability
• Explicit pipeline registers for stage isolation and hazard management (no forwarding shown, but pipeline registers are explicit)
Relevant technologies & libraries
• Scala (language for Chisel)
• Chisel (hardware description embedded in Scala)
• SBT (build tool)
• Verilator (Verilog simulation)
• RISC-V RV-32I ISA as target spec