Skip to content

Pipeline V1#159

Draft
TheDeepestSpace wants to merge 191 commits intomainfrom
pipeline-v1
Draft

Pipeline V1#159
TheDeepestSpace wants to merge 191 commits intomainfrom
pipeline-v1

Conversation

@TheDeepestSpace
Copy link
Copy Markdown
Member

@TheDeepestSpace TheDeepestSpace commented Jan 24, 2026

PR for tracking pipeline-related changes

Todos

  • basic integration
    • integrate fetch stage
    • integrate decode stage
    • integrate execute stage
    • integrate memory stage
    • integrate write back stage
    • integrate hazard unit
    • integrate fetch stage with hazard unit (stalling)
    • integrate decode stage with hazard unit (stalling/flushing)
    • integrate execute stage with hazard unit (forwarding)
  • Testing and verification
    • remove old testbenches
    • set up new testbenches to exclusively the pipelining functionality (e.g. see the diagrams in section 7.5.3 of the text)
    • riscof
      • integrate new implementation with riscof
      • memory operations
      • alu operations
      • unconditional jump operations
      • branching operations
  • housekeeping
    • integrate Logger into the utoss_riscv_pipelined @marwannismail
    • remove old multi-cycle files (CFSM, top, etc.)
    • decide on and adopt a consistent naming convention or the wires/regs
    • move enums to packages as appropriate
    • diagrams
    • remove extraneous wires from stage interfaces
  • ensure synthesis passes
  • ensure ASIC flow passes

marwannismail and others added 30 commits November 30, 2025 12:55
Decode Pipeline Stage Implementation
Comment thread src/stages/fetch_stage.sv
assign imem__address = pc_cur;
assign IF_to_ID.instruction = imem__data;
assign IF_to_ID.pc_cur = pc_prev;
assign IF_to_ID.pc_plus_4 = pc_prev + 32'h4; // TODO: revisit
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be interesting to see the trade off between two +4 circuits and a single +4 and a 32-bit reg.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

🔧 DE1-SoC Synthesis Report Summary Diff

📊 Fitter Summary (.fit.summary)

@@ -1,16 +1,16 @@
-Fitter Status : Successful - Fri Apr 10 06:00:53 2026
+Fitter Status : Successful - Fri Apr 10 05:54:55 2026
 Quartus Prime Version : 25.1std.0 Build 1129 10/21/2025 SC Lite Edition
 Revision Name : utoss-risc-v
 Top-level Entity Name : top
 Family : Cyclone V
 Device : 5CSEMA5F31C6
 Timing Models : Final
-Logic utilization (in ALMs) : 1,427 / 32,070 ( 4 % )
-Total registers : 1262
+Logic utilization (in ALMs) : 1,513 / 32,070 ( 5 % )
+Total registers : 1535
 Total pins : 15 / 457 ( 3 % )
 Total virtual pins : 0
-Total block memory bits : 16,384 / 4,065,280 ( < 1 % )
-Total RAM Blocks : 4 / 397 ( 1 % )
+Total block memory bits : 32,768 / 4,065,280 ( < 1 % )
+Total RAM Blocks : 8 / 397 ( 2 % )
 Total DSP Blocks : 0 / 87 ( 0 % )
 Total HSSI RX PCSs : 0
 Total HSSI PMA RX Deserializers : 0

🔢 Fitter Resource Utilization by Entity

@@ -1,19 +1,33 @@
-Compilation Hierarchy Node                     ALMs needed [=A-B+C]  [A] ALMs used in final placement  [B] Estimate of ALMs recoverable by dense packing  [C] Estimate of ALMs unavailable  ALMs used for memory  Combinational ALUTs  Dedicated Logic Registers  I/O Registers  Block Memory Bits  M10Ks  DSP Blocks  Pins  Virtual Pins  Full Hierarchy Name                                                                    Entity Name         Library Name
-|top                                           1427.0 (0.5)          1586.5 (0.5)                      177.0 (0.0)                                        17.5 (0.0)                        0.0 (0.0)             1747 (1)             1262 (0)                   0 (0)          16384              4      0           15    0             |top                                                                                   top                 work
-   |memory_map:memory_map|                     37.8 (37.8)           41.8 (41.8)                       4.3 (4.3)                                          0.3 (0.3)                         0.0 (0.0)             67 (67)              12 (12)                    0 (0)          16384              4      0           0     0             |top|memory_map:memory_map                                                             memory_map          work
-      |altsyncram:M0_rtl_0|                    0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M0_rtl_0                                         altsyncram          work
-         |altsyncram_9hp1:auto_generated|      0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M0_rtl_0|altsyncram_9hp1:auto_generated          altsyncram_9hp1     work
-      |altsyncram:M1_rtl_0|                    0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M1_rtl_0                                         altsyncram          work
-         |altsyncram_ahp1:auto_generated|      0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M1_rtl_0|altsyncram_ahp1:auto_generated          altsyncram_ahp1     work
-      |altsyncram:M2_rtl_0|                    0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M2_rtl_0                                         altsyncram          work
-         |altsyncram_bhp1:auto_generated|      0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M2_rtl_0|altsyncram_bhp1:auto_generated          altsyncram_bhp1     work
-      |altsyncram:M3_rtl_0|                    0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M3_rtl_0                                         altsyncram          work
-         |altsyncram_chp1:auto_generated|      0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M3_rtl_0|altsyncram_chp1:auto_generated          altsyncram_chp1     work
-   |utoss_riscv:core|                          1388.6 (131.9)        1544.2 (143.3)                    172.7 (15.3)                                       17.2 (4.0)                        0.0 (0.0)             1679 (163)           1250 (177)                 0 (0)          0                  0      0           0     0             |top|utoss_riscv:core                                                                  utoss_riscv         work
-      |ALU:alu|                                372.3 (372.3)         386.2 (386.2)                     19.8 (19.8)                                        5.9 (5.9)                         0.0 (0.0)             521 (521)            0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|ALU:alu                                                          ALU                 work
-      |ControlFSM:control_fsm|                 31.8 (31.8)           32.2 (32.2)                       0.5 (0.5)                                          0.1 (0.1)                         0.0 (0.0)             49 (49)              17 (17)                    0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|ControlFSM:control_fsm                                           ControlFSM          work
-      |Instruction_Decode:instruction_decode|  57.0 (48.8)           57.0 (48.7)                       0.2 (0.0)                                          0.1 (0.1)                         0.0 (0.0)             108 (96)             0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Instruction_Decode:instruction_decode                            Instruction_Decode  work
-         |ALUdecoder:instanceALUDec|           7.2 (7.2)             8.3 (8.3)                         1.2 (1.2)                                          0.0 (0.0)                         0.0 (0.0)             12 (12)              0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Instruction_Decode:instruction_decode|ALUdecoder:instanceALUDec  ALUdecoder          work
-      |MemoryLoader:MemLoad|                   30.1 (30.1)           28.3 (28.3)                       0.1 (0.1)                                          2.0 (2.0)                         0.0 (0.0)             64 (64)              0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|MemoryLoader:MemLoad                                             MemoryLoader        work
-      |fetch:fetch|                            72.8 (72.8)           72.8 (72.8)                       0.5 (0.5)                                          0.5 (0.5)                         0.0 (0.0)             95 (95)              64 (64)                    0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|fetch:fetch                                                      fetch               work
-      |registerFile:RegFile|                   692.7 (692.7)         824.5 (824.5)                     136.3 (136.3)                                      4.6 (4.6)                         0.0 (0.0)             679 (679)            992 (992)                  0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|registerFile:RegFile                                             registerFile        work
+Compilation Hierarchy Node                        ALMs needed [=A-B+C]  [A] ALMs used in final placement  [B] Estimate of ALMs recoverable by dense packing  [C] Estimate of ALMs unavailable  ALMs used for memory  Combinational ALUTs  Dedicated Logic Registers  I/O Registers  Block Memory Bits  M10Ks  DSP Blocks  Pins  Virtual Pins  Full Hierarchy Name                                                                                  Entity Name         Library Name
+|top                                              1513.0 (0.5)          1645.5 (0.5)                      167.0 (0.0)                                        34.5 (0.0)                        0.0 (0.0)             1796 (1)             1535 (0)                   0 (0)          32768              8      0           15    0             |top                                                                                                 top                 work
+   |memory_map:memory_map|                        13.6 (13.6)           13.7 (13.7)                       0.3 (0.3)                                          0.1 (0.1)                         0.0 (0.0)             13 (13)              11 (11)                    0 (0)          32768              8      0           0     0             |top|memory_map:memory_map                                                                           memory_map          work
+      |altsyncram:M0_rtl_0|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M0_rtl_0                                                       altsyncram          work
+         |altsyncram_9hp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M0_rtl_0|altsyncram_9hp1:auto_generated                        altsyncram_9hp1     work
+      |altsyncram:M0_rtl_1|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M0_rtl_1                                                       altsyncram          work
+         |altsyncram_9hp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M0_rtl_1|altsyncram_9hp1:auto_generated                        altsyncram_9hp1     work
+      |altsyncram:M1_rtl_0|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M1_rtl_0                                                       altsyncram          work
+         |altsyncram_ahp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M1_rtl_0|altsyncram_ahp1:auto_generated                        altsyncram_ahp1     work
+      |altsyncram:M1_rtl_1|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M1_rtl_1                                                       altsyncram          work
+         |altsyncram_ahp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M1_rtl_1|altsyncram_ahp1:auto_generated                        altsyncram_ahp1     work
+      |altsyncram:M2_rtl_0|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M2_rtl_0                                                       altsyncram          work
+         |altsyncram_bhp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M2_rtl_0|altsyncram_bhp1:auto_generated                        altsyncram_bhp1     work
+      |altsyncram:M2_rtl_1|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M2_rtl_1                                                       altsyncram          work
+         |altsyncram_bhp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M2_rtl_1|altsyncram_bhp1:auto_generated                        altsyncram_bhp1     work
+      |altsyncram:M3_rtl_0|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M3_rtl_0                                                       altsyncram          work
+         |altsyncram_chp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M3_rtl_0|altsyncram_chp1:auto_generated                        altsyncram_chp1     work
+      |altsyncram:M3_rtl_1|                       0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M3_rtl_1                                                       altsyncram          work
+         |altsyncram_chp1:auto_generated|         0.0 (0.0)             0.0 (0.0)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             0 (0)                0 (0)                      0 (0)          4096               1      0           0     0             |top|memory_map:memory_map|altsyncram:M3_rtl_1|altsyncram_chp1:auto_generated                        altsyncram_chp1     work
+   |utoss_riscv:core|                             1499.0 (605.2)        1631.3 (634.2)                    166.7 (40.9)                                       34.4 (11.8)                       0.0 (0.0)             1782 (737)           1524 (468)                 0 (0)          0                  0      0           0     0             |top|utoss_riscv:core                                                                                utoss_riscv         work
+      |Decode:decode|                             302.9 (3.0)           377.6 (3.0)                       77.5 (0.0)                                         2.8 (0.0)                         0.0 (0.0)             90 (8)               992 (0)                    0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Decode:decode                                                                  Decode              work
+         |Instruction_Decode:instruction_decode|  9.5 (6.7)             10.3 (7.3)                        0.8 (0.6)                                          0.0 (0.0)                         0.0 (0.0)             32 (23)              0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Decode:decode|Instruction_Decode:instruction_decode                            Instruction_Decode  work
+            |ALUdecoder:instanceALUDec|           2.8 (2.8)             3.1 (3.1)                         0.2 (0.2)                                          0.0 (0.0)                         0.0 (0.0)             9 (9)                0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Decode:decode|Instruction_Decode:instruction_decode|ALUdecoder:instanceALUDec  ALUdecoder          work
+         |control_fsm:u_ctrl|                     3.8 (3.8)             3.8 (3.8)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             10 (10)              0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Decode:decode|control_fsm:u_ctrl                                               control_fsm         work
+         |registerFile:RegFile|                   286.4 (286.4)         360.4 (360.4)                     76.8 (76.8)                                        2.8 (2.8)                         0.0 (0.0)             40 (40)              992 (992)                  0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Decode:decode|registerFile:RegFile                                             registerFile        work
+      |Execute:execute|                           441.5 (90.6)          462.4 (99.2)                      37.5 (9.3)                                         16.6 (0.7)                        0.0 (0.0)             657 (167)            0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Execute:execute                                                                Execute             work
+         |ALU:alu|                                351.0 (351.0)         363.3 (363.3)                     28.3 (28.3)                                        16.0 (16.0)                       0.0 (0.0)             490 (490)            0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|Execute:execute|ALU:alu                                                        ALU                 work
+      |fetch_stage:u_fetch_stage|                 70.9 (70.9)           76.0 (76.0)                       7.5 (7.5)                                          2.4 (2.4)                         0.0 (0.0)             123 (123)            64 (64)                    0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|fetch_stage:u_fetch_stage                                                      fetch_stage         work
+      |hazard_unit:u_hazard_unit|                 9.4 (9.4)             10.6 (10.6)                       1.3 (1.3)                                          0.1 (0.1)                         0.0 (0.0)             18 (18)              0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|hazard_unit:u_hazard_unit                                                      hazard_unit         work
+      |mem_stage:memory_stage|                    9.3 (0.0)             9.0 (0.0)                         0.0 (0.0)                                          0.3 (0.0)                         0.0 (0.0)             24 (0)               0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|mem_stage:memory_stage                                                         mem_stage           work
+         |MemoryLoader:memory_loader|             9.3 (9.3)             9.0 (9.0)                         0.0 (0.0)                                          0.3 (0.3)                         0.0 (0.0)             24 (24)              0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|mem_stage:memory_stage|MemoryLoader:memory_loader                              MemoryLoader        work
+      |write_back:wb|                             59.5 (58.1)           61.5 (60.3)                       2.4 (2.6)                                          0.4 (0.4)                         0.0 (0.0)             133 (130)            0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|write_back:wb                                                                  write_back          work
+         |MemoryLoader:memory_loader|             1.2 (1.2)             1.2 (1.2)                         0.0 (0.0)                                          0.0 (0.0)                         0.0 (0.0)             3 (3)                0 (0)                      0 (0)          0                  0      0           0     0             |top|utoss_riscv:core|write_back:wb|MemoryLoader:memory_loader                                       MemoryLoader        work

⏱️ Timing Analysis Summary (.sta.summary)

@@ -3,51 +3,51 @@
 ------------------------------------------------------------
 
 Type  : Slow 1100mV 85C Model Setup 'CLOCK_50'
-Slack : 4.839
+Slack : 2.984
 TNS   : 0.000
 
 Type  : Slow 1100mV 85C Model Hold 'CLOCK_50'
-Slack : 0.375
+Slack : 0.310
 TNS   : 0.000
 
 Type  : Slow 1100mV 85C Model Minimum Pulse Width 'CLOCK_50'
-Slack : 8.876
+Slack : 8.868
 TNS   : 0.000
 
 Type  : Slow 1100mV 0C Model Setup 'CLOCK_50'
-Slack : 5.002
+Slack : 3.242
 TNS   : 0.000
 
 Type  : Slow 1100mV 0C Model Hold 'CLOCK_50'
-Slack : 0.388
+Slack : 0.263
 TNS   : 0.000
 
 Type  : Slow 1100mV 0C Model Minimum Pulse Width 'CLOCK_50'
-Slack : 8.830
+Slack : 8.822
 TNS   : 0.000
 
 Type  : Fast 1100mV 85C Model Setup 'CLOCK_50'
-Slack : 10.876
+Slack : 9.647
 TNS   : 0.000
 
 Type  : Fast 1100mV 85C Model Hold 'CLOCK_50'
-Slack : 0.181
+Slack : 0.191
 TNS   : 0.000
 
 Type  : Fast 1100mV 85C Model Minimum Pulse Width 'CLOCK_50'
-Slack : 8.786
+Slack : 8.787
 TNS   : 0.000
 
 Type  : Fast 1100mV 0C Model Setup 'CLOCK_50'
-Slack : 11.803
+Slack : 10.704
 TNS   : 0.000
 
 Type  : Fast 1100mV 0C Model Hold 'CLOCK_50'
-Slack : 0.171
+Slack : 0.149
 TNS   : 0.000
 
 Type  : Fast 1100mV 0C Model Minimum Pulse Width 'CLOCK_50'
-Slack : 8.778
+Slack : 8.780
 TNS   : 0.000
 
 ------------------------------------------------------------

Comparing synthesis results from main branch vs. this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate stages and hazard Design high-level pipelined implementation

8 participants