Commit graph

63 commits

Author SHA1 Message Date
Côme
c784fd9047
WAW hazards elimination (#2881)
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
This PR introduces a new RAW hazard detection mechanism to eliminate WAW hazards in CVA6 issue stage.

It first checks for hazards in all scoreboard entries in parallel.
Then it filters found hazards before vs after the current issue pointer.
It then finds the index of the last hazard before (resp. after) the issue pointer.
Finally, it gives precedence to a hazard before the issue pointer over the one after the issue pointer.

---------

Co-authored-by: Junheng Zheng <junheng.zheng@thalesgroup.com>
Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2025-04-23 22:26:50 +02: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
98604b5920
csr_regfile: SEIP is read only 0 (fix #2056) (#2716)
Fix #2056

---------

Co-authored-by: JeanRochCoulon <jean-roch.coulon@thalesgroup.com>
2025-01-21 14:53:37 +01:00
JeanRochCoulon
2155d0e9c4
Fix #2665 #2400 #2657 (#2685)
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 #2400: define new PmpNapotEn parameter to disable NAPOT

* Fix #2665 by removing NA4 related RTL lines

* Fix Spyglass

* Fix gate count
2025-01-07 08:45:28 +01:00
JeanRochCoulon
73bae85e0c
[HOT FIX] Update expected_synth.yml (#2676)
Fix unexpected gate count increase due to Zbkb crypto extension
2024-12-19 14:00:37 +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
Côme
fd213fc19e
cut dangerous path from flush to issue (#2666)
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
serdiv is the only FLU which has a combinational path from flush_i
to the result bus
2024-12-12 19:10:26 +01:00
OlivierBetschi
23355d29f0
Pmp/extracted pmp master (#2528)
Extraction of the PMP outside of the MMU.
2024-12-04 10:06:36 +01:00
JeanRochCoulon
a283d3eea2
Define cv32a60x configuration (#2608)
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
2024-11-18 15:51:21 +01:00
JeanRochCoulon
2d9936d171
Disable superscalar for cv32a65x configuration (Enable single issue) (#2600) 2024-11-14 12:22:30 +01:00
Côme
7eb59c3e16
iro: remove an unreachable statement (#2588)
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
2024-11-12 20:32:40 +01:00
Cesar Fuguet
6bbc1e6d35
update the hpdcache to its latest version (#2579)
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
2024-11-05 23:57:20 +01:00
JeanRochCoulon
3a9c2aa1ba
[HOT FIX] Update expected gate count result (#2574)
This gate count increase has been added by #2555. The root cause has not been found but the deviation is small, and as it impacts the merge process (the ci is red), I prefer to fix the ci.
2024-11-04 17:41:58 +01:00
JeanRochCoulon
c8f2c39e48
Use uvm testbench to run gate simulations (#2548)
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
2024-10-16 07:08:59 +02:00
jzthales
6ccd8d8bfa
Refactor forwarding in issue_stage module (#2519) 2024-10-01 06:13:30 +02:00
dependabot[bot]
ea3a55450b
Bump core/cache_subsystem/hpdcache from 25ffa34 to b4519e7 (#2466) 2024-08-31 08:51:52 +02:00
Côme
0d2097be0c
Fix minstret (#2471) 2024-08-28 10:54:52 +02:00
Côme
339d3dd851
Increase code coverage on second ALU by removing branch logic (#2362) 2024-08-26 17:32:24 +02:00
JeanRochCoulon
14fd617455
Fix expected_synth.yml (#2428)
Difficult to adjust it all the time !
2024-08-02 06:47:03 +02:00
Moritz Schneider
fd489a16fb
Fix off by one error in PMP length (#2394) 2024-07-25 12:08:53 +02:00
Côme
4ff16f9da3
set WtDcacheWbufDepth to 8 (#2390) 2024-07-24 23:54:26 +02:00
Côme
4a223bee46
decorrelate instr and addr depths in IQ (#2375) 2024-07-22 14:22:56 +02:00
Guillaume Chauvon
8fa590b5c3
CVXIF 1.0.0 (#2340) 2024-07-12 10:53:18 +02:00
Côme
5fcc39dbee
remove round interval (#2353) 2024-07-11 17:35:03 +02:00
Côme
2dcb7417b4
make cv32a65x superscalar (#2348) 2024-07-10 23:33:49 +02:00
Moritz Schneider
6044454a07
Fix index calculation for PMPCFG CSR write logic (#2330) 2024-07-05 22:56:27 +02:00
Asmaa Kassimi
67dba2cad3
condition csr_regfile.sv (#2310) 2024-07-05 14:14:01 +02:00
Côme
ce1e889716
update expected area (#2299) 2024-06-28 15:02:58 +02:00
JeanRochCoulon
cb6211bbb8
Remove cv32a6_embedded configuration (#2246) 2024-06-14 08:30:17 +02:00
AngelaGonzalezMarino
8164828913
Fix instruction realign when C extension is not used (#2241) 2024-06-13 11:17:25 +02:00
JeanRochCoulon
2266f75f2d
MTVAL is read-only zero when TvalEn = 0 (#2231) 2024-06-11 11:22:41 +02:00
JeanRochCoulon
7ccf82ce76
Add param to enable/disable Zihpm and Zicntr extensions for 65x (#2208) 2024-06-10 15:14:03 +02:00
Guillaume Chauvon
a5152b03a5
Add support for cv32a65x dedicated synthesis (#2178) 2024-06-04 10:58:09 +02:00
JeanRochCoulon
f4ec364bf4
Fix MIE CSR described in #2004 and #2008 Github issue (#2017) 2024-04-08 19:54:55 +02:00
Yannick Casamatta
1dec79464e
add csr in rvfi (#1833) 2024-02-24 00:10:23 +01:00
André Sintzoff
71f57a38c2
csr_regfile.sv: no MENVCFG[H], MCOUNTEREN when no User mode (fix #1843) (#1861) 2024-02-21 18:16:35 +01:00
JeanRochCoulon
de5d0d7ed4
cv32a65x (#1799) 2024-02-01 13:11:45 +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
Gull Ahmed
8c14b6aa4a
resolving issue #1613 (#1714) 2023-12-17 17:59:22 +01:00
AEzzejjari
738d53af1c
Code coverage: condition RTL With parameters (#1703) 2023-12-13 07:52:47 +01:00
JeanRochCoulon
d2453163eb
Update embedded config to improve trade-off performance gate count (#1701) 2023-12-12 18:43:09 +01:00
JeanRochCoulon
9f0e1b327d
Add 16 entry BHT in embedded configuration (#1658) 2023-11-28 06:14:11 +01:00
JeanRochCoulon
feda9ece82
Configure load to be wait state zero in embedded configuration (#1657) 2023-11-27 18:20:36 +01:00
JeanRochCoulon
b7e936e754
Implement only 1 dcache_ctrl instances when ACC and MMU_PRESENT are disabled (#1594) 2023-11-05 23:37:42 +01:00
JeanRochCoulon
b6ff6887c7
[hot fix] Update expected gate count (#1590) 2023-11-03 08:06:51 +00:00
AEzzejjari
1faaec09bc
Code_coverage: condition RTL with the debug parameter (#1582) 2023-10-31 17:35:59 +01:00
AEzzejjari
4b67475fa4
Code_coverage: condition RTL with the S-MODE parameter (#1574) 2023-10-27 22:38:52 +02:00
AEzzejjari
29a3f14868
Code_coverage: Add conditions for the AMO Extension (#1554) 2023-10-19 22:08:40 +02:00