Skip to content

Set up basic plugin architecture for CSRs in RISC-V - #306

Merged
TheDeepestSpace merged 1 commit into
mainfrom
boris/zicsr-special-regs
Sep 28, 2026
Merged

TheDeepestSpace merged 1 commit into
mainfrom
boris/zicsr-special-regs

Conversation

@TheDeepestSpace

@TheDeepestSpace TheDeepestSpace commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

See MAS for updates

Comment thread src/ext/zicsr/csr_data.sv

// asynchronous read
assign csr_data.value = csrs[csr_request.address];
csr_plugin

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.

what we'll likely do in the future is auto-generate this file from some sort of YAML configuration, since this is gonna get pretty repetitive quick. This way it might be easier to validate too. I'm not confident that csr_plugin will stand the test of time, i am positive we will need to extend it for more involved CSRs as well is see what the semantics of more complicated CSRs will do to this abstraction

@github-actions

Copy link
Copy Markdown

📊 Synthesis & Hardening Report Summary Diff

  • RV32I

    • DE1-SoC synthesis

      • Fitter summary

        @@ -1,4 +1,4 @@
        -Fitter Status : Successful - Sun Sep 27 23:06:17 2026
        +Fitter Status : Successful - Mon Sep 28 01:49:46 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
      • Fitter by entity
        No changes detected

      • Timing
        No changes detected

    • Nangate45 hardening

      • Utilization
        No changes detected

      • Gate breakdown
        No changes detected

  • RV32IZbb_Zbkb

    • DE1-SoC synthesis

      • Fitter summary

        @@ -1,4 +1,4 @@
        -Fitter Status : Successful - Sun Sep 27 23:04:35 2026
        +Fitter Status : Successful - Mon Sep 28 01:48:43 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
      • Fitter by entity
        No changes detected

      • Timing
        No changes detected

    • Nangate45 hardening

      • Utilization
        No changes detected

      • Gate breakdown
        No changes detected

  • RV32IZicsr

    • DE1-SoC synthesis

      • Fitter summary

        @@ -1,4 +1,4 @@
        -Fitter Status : Successful - Sun Sep 27 23:05:48 2026
        +Fitter Status : Successful - Mon Sep 28 01:49:56 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
      • Fitter by entity
        No changes detected

      • Timing
        No changes detected

    • Nangate45 hardening

      • Utilization

        @@ -1,21 +1,23 @@
         | Hierarchy / Module                                                   | Total Cells |    Area (um^2) | Comb Cells |      Comb Area | Seq Cells |       Seq Area |
         |----------------------------------------------------------------------|-------------|----------------|------------|----------------|-----------|----------------|
        -| top                                                                  |      620552 |     1109516.86 |     483392 |      489279.34 |    137160 |      620237.52 |
        -| utoss_riscv$top.core                                                 |      602961 |     1071449.33 |     469993 |      470168.03 |    132968 |      601281.30 |
        +| top                                                                  |       28315 |       55908.94 |      22195 |       28234.30 |      6120 |       27674.64 |
        +| utoss_riscv$top.core                                                 |       10654 |       17832.91 |       8726 |        9114.49 |      1928 |        8718.42 |
         | ALU$top.core.u_execute_stage.alu                                     |        1040 |        1171.46 |       1040 |        1171.46 |         0 |           0.00 |
         | ALUdecoder$top.core.u_decode_stage.instruction_decode.instanceALUDec |          24 |          23.67 |         24 |          23.67 |         0 |           0.00 |
         | Instruction_Decode$top.core.u_decode_stage.instruction_decode        |         148 |         140.71 |        148 |         140.71 |         0 |           0.00 |
         | MemoryLoader$top.core.u_write_back_stage.memory_loader               |         102 |         104.80 |        102 |         104.80 |         0 |           0.00 |
         | control_fsm$top.core.u_decode_stage.u_ctrl                           |          27 |          28.20 |         27 |          28.20 |         0 |           0.00 |
        -| csr_data$top.core.u_decode_stage.u_csr_unit.u_csr_data               |      592379 |     1053873.91 |     461307 |      461166.33 |    131072 |      592707.58 |
        +| csr_data$top.core.u_decode_stage.u_csr_unit.u_csr_data               |         204 |         318.93 |        172 |         174.23 |        32 |         144.70 |
         | csr_decode$top.core.u_decode_stage.u_csr_unit.u_csr_decode           |          71 |          57.46 |         71 |          57.46 |         0 |           0.00 |
        -| csr_unit$top.core.u_decode_stage.u_csr_unit                          |      592450 |     1053931.37 |     461378 |      461223.78 |    131072 |      592707.58 |
        +| csr_plugin$top.core.u_decode_stage.u_csr_unit.u_csr_data.u_mhartid   |           0 |           0.00 |          0 |           0.00 |         0 |           0.00 |
        +| csr_plugin$top.core.u_decode_stage.u_csr_unit.u_csr_data.u_mscratch  |         172 |         284.89 |        140 |         140.18 |        32 |         144.70 |
        +| csr_unit$top.core.u_decode_stage.u_csr_unit                          |         275 |         376.39 |        243 |         231.69 |        32 |         144.70 |
         | csr_wb$top.core.u_write_back_stage.u_csr_wb                          |         131 |         113.58 |        131 |         113.58 |         0 |           0.00 |
        -| decode_stage$top.core.u_decode_stage                                 |      598165 |     1063587.17 |     466069 |      466249.06 |    132096 |      597338.11 |
        +| decode_stage$top.core.u_decode_stage                                 |        5858 |        9970.74 |       4802 |        5195.51 |      1056 |        4775.23 |
         | execute_stage$top.core.u_execute_stage                               |        1504 |        1732.72 |       1504 |        1732.72 |         0 |           0.00 |
         | fetch_stage$top.core.u_fetch_stage                                   |         539 |         919.30 |        442 |         480.66 |        97 |         438.63 |
         | hazard_unit$top.core.u_hazard_unit                                   |         157 |         184.60 |        156 |         180.08 |         1 |           4.52 |
         | memory_stage$top.core.u_memory_stage                                 |          68 |          69.96 |         68 |          69.96 |         0 |           0.00 |
        -| registerFile$top.core.u_decode_stage.RegFile                         |        5438 |        9325.96 |       4414 |        4695.43 |      1024 |        4630.53 |
        +| registerFile$top.core.u_decode_stage.RegFile                         |        5306 |        9264.51 |       4282 |        4633.99 |      1024 |        4630.53 |
         | write_back_stage$top.core.u_write_back_stage                         |         379 |         368.68 |        379 |         368.68 |         0 |           0.00 |
        -| memory_map$top.u_memory_map                                          |       17591 |       38067.53 |      13399 |       19111.30 |      4192 |       18956.22 |
        +| memory_map$top.u_memory_map                                          |       17661 |       38076.04 |      13469 |       19119.81 |      4192 |       18956.22 |
      • Gate breakdown

        @@ -3,34 +3,34 @@
         ====================================================================
         Cell Type        |      Count |  Total Area (um^2) |   % Area
         --------------------------------------------------------------------
        -DFF_X1           |     137160 |          620237.52 |   55.90%
        -OAI22_X1         |     133190 |          177142.70 |   15.97%
        -INV_X1           |     133293 |           70911.88 |    6.39%
        -OAI21_X1         |      62280 |           66265.92 |    5.97%
        -AOI21_X1         |      53517 |           56942.09 |    5.13%
        -NOR3_X1          |      22021 |           23430.34 |    2.11%
        -MUX2_X1          |      12206 |           22727.57 |    2.05%
        -AOI211_X1        |      12892 |           17146.36 |    1.55%
        -NOR2_X1          |      17945 |           14320.11 |    1.29%
        -NAND3_X1         |       9081 |            9662.18 |    0.87%
        -NAND2_X1         |      11958 |            9542.48 |    0.86%
        -OAI211_X1        |       6501 |            8646.33 |    0.78%
        -OAI221_X1        |       1751 |            2794.60 |    0.25%
        -AOI221_X1        |       1546 |            2467.42 |    0.22%
        -AOI222_X1        |        871 |            1853.49 |    0.17%
        -AOI22_X1         |       1176 |            1564.08 |    0.14%
        -OR3_X1           |        899 |            1195.67 |    0.11%
        -OR2_X1           |        883 |             939.51 |    0.08%
        -AND2_X1          |        711 |             756.50 |    0.07%
        -AND3_X1          |        320 |             425.60 |    0.04%
        -XNOR2_X1         |        137 |             218.65 |    0.02%
        -XOR2_X1          |         69 |             110.12 |    0.01%
        -NAND4_X1         |         57 |              75.81 |    0.01%
        -NOR4_X1          |         36 |              47.88 |    0.00%
        -OR4_X1           |         17 |              27.13 |    0.00%
        -OAI222_X1        |         12 |              25.54 |    0.00%
        -AND4_X1          |         13 |              20.75 |    0.00%
        -OAI33_X1         |         10 |              18.62 |    0.00%
        +DFF_X1           |       6120 |           27674.64 |   49.50%
        +MUX2_X1          |       5084 |            9466.41 |   16.93%
        +OAI21_X1         |       2139 |            2275.90 |    4.07%
        +AOI222_X1        |        879 |            1870.51 |    3.35%
        +NOR2_X1          |       2249 |            1794.70 |    3.21%
        +AOI21_X1         |       1627 |            1731.13 |    3.10%
        +OAI22_X1         |       1272 |            1691.76 |    3.03%
        +INV_X1           |       2240 |            1191.68 |    2.13%
        +AOI22_X1         |        856 |            1138.48 |    2.04%
        +AOI221_X1        |        686 |            1094.86 |    1.96%
        +OAI211_X1        |        769 |            1022.77 |    1.83%
        +NAND2_X1         |       1069 |             853.06 |    1.53%
        +NAND3_X1         |        728 |             774.59 |    1.39%
        +AOI211_X1        |        543 |             722.19 |    1.29%
        +OAI221_X1        |        450 |             718.20 |    1.28%
        +AND2_X1          |        477 |             507.53 |    0.91%
        +OR2_X1           |        380 |             404.32 |    0.72%
        +NOR3_X1          |        336 |             357.50 |    0.64%
        +XNOR2_X1         |        137 |             218.65 |    0.39%
        +XOR2_X1          |         69 |             110.12 |    0.20%
        +NAND4_X1         |         62 |              82.46 |    0.15%
        +NOR4_X1          |         40 |              53.20 |    0.10%
        +AND3_X1          |         34 |              45.22 |    0.08%
        +OR3_X1           |         28 |              37.24 |    0.07%
        +OR4_X1           |         15 |              23.94 |    0.04%
        +OAI222_X1        |         11 |              23.41 |    0.04%
        +AND4_X1          |         13 |              20.75 |    0.04%
        +OAI33_X1         |          2 |               3.72 |    0.01%
         --------------------------------------------------------------------
        -TOTAL            |     620552 |         1109516.86 | 100.00%
        +TOTAL            |      28315 |           55908.94 | 100.00%
         ====================================================================

Comparing synthesis & hardening results from main branch vs. this PR

@TheDeepestSpace
TheDeepestSpace merged commit 3f15685 into main Sep 28, 2026
49 of 50 checks passed
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.

1 participant