
This project is a custom 8-bit RISC-V-inspired CPU optimized for high-density synthesis on the IHP26a process (TinyTapeout 1x2 tile). It utilizes a multi-cycle Finite State Machine (FSM) to handle fetching, decoding, and execution.
EXECUTE phase.Instructions are stored in Little-Endian format. The bit-fields are organized as follows:
[Opcode: 4 bits] [Unused: 2 bits] [rd: 3 bits] [rs1: 3 bits] [imm/rs2: 4 bits]
| Opcode | Mnemonic | Description |
|---|---|---|
| 0000 | ADD | rd = rs1 + rs2 |
| 0001 | ADDI | rd = rs1 + imm (4-bit) |
| 0010 | MUL | rd = rs1 * rs2 (8-bit result) |
| 0011 | LW | rd = RAM[rs1] |
| 0100 | SW | RAM[rs1] = rd |
| 0101 | BEQ | If rd == rs1, PC = PC + imm |
| 0110 | BNE | If rd != rs1, PC = PC + imm |
The CPU features a built-in bootloader mode. Follow these steps to load and run a program:
rst_n LOW. This resets the Program Counter (PC) to 0 and enters LOAD mode.uio[7] (Mode Select) LOW.uio[4:0].ui[7:0].clk) to write the byte to RAM.uio[7] to HIGH. The CPU will exit the LOAD state and begin fetching instructions from RAM address 0.uo[7:0] continuously outputs the value of the destination register (rd) of the current instruction.
uio[4:0] outputs the current Program Counter (PC) for debugging.uo[7:0] to verify calculation results.| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | data_in[0] | reg_out[0] | addr[0] |
| 1 | data_in[1] | reg_out[1] | addr[1] |
| 2 | data_in[2] | reg_out[2] | addr[2] |
| 3 | data_in[3] | reg_out[3] | addr[3] |
| 4 | data_in[4] | reg_out[4] | addr[4] |
| 5 | data_in[5] | reg_out[5] | addr[5] |
| 6 | data_in[6] | reg_out[6] | addr[6] |
| 7 | data_in[7] | reg_out[7] | mode_sel |