Commit graph

63 commits

Author SHA1 Message Date
Katharina
0e2e5128b2
Assign a default value to tinst in decoder (#2830)
Some checks failed
bender-up-to-date / bender-up-to-date (push) Has been cancelled
ci / build-riscv-tests (push) Has been cancelled
ci / execute-riscv64-tests (push) Has been cancelled
ci / execute-riscv32-tests (push) Has been cancelled
This PR assigns 0 to tinst by default.
Even though tinst is only used when CVA6Cfg.RVH is enabled, I chose to assign it a default value in all configurations, since the signal is defined for all configurations.

Fixes #2803

Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2025-03-14 22:42:29 +01:00
André Sintzoff
07f19ea319
decoder.sv: add condition CVA6Cfg.SoftwareInterruptEn (#2747)
Some checks are pending
bender-up-to-date / bender-up-to-date (push) Waiting to run
ci / build-riscv-tests (push) Waiting to run
ci / execute-riscv64-tests (push) Blocked by required conditions
ci / execute-riscv32-tests (push) Blocked by required conditions
to improve conditional coverage
Signed-off-by: André Sintzoff <andre.sintzoff@thalesgroup.com>
Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2025-01-29 11:46:34 +01:00
Farhan Ali Shah
542fe39adc
Adding support for ZCMT Extension for Code-Size Reduction in CVA6 (#2659)
Some checks are pending
bender-up-to-date / bender-up-to-date (push) Waiting to run
ci / build-riscv-tests (push) Waiting to run
ci / execute-riscv64-tests (push) Blocked by required conditions
ci / execute-riscv32-tests (push) Blocked by required conditions
## Introduction
This PR implements the ZCMT extension in the CVA6 core, targeting the 32-bit embedded-class platforms. ZCMT is a code-size reduction feature that utilizes compressed table jump instructions (cm.jt and cm.jalt) to reduce code size for embedded systems
**Note:** Due to implementation complexity, ZCMT extension is primarily targeted at embedded class CPUs. Additionally, it is not compatible with architecture class profiles.(Ref. [Unprivilege spec 27.20](https://drive.google.com/file/d/1uviu1nH-tScFfgrovvFCrj7Omv8tFtkp/view))

## Key additions

- Added zcmt_decoder module for compressed table jump instructions: cm.jt (jump table) and cm.jalt (jump-and-link table)

- Implemented the Jump Vector Table (JVT) CSR to store the base address of the jump table in csr_reg module

- Implemented a return address stack, enabling cm.jalt to behave equivalently to jal ra (jump-and-link with return address), by pushing the return address onto the stack in zcmt_decoder module

## Implementation in CVA6
The implementation of the ZCMT extension involves the following major modifications:

### compressed decoder 
The compressed decoder scans and identifies the cm.jt and cm.jalt instructions, and generates signals indicating that the instruction is both compressed and a ZCMT instruction.

### zcmt_decoder
A new zcmt_decoder module was introduced to decode the cm.jt and cm.jalt instructions, fetch the base address of the JVT table from JVT CSR, extract the index and construct jump instructions to ensure efficient integration of the ZCMT extension in embedded platforms. Table.1 shows the IO port connection of zcmt_decoder module. High-level block diagram of zcmt implementation in CVA6 is shown in Figure 1.

_Table. 1 IO port connection with zcmt_decoder module_
Signals | IO | Description | Connection | Type
-- | -- | -- | -- | --
clk_i | in | Subsystem Clock | SUBSYSTEM | logic
rst_ni | in | Asynchronous reset active low | SUBSYSTEM | logic
instr_i | in | Instruction in | compressed_decoder | logic [31:0]
pc_i | in | Current PC | PC from FRONTEND | logic [CVA6Cfg.VLEN-1:0]
is_zcmt_instr_i | in | Is instruction a zcmt instruction | compressed_decoder | logic
illegal_instr_i | in | Is instruction a illegal instruction | compressed_decoder | logic
is_compressed_i | in | Is instruction a compressed instruction | compressed_decoder | logic
jvt_i | in | JVT struct from CSR | CSR | jvt_t
req_port_i | in | Handshake between CACHE and FRONTEND (fetch) | Cache | dcache_req_o_t
instr_o | out | Instruction out | cvxif_compressed_if_driver | logic [31:0]
illegal_instr_o | out | Is the instruction is illegal | cvxif_compressed_if_driver | logic
is_compressed_o | out | Is the instruction is compressed | cvxif_compressed_if_driver | logic
fetch_stall_o | out | Stall siganl | cvxif_compressed_if_driver | logic
req_port_o | out | Handshake between CACHE and FRONTEND (fetch) | Cache | dcache_req_i_t

### branch unit condition
A condition is implemented in the branch unit to ensure that ZCMT instructions always cause a misprediction, forcing the program to jump to the calculated address of the newly constructed jump instruction.

### JVT CSR
A new JVT csr is implemented in csr_reg which holds the base address of the JVT table. The base address is fetched from the JVT CSR, and combined with the index value to calculate the effective address.

### No MMU
Embedded platform does not utilize the MMU, so zcmt_decoder is connected with cache through port 0 of the Dcache module for implicit read access from the memory.

![zcmt_block drawio](https://github.com/user-attachments/assets/ac7bba75-4f56-42f4-9f5e-0c18f00d4dae)
_Figure. 1 High level block diagram of ZCMT extension implementation_

## Known Limitations
The implementation targets 32-bit instructions for embedded-class platforms without an MMU. Since the core does not utilize an MMU, it is leveraged to connect the zcmt_decoder to the cache via port 0.

## Testing and Verification

- Developed directed test cases to validate cm.jt and cm.jalt instruction functionality
- Verified correct initialization and updates of JVT CSR

### Test Plan 
A test plan is developed to test the functionality of ZCMT extension along with JVT CSR. Directed Assembly test executed to check the functionality. 

_Table. 2 Test plan_
S.no | Features | Description | Pass/Fail Criteria | Test Type | Test status
-- | -- | -- | -- | ---- | --
1 | cm.jt | Simple assembly test to validate the working of cm.jt instruction in  CV32A60x. | Check against Spike's ref. model | Directed | Pass
2 | cm.jalt | Simple assembly test to validate the working of cm.jalt instruction in both CV32A60x. | Check against Spike's ref. model | Directed | Pass
3 | cm.jalt with return address stack | Simple assembly test to validate the working of cm.jalt instruction with return address stack in both CV32A60x. It works as jump and link ( j ra, imm) | Check against Spike's ref. model | Directed | Pass
4 | JVT CSR | Read and write base address of Jump table to JVT CSR | Check against Spike's ref. model | Directed | Pass


**Note**: Please find the test under CVA6_REPO_DIR/verif/tests/custom/zcmt"
2025-01-27 13:23:26 +01:00
Guillaume Chauvon
3ce44b1b4e
Spyglass clean up: multiple change to remove Spyglass warnings (#2727)
Some checks are pending
bender-up-to-date / bender-up-to-date (push) Waiting to run
ci / build-riscv-tests (push) Waiting to run
ci / execute-riscv64-tests (push) Blocked by required conditions
ci / execute-riscv32-tests (push) Blocked by required conditions
Multiple changes to clean up code and remove Spyglass warnings.

Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2025-01-23 08:32:31 +01:00
Guillaume Chauvon
664c515b22
Fix decoding of CLRI, BINVI, BSETI, BEXTI and RORI where bit 25 is reserved in RV32 (#2728)
Some checks are pending
bender-up-to-date / bender-up-to-date (push) Waiting to run
ci / build-riscv-tests (push) Waiting to run
ci / execute-riscv64-tests (push) Blocked by required conditions
ci / execute-riscv32-tests (push) Blocked by required conditions
Fix decoding of some bitmanip instruction where decoding differs between rv32 and rv64.
Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2025-01-22 23:45:09 +01:00
Munail Waqar
f7dd49efa5
Adding support for Scalar Crypto Extension (Bitmanip instructions for Cryptography, Zbkb) (#2653)
Some checks are pending
bender-up-to-date / bender-up-to-date (push) Waiting to run
ci / build-riscv-tests (push) Waiting to run
ci / execute-riscv64-tests (push) Blocked by required conditions
ci / execute-riscv32-tests (push) Blocked by required conditions
Introduction
This PR adds support for Zbkb extension in the CVA6 core. It also adds the documentation for this extension. These changes have been tested with self-written single instruction tests and with the riscv-arch-tests. This PR will be followed by other PRs that will add complete support for the Zkn - NIST Algorithm Suite extension.

Implementation
Zbkb Extension:
Added support for the Zbkb instruction set. It essentially expands the Zbb extension with additional instructions useful in cryptography. These instructions are pack, packh, packw, brev8, unzip and zip.

Modifications
1. A new bit ZKN was added. The complete Zkn extension will be added under this bit for ease of use. This configuration will also require the RVB (bitmanip) bit to be set.
2. Updated the ALU and decoder to recognize and handle Zbkb instructions.

Documentation and Reference
The official RISC-V Cryptography Extensions Volume I was followed to ensure alignment with ratification. The relevant documentation for the Zbkb instruction was also added.

Verification
Assembly Tests:
The instructions were tested and verified with the K module of both 32 bit and 64 bit versions of the riscv-arch-tests to ensure proper functionality. These tests check for ISA compliance, edge cases and use assertions to ensure expected behavior. The tests include:
pack-01.S
packh-01.S
packw-01.S
brev8-01.S
unzip-01.S
zip-01.S
2024-12-18 22:35:41 +01:00
André Sintzoff
8070febca0
spyglass: remove W528 warnings in decoder.sv (#2503) 2024-09-19 15:45:36 +02:00
JeanRochCoulon
8ef28596d5
Code clean-up of the number of register address bits (#2483) 2024-08-30 17:22:53 +02:00
Guillaume Chauvon
8fa590b5c3
CVXIF 1.0.0 (#2340) 2024-07-12 10:53:18 +02:00
André Sintzoff
21733e55d7
decoder.sv: add checks for some B instructions (fix #2276) (#2282) 2024-06-21 10:54:10 +02:00
JeanRochCoulon
dd763b4f4c
Rename FpuEn into RVF (#2109) 2024-05-15 09:16:44 +02:00
Asmaa Kassimi
807ed7825c
Add Supervisor condition under Interrupt control and remove else condition. (#2098) 2024-05-12 21:02:57 +02:00
Florian Zaruba
377b0de154
Fix SuperScalar config and add CVA6Cfg to first pass decoder (#2047)
* Add `CVA6Cfg` to first pass decoder

* Fix `verilator` `SELRANGE` warnings

* Update core/decoder.sv

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update core/cva6_accel_first_pass_decoder_stub.sv

Co-authored-by: Côme <124148386+cathales@users.noreply.github.com>

* Update core/decoder.sv

Co-authored-by: Côme <124148386+cathales@users.noreply.github.com>

* Update core/frontend/instr_queue.sv

Co-authored-by: Côme <124148386+cathales@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Côme <124148386+cathales@users.noreply.github.com>
2024-04-17 16:34:08 +02:00
André Sintzoff
9bd5667992
decoder.sv: fix ZEXT.H instruction (fix #1758, #1975, #2010) (#2032)
- add missing ZEXT.H for RV64
- fix ZEXT.H for RV32: bit[24:20] shall be 0
2024-04-11 16:38:11 +02:00
JeanRochCoulon
4423feb06a
Rename ZiCondExtEn and FPGA_EN parameters (#1992) 2024-04-02 15:37:58 +02:00
Bruno Sá
294ec96e76
Fix illegal instruction issue #1953 (#1955) 2024-03-25 07:26:42 +01:00
Bruno Sá
86e1408666
Hypervisor extension (#1938)
Support 64bit H extension
2024-03-21 10:28:01 +01:00
Côme
bd4b57cc64
Parametrization step 3 part 3 (last) (#1940) 2024-03-18 16:19:52 +01:00
Côme
4817575de9
Parametrization step 3 part 2 (#1939) 2024-03-18 12:06:55 +01:00
Côme
987c645bb7
Parametrization step 3 (#1935)
This is the third step for #1451. Many values are moved but not all values are moved yet

* move NR_SB_ENTRIES & TRANS_ID_BITS
* remove default rvfi_instr_t from spike.sv
* fifo_v3: ariane_pkg::FPGA_EN becomes a param
* move FPGA_EN
* inline wt_cache_pkg::L15_SET_ASSOC
* move wt_cache_pkg::L15_WAY_WIDTH
* inline wt_cache_pkg::L1I_SET_ASSOC
* inline wt_cache_pkg::L1D_SET_ASSOC
* move wt_cache_pkg::DCACHE_CL_IDX_WIDTH
* move ICACHE_TAG_WIDTH
* move DCACHE_TAG_WIDTH
* move ICACHE_INDEX_WIDTH
* move ICACHE_SET_ASSOC
* use ICACHE_SET_ASSOC_WIDTH instead of $clog2(ICACHE_SET_ASSOC)
* move DCACHE_NUM_WORDS
* move DCACHE_INDEX_WIDTH
* move DCACHE_OFFSET_WIDTH
* move DCACHE_BYTE_OFFSET
* move DCACHE_DIRTY_WIDTH
* move DCACHE_SET_ASSOC_WIDTH
* move DCACHE_SET_ASSOC
* move CONFIG_L1I_SIZE
* move CONFIG_L1D_SIZE
* move DCACHE_LINE_WIDTH
* move ICACHE_LINE_WIDTH
* move ICACHE_USER_LINE_WIDTH
* move DCACHE_USER_LINE_WIDTH
* DATA_USER_WIDTH = DCACHE_USER_WIDTH
* move DCACHE_USER_WIDTH
* move FETCH_USER_WIDTH
* move FETCH_USER_EN
* move LOG2_INSTR_PER_FETCH
* move INSTR_PER_FETCH
* move FETCH_WIDTH
* transform SSTATUS_SD and SMODE_STATUS_READ_MASK into functions
* move [SM]_{SW,TIMER,EXT}_INTERRUPT into a structure
* move SV
* move vm_mode_t to config_pkg
* move MODE_SV
* move VPN2
* move PPNW
* move ASIDW
* move ModeW
* move XLEN_ALIGN_BYTES
* move DATA_USER_EN
* format: apply verible
2024-03-15 17:21:34 +00:00
Côme
aed4ed7c23
move functions into modules (#1926) 2024-03-13 17:46:33 +01:00
Rohan Arshid
c827c3b770
Zcmp extension support (#1779) 2024-03-13 11:37:49 +01:00
Côme
32a3cd56ee
Parametrization step 2 (#1908) 2024-03-08 22:53:42 +01:00
André Sintzoff
1474395869
decoder.sv: sfence.vma valid only if S mode supported (fix #1866) (#1869) 2024-02-23 23:10:40 +01:00
JeanRochCoulon
b4c287a18e
Design Document, add ID_STAGE description (#1832) 2024-02-16 16:17:46 +01:00
Guillaume Chauvon
fa101fae7a
Parameterize TVAL to reduce size in embedded (#1784) 2024-01-25 15:47:06 +01:00
Yannick Casamatta
0ce6b40b26
Remove all logic and sequential related to RVFI in CORE cva6 (#1762) 2024-01-18 22:51:10 +01:00
André Sintzoff
3afe870d78
csr_regfile.sv: add RVB field for MISA (fix #1734) (#1760) 2024-01-15 14:34:25 +01:00
Gull Ahmed
8c14b6aa4a
resolving issue #1613 (#1714) 2023-12-17 17:59:22 +01:00
Côme
fab3255823
refactor(decoder): simplify interrupt indexing (#1709) 2023-12-14 14:36:17 +01:00
AEzzejjari
738d53af1c
Code coverage: condition RTL With parameters (#1703) 2023-12-13 07:52:47 +01:00
AEzzejjari
cbd3e9fe19
Modify coding style to improve CC (#1672) 2023-12-05 14:51:23 +01:00
MarioOpenHWGroup
220f534b6d
Spike Tandem Implementation using VCS simulator (#1561) 2023-11-09 19:29:24 +01:00
JeanRochCoulon
d087fd7c8a
[HOT FIX] Add else to SRET instruction decode (#1595)
Add the generation of illegal instruction in case of SRET decoding and supervisor mode disable
2023-11-06 08:21:12 +00:00
JeanRochCoulon
3fcb7b9c9b
Do not support DRET when DebugEn = 0 (#1596)
When debug mode is disable, DRET instruction is not supported.
2023-11-06 07:50:46 +00:00
Fatima Saleem
f14254dff6
removing zexth duplicated code for RV64 (#1589)
revert decoder.sv modifications done in a99f115d41
2023-11-02 09:29:47 +00:00
Fatima Saleem
a99f115d41
conditioned RTL with XLEN parameter (#1579) 2023-10-31 19:54:19 +01:00
AEzzejjari
1faaec09bc
Code_coverage: condition RTL with the debug parameter (#1582) 2023-10-31 17:35:59 +01:00
AEzzejjari
d92f0f76d0
Code_coverage: condition RTL with the U-MODE parameter (#1583) 2023-10-31 13:45:58 +01:00
AEzzejjari
4b67475fa4
Code_coverage: condition RTL with the S-MODE parameter (#1574) 2023-10-27 22:38:52 +02:00
André Sintzoff
7cd183b710
verible-verilog-format: apply it on core directory (#1540)
using verible-v0.0-3422-g520ca4b9/bin/verible-verilog-format
with default configuration

Note: two files are not correctly handled by verible
- core/include/std_cache_pkg.sv
- core/cache_subsystem/cva6_hpdcache_if_adapter.sv
2023-10-18 16:36:00 +02:00
Florian Zaruba
93782ddfb5
Merge CVA6Cfg and ArianeCfg (#1321) 2023-09-28 11:41:38 +02:00
AEzzejjari
4641acf9d2
Code_ coverage: Remove VCS coverage pragma for BitManip (#1469) 2023-09-23 00:22:29 +02:00
Fatima Saleem
2ac676d931
Add Zicond Extension support in CVA6 (#1405) 2023-09-15 08:19:50 +02:00
JeanRochCoulon
c8202ae1ad
Decode AMOXOR_D (and similar instructions) only when XLEN=64bits (#1355) 2023-09-01 11:57:08 +02:00
JeanRochCoulon
434e55c457
Generate illegal opcode when execute LWU with XLEN=32 (#1344)
Signed-off-by: Jean-Roch Coulon <jean-roch.coulon@thalesgroup.com>
2023-08-28 21:55:37 +02:00
JeanRochCoulon
1db42ee8da
Add variant into CVA6 parameter (#1320)
* Variane as CVA6 parameter

Signed-off-by: Jean-Roch Coulon <jean-roch.coulon@thalesgroup.com>

* fix FPGA build

Signed-off-by: Jean-Roch Coulon <jean-roch.coulon@thalesgroup.com>

* Fix tipo in cva6.sv

* fix lint warnings

Signed-off-by: Jean-Roch Coulon <jean-roch.coulon@thalesgroup.com>

* Fix is_*_fpr functions

* remove blank lines

* set IsRVFI out of CVA6Cfg

* define config_pkg

* Fix ariane_pkg comments

* Fix Lint from André's feedbacks

* Fix parameter transmission

* Fix replace CVA6Cfg by CVA6ExtendCfg in cva6.sv

* fix add CVA6Cfg in instr_queue, instr_scan and pmp parameters

---------

Signed-off-by: Jean-Roch Coulon <jean-roch.coulon@thalesgroup.com>
Co-authored-by: ALLART Come <come.allart@thalesgroup.com>
2023-08-22 14:04:06 +02:00
JeanRochCoulon
279ce9fb9b
Define RVFI as cva6 parameter (#1293) 2023-07-19 08:21:39 +02:00
Fatima Saleem
4d2a9fe032
Resolved Lint WIDTHEXPAND warnings(1/2) (#1303) 2023-07-18 11:06:09 +02:00
Nils Wistoff
513bb91f82
Add Ara support (#1024)
Support Ara via a custom, parametrised accelerator interface.

    cv64a6_imafdcv_sv39_config_pkg.sv enables V extension
    Pre-processor constant ARIANE_ACCELERATOR_PORT enables the interface between CVA6 and Ara. 
    FPU is bumped to a SIMD-compatible version

Backwards compatibility should be preserved. Once this is merged, we will change the reference of Ara upstream CVA6.

-----

Signed-off-by: Nils Wistoff <nwistoff@iis.ee.ethz.ch>
Co-authored-by: Matheus Cavalcante <matheusd@iis.ee.ethz.ch>
Co-authored-by: Matteo Perotti <mperotti@iis.ee.ethz.ch>
Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2023-07-10 17:12:59 +02:00