[mxisa csr] add Zb* ISA estensions

relocate tuning options flags
This commit is contained in:
stnolting 2024-09-30 22:58:23 +02:00
parent ce2b89d583
commit 43d9d55f71
4 changed files with 36 additions and 20 deletions

View file

@ -934,7 +934,7 @@ outside of machine-mode will raise an illegal instruction exception.
[cols="<1,<8"]
[frame="topbot",grid="none"]
|=======================
| Name | Machine extended isa and extensions register
| Name | Machine extended ISA and extensions register
| Address | `0xfc0`
| Reset value | `DEFINED`
| ISA | `Zicsr` & `X`
@ -969,10 +969,12 @@ discover ISA sub-extensions and CPU configuration options
| 19 | `CSR_MXISA_ZKSH` | r/- | <<_zksh_isa_extension>> available
| 20 | `CSR_MXISA_ZKSED` | r/- | <<_zksed_isa_extension>> available
| 21 | `CSR_MXISA_ZKS` | r/- | <<_zks_isa_extension>> available
| 23:22 | - | r/- | hardwired to zero
| 24 | `CSR_MXISA_IS_SIM` | r/- | set if CPU is being **simulated** (⚠️ not guaranteed)
| 28:25 | - | r/- | hardwired to zero
| 29 | `CSR_MXISA_RFHWRST` | r/- | full hardware reset of register file available when set (`REGFILE_HW_RST`)
| 30 | `CSR_MXISA_FASTMUL` | r/- | fast multiplication available when set (`FAST_MUL_EN`)
| 31 | `CSR_MXISA_FASTSHIFT` | r/- | fast shifts available when set (`FAST_SHIFT_EN`)
| 22 | `CSR_MXISA_ZBA` | r/- | <<_zba_isa_extension>> available
| 23 | `CSR_MXISA_ZBB` | r/- | <<_zbb_isa_extension>> available
| 24 | `CSR_MXISA_ZBS` | r/- | <<_zbs_isa_extension>> available
| 27:25 | - | r/- | _reserved_, hardwired to zero
| 28 | `CSR_MXISA_RFHWRST` | r/- | full hardware reset of register file available when set (`REGFILE_HW_RST`)
| 29 | `CSR_MXISA_FASTMUL` | r/- | fast multiplication available when set (`FAST_MUL_EN`)
| 30 | `CSR_MXISA_FASTSHIFT` | r/- | fast shifts available when set (`FAST_SHIFT_EN`)
| 31 | `CSR_MXISA_IS_SIM` | r/- | set if CPU is being **simulated** (⚠️ not guaranteed)
|=======================

View file

@ -41,9 +41,12 @@ entity neorv32_cpu_control is
RISCV_ISA_E : boolean; -- implement embedded-class register file extension
RISCV_ISA_M : boolean; -- implement mul/div extension
RISCV_ISA_U : boolean; -- implement user mode extension
RISCV_ISA_Zba : boolean; -- implement shifted-add bit-manipulation extension
RISCV_ISA_Zbb : boolean; -- implement basic bit-manipulation extension
RISCV_ISA_Zbkb : boolean; -- implement bit-manipulation instructions for cryptography
RISCV_ISA_Zbkc : boolean; -- implement carry-less multiplication instructions
RISCV_ISA_Zbkx : boolean; -- implement cryptography crossbar permutation extension?
RISCV_ISA_Zbs : boolean; -- implement single-bit bit-manipulation extension
RISCV_ISA_Zfinx : boolean; -- implement 32-bit floating-point extension
RISCV_ISA_Zicntr : boolean; -- implement base counters
RISCV_ISA_Zicond : boolean; -- implement integer conditional operations
@ -1893,7 +1896,7 @@ begin
csr.rdata(7) <= bool_to_ulogic_f(RISCV_ISA_Zicntr); -- Zicntr: base counters
csr.rdata(8) <= bool_to_ulogic_f(RISCV_ISA_Smpmp); -- Smpmp: physical memory protection
csr.rdata(9) <= bool_to_ulogic_f(RISCV_ISA_Zihpm); -- Zihpm: hardware performance monitors
csr.rdata(10) <= bool_to_ulogic_f(RISCV_ISA_Sdext); -- Sdext: RISC-V (external) debug mode
csr.rdata(10) <= bool_to_ulogic_f(RISCV_ISA_Sdext); -- Sdext: RISC-V external debug
csr.rdata(11) <= bool_to_ulogic_f(RISCV_ISA_Sdtrig); -- Sdtrig: trigger module
csr.rdata(12) <= bool_to_ulogic_f(RISCV_ISA_Zbkx); -- Zbkx: cryptography crossbar permutation
csr.rdata(13) <= bool_to_ulogic_f(RISCV_ISA_Zknd); -- Zknd: cryptography NIST AES decryption
@ -1905,12 +1908,19 @@ begin
csr.rdata(19) <= bool_to_ulogic_f(RISCV_ISA_Zksh); -- Zksh: ShangMi hash functions
csr.rdata(20) <= bool_to_ulogic_f(RISCV_ISA_Zksed); -- Zksed: ShangMi block cyphers
csr.rdata(21) <= bool_to_ulogic_f(RISCV_ISA_Zks); -- Zks: ShangMi algorithm suite
-- misc --
csr.rdata(24) <= bool_to_ulogic_f(is_simulation_c); -- is this a simulation?
csr.rdata(22) <= bool_to_ulogic_f(RISCV_ISA_Zba); -- Zba: shifted-add bit-manipulation
csr.rdata(23) <= bool_to_ulogic_f(RISCV_ISA_Zbb); -- Zbb: basic bit-manipulation extension
csr.rdata(24) <= bool_to_ulogic_f(RISCV_ISA_Zbs); -- Zbs: single-bit bit-manipulation extension
-- reserved --
csr.rdata(25) <= '0';
csr.rdata(26) <= '0';
csr.rdata(27) <= '0';
-- tuning options --
csr.rdata(29) <= bool_to_ulogic_f(REGFILE_HW_RST); -- full hardware reset of register file
csr.rdata(30) <= bool_to_ulogic_f(FAST_MUL_EN); -- DSP-based multiplication (M extensions only)
csr.rdata(31) <= bool_to_ulogic_f(FAST_SHIFT_EN); -- parallel logic for shifts (barrel shifters)
csr.rdata(28) <= bool_to_ulogic_f(REGFILE_HW_RST); -- full hardware reset of register file
csr.rdata(29) <= bool_to_ulogic_f(FAST_MUL_EN); -- DSP-based multiplication (M extensions only)
csr.rdata(30) <= bool_to_ulogic_f(FAST_SHIFT_EN); -- parallel logic for shifts (barrel shifters)
-- misc --
csr.rdata(31) <= bool_to_ulogic_f(is_simulation_c); -- is this a simulation?
-- --------------------------------------------------------------------
-- undefined/unavailable

View file

@ -329,14 +329,15 @@ enum NEORV32_CSR_XISA_enum {
CSR_MXISA_ZKSH = 19, /**< CPU mxisa CSR (19): scalar cryptography - ShangMi hash functions (r/-)*/
CSR_MXISA_ZKSED = 20, /**< CPU mxisa CSR (20): scalar cryptography - ShangMi block cyphers (r/-)*/
CSR_MXISA_ZKS = 21, /**< CPU mxisa CSR (21): scalar cryptography - ShangMi algorithm suite (r/-)*/
// Misc
CSR_MXISA_IS_SIM = 24, /**< CPU mxisa CSR (24): this might be a simulation when set (r/-)*/
CSR_MXISA_ZBA = 22, /**< CPU mxisa CSR (22): shifted-add bit-manipulation operation (r/-)*/
CSR_MXISA_ZBB = 23, /**< CPU mxisa CSR (23): basic bit-manipulation operation (r/-)*/
CSR_MXISA_ZBS = 24, /**< CPU mxisa CSR (24): single-bit bit-manipulation operation (r/-)*/
// Tuning options
CSR_MXISA_RFHWRST = 29, /**< CPU mxisa CSR (29): Register file has full hardware reset (r/-)*/
CSR_MXISA_FASTMUL = 30, /**< CPU mxisa CSR (30): DSP-based multiplication (M extensions only) (r/-)*/
CSR_MXISA_FASTSHIFT = 31 /**< CPU mxisa CSR (31): parallel logic for shifts (barrel shifters) (r/-)*/
CSR_MXISA_RFHWRST = 28, /**< CPU mxisa CSR (28): register file has full hardware reset (r/-)*/
CSR_MXISA_FASTMUL = 29, /**< CPU mxisa CSR (29): DSP-based multiplication (M extensions only) (r/-)*/
CSR_MXISA_FASTSHIFT = 30, /**< CPU mxisa CSR (30): parallel logic for shifts (barrel shifters) (r/-)*/
// Misc
CSR_MXISA_IS_SIM = 31 /**< CPU mxisa CSR (31): this might be a simulation when set (r/-)*/
};

View file

@ -450,9 +450,12 @@ void neorv32_rte_print_hw_config(void) {
if (tmp & (1<<CSR_MXISA_SDEXT)) { neorv32_uart0_printf("Sdext "); }
if (tmp & (1<<CSR_MXISA_SDTRIG)) { neorv32_uart0_printf("Sdtrig "); }
if (tmp & (1<<CSR_MXISA_SMPMP)) { neorv32_uart0_printf("Smpmp "); }
if (tmp & (1<<CSR_MXISA_ZBA)) { neorv32_uart0_printf("Zba "); }
if (tmp & (1<<CSR_MXISA_ZBB)) { neorv32_uart0_printf("Zbb "); }
if (tmp & (1<<CSR_MXISA_ZBKB)) { neorv32_uart0_printf("Zbkb "); }
if (tmp & (1<<CSR_MXISA_ZBKC)) { neorv32_uart0_printf("Zbkc "); }
if (tmp & (1<<CSR_MXISA_ZBKX)) { neorv32_uart0_printf("Zbkx "); }
if (tmp & (1<<CSR_MXISA_ZBS)) { neorv32_uart0_printf("Zbs "); }
if (tmp & (1<<CSR_MXISA_ZFINX)) { neorv32_uart0_printf("Zfinx "); }
if (tmp & (1<<CSR_MXISA_ZICNTR)) { neorv32_uart0_printf("Zicntr "); }
if (tmp & (1<<CSR_MXISA_ZICOND)) { neorv32_uart0_printf("Zicond "); }