Projects

Robotics & Embedded

LC-3 Processor in Verilog

December 2025, Verilog, Vivado

Engineering
VerilogVivadoFSM Design
Status
Completed
When
Dec 2025
Context
Course project

I built a complete multi-cycle LC-3 processor in Verilog: ALU, register file, memory interface, and the finite-state-machine controller that sequences them, covering the entire LC-3 instruction set across arithmetic, memory, and control flow.

Block diagram of the PUnC datapath: PC, memory, register file, ALU, sign extension, and the address and data muxes that connect them.
The datapath. Every mux select, load enable, and reset comes from the controller; nothing here decides on its own.
Block diagram of the controller: IR field extraction feeding next-state logic, a clocked state register, and output logic driving the datapath's control signals.
The controller itself: next-state logic reads the opcode and current state, the state register clocks it forward, and output logic turns each state into the datapath's control signals.

The debugging is the part worth reading. Simulation hung with no error message, which is the least informative failure a processor can give you. Waveform analysis in Vivado traced it to unassigned control-mux selects: certain controller states left mux inputs undriven, so the datapath stalled on undefined values rather than faulting. Fixing it meant making every control signal explicitly assigned in every state instead of relying on defaults. The final design passed all 19 tests with zero errors.

Vivado waveform showing the LC-3 simulation: clock, reset, program counter, register file, and memory signals traced across roughly 900 nanoseconds.
The Vivado waveform that found it. Once every control signal was traced cycle by cycle, the undriven mux select stood out from everything defined around it.

Key decisions

ChoseTreat ret as redundant with jump

R7 is encoded in ir[8:6].

Debugging

SymptomInferred latches.

CauseMissing default assignments.

FixAdd defaults.

SymptomDecode stalled on undefined opcodes (1000 RTI, 1101 reserved).

CauseNo default case.

FixDecode self-loop.

Symptomjsr_reg did nothing useful.

CauseState missing both pc_ld and rf_w_en.

FixAssert both.

Outcome

  • 19 tests, 0 errorsCourse test suite for the processor.
View on GitHub All projects