Skip to content

Commit b8d0165

Browse files
authored
✨ [cpu] add experimental support for RISC-V Zibi ISA extension (#1418)
2 parents 46b5716 + 0aae1a4 commit b8d0165

22 files changed

+301
-237
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ mimpid = 0x01040312 -> Version 01.04.03.12 -> v1.4.3.12
2929

3030
| Date | Version | Comment | Ticket |
3131
|:----:|:-------:|:--------|:------:|
32+
| 01.11.2025 | 1.12.3.9 | :sparkles: add experimental support for the RISC-V `Zibi` ISA extension (branches with immediates) | [#1418](https://github.com/stnolting/neorv32/pull/1418) |
3233
| 25.10.2025 | 1.12.3.8 | :bug: fix CLINT register read-back (bug introduced in previous version / v1.12.3.7) | [#1411](https://github.com/stnolting/neorv32/pull/1411) |
3334
| 23.10.2025 | 1.12.3.7 | counter optimizations and PMP logic cleanup | [#1410](https://github.com/stnolting/neorv32/pull/1410) |
3435
| 18.10.2025 | 1.12.3.6 | improve PMP logic (shortening of critical path) | [#1408](https://github.com/stnolting/neorv32/pull/1408) |

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ setup according to your needs. Note that all of the following SoC modules are en
9797
[`Zbkc`](https://stnolting.github.io/neorv32/#_zbkc_isa_extension)
9898
[`Zbkx`](https://stnolting.github.io/neorv32/#_zbkx_isa_extension)
9999
[`Zbs`](https://stnolting.github.io/neorv32/#_zbs_isa_extension)
100+
[`Zibi`](https://stnolting.github.io/neorv32/#_zibi_isa_extension)
100101
[`Zicntr`](https://stnolting.github.io/neorv32/#_zicntr_isa_extension)
101102
[`Zicond`](https://stnolting.github.io/neorv32/#_zicond_isa_extension)
102103
[`Zicsr`](https://stnolting.github.io/neorv32/#_zicsr_isa_extension)

docs/datasheet/cpu_csr.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,5 +998,6 @@ discover additional ISA (sub-)extensions and CPU configuration options.
998998
| 26 | `CSR_MXISA_ZALRSC` | r/- | <<_zalrsc_isa_extension>> available
999999
| 27 | `CSR_MXISA_ZCB` | r/- | <<_zcb_isa_extension>> available
10001000
| 28 | `CSR_MXISA_ZCA` | r/- | "`C` without floating-point", available when <<_c_isa_extension>> is available
1001-
| 31:29 | - | r/- | _reserved_, read as zero
1001+
| 29 | `CSR_MXISA_ZIBI` | r/- | <<_zibi_isa_extension>> available
1002+
| 31:30 | - | r/- | _reserved_, read as zero
10021003
|=======================

docs/datasheet/cpu_isa.adoc

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This chapter gives a brief overview of all available ISA extensions.
3030
| <<_zbs_isa_extension,`Zbs`>> | Single-bit bit manipulation instructions | <<_processor_top_entity_generics, `RISCV_ISA_Zbs`>>
3131
| <<_zfinx_isa_extension,`Zfinx`>> | Floating-point instructions using integer registers | <<_processor_top_entity_generics, `RISCV_ISA_Zfinx`>>
3232
| <<_zifencei_isa_extension,`Zifencei`>> | Instruction stream synchronization instruction | Always enabled
33+
| <<_zibi_isa_extension,`Zibi`>> | Branches with immediate-comparison | <<_processor_top_entity_generics, `RISCV_ISA_Zibi`>>
3334
| <<_zicntr_isa_extension,`Zicntr`>> | Base counters extension | <<_processor_top_entity_generics, `RISCV_ISA_Zicntr`>>
3435
| <<_zicond_isa_extension,`Zicond`>> | Integer conditional operations | <<_processor_top_entity_generics, `RISCV_ISA_Zicond`>>
3536
| <<_zicsr_isa_extension,`Zicsr`>> | Control and status register access instructions | Always enabled
@@ -134,7 +135,7 @@ The "compressed" ISA extension provides 16-bit encodings of commonly used instru
134135
| ALU | `c.addi4spn` `c.nop` `c.add[i]` `c.li` `c.addi16sp` `c.lui` `c.and[i]` `c.sub` `c.xor` `c.or` `c.mv` | 2
135136
| ALU shifts | `c.srli` `c.srai` `c.slli` | 2 + `T_shift_latency`
136137
| Branch | `c.beqz` `c.bnez` | not taken: 3 +
137-
taken 5 + `T_inst_latency`
138+
taken: 5 + `T_inst_latency`
138139
| Jump/call | `c.jal[r]` `c.j` `c.jr` | 5 + `T_inst_latency`
139140
| Load/store | `c.lw` `c.sw` `c.lwsp` `c.swsp` | 4 + `T_data_latency`
140141
| System | `c.break` | 7 + `T_inst_latency`
@@ -163,7 +164,7 @@ The `I` ISA extensions is the base RISC-V integer ISA that is always enabled.
163164
| ALU | `add[i]` `slt[i]` `slt[i]u` `xor[i]` `or[i]` `and[i]` `sub` `lui` `auipc` | 2
164165
| ALU shifts | `sll[i]` `srl[i]` `sra[i]` | 3 + `T_shift_latency`
165166
| Branch | `beq` `bne` `blt` `bge` `bltu` `bgeu` | not taken: 3 +
166-
taken 5 + `T_inst_latency`
167+
taken: 5 + `T_inst_latency`
167168
| Jump/call | `jal[r]` | 5 + `T_inst_latency`
168169
| Load/store | `lb` `lh` `lw` `lbu` `lhu` `sb` `sh` `sw` | 4 + `T_data_latency`
169170
| Data fence | `fence` | 2
@@ -336,6 +337,26 @@ If a computational instruction generates a subnormal result it is also flushed t
336337
|=======================
337338

338339

340+
==== `Zibi` ISA Extension
341+
342+
The RISC-V `Zibi` ISA extension adds two new "branch with immediate" instruction. The instruction's
343+
`rs2` address bits are used to select one out of 32 pre-defined immediate values which is used for
344+
the actual comparison.
345+
346+
.Non-Ratified ISA Extension
347+
[WARNING]
348+
The RISC-V `Zibi` ISA extension has not been ratified yet!
349+
350+
.Instructions and Timing
351+
[cols="<3,<2,<5"]
352+
[options="header", grid="rows"]
353+
|=======================
354+
| Class | Instructions | Execution cycles
355+
| Branch with immediate | `beqi` `bnei` | not taken: 3 +
356+
taken: 5 + `T_inst_latency`
357+
|=======================
358+
359+
339360
==== `Zicntr` ISA Extension
340361

341362
The `Zicntr` ISA extension adds the basic <<_cycleh>>, <<_mcycleh>>, <<_instreth>> and <<_minstreth>>

docs/datasheet/soc.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ The generic type "`suv(x:y)`" is an abbreviation for "`std_ulogic_vector(x downt
232232
| `RISCV_ISA_Zbkx` | boolean | false | Enable <<_zbkx_isa_extension>> (scalar cryptography crossbar permutations).
233233
| `RISCV_ISA_Zbs` | boolean | false | Enable <<_zbs_isa_extension>> (single-bit bit-manipulation instructions).
234234
| `RISCV_ISA_Zfinx` | boolean | false | Enable <<_zfinx_isa_extension>> (single-precision floating-point unit).
235+
| `RISCV_ISA_Zibi` | boolean | false | Enable <<_zibi_isa_extension>> (CPU base counters).
235236
| `RISCV_ISA_Zicntr` | boolean | false | Enable <<_zicntr_isa_extension>> (CPU base counters).
236237
| `RISCV_ISA_Zicond` | boolean | false | Enable <<_zicond_isa_extension>> (integer conditional instructions).
237238
| `RISCV_ISA_Zihpm` | boolean | false | Enable <<_zihpm_isa_extension>> (hardware performance monitors).

docs/figures/neorv32_processor.png

-1.71 KB
Loading

docs/references/riscv-zibi.pdf

84.6 KB
Binary file not shown.

rtl/core/neorv32_clint.vhd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ architecture neorv32_clint_rtl of neorv32_clint is
5959
signal mtime_we : std_ulogic_vector(1 downto 0);
6060

6161
-- mtimecmp access --
62-
type mtimecmp_rwe_t is array (0 to 15) of std_ulogic_vector(1 downto 0);
62+
type mtimecmp_rwe_t is array (0 to NUM_HARTS-1) of std_ulogic_vector(1 downto 0);
6363
signal mtimecmp_we : mtimecmp_rwe_t;
6464
signal mtimecmp_re : mtimecmp_rwe_t;
6565
signal mtimecmp_en : std_ulogic_vector(NUM_HARTS-1 downto 0);

0 commit comments

Comments
 (0)