Commit graph

113 commits

Author SHA1 Message Date
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
Valentin Thomazic
160c322f53
improve dashboard-provided log (#2636)
* Due to the increased count of warnings, provide tail of log instead of head on the dashboard
* Add tandem yaml report file on the jobs reports
* Reduce UVM Verbosity on smoke gen tests
2024-11-28 11:46:47 +01:00
Valentin Thomazic
6ee7a7d0c2
CI fixes (#2634)
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
* Increase timeout for compliance testlist
* Switch to verilator for riscv-tests-v for faster sim
* fix reports for non tandem jobs
2024-11-27 08:00:41 +01:00
AEzzejjari
2157aaa926
Accelerate the performance of the AXI agent (#2631)
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
Accelerate the performance of the AXI agent by disabling all the randomization and sending responses with zero delay
2024-11-25 18:02:30 +01:00
Valentin Thomazic
e7f27c1300
Disable tandem on riscv-tests-v tests (#2609)
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
* Disable tandem on riscv-tests-v testlist
* More relevant error message on report tandem script
Related issue: #2605
2024-11-18 23:15:59 +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
Valentin Thomazic
4f5492d341
Add failure checks in report_tandem script (#2597)
Add failures checks in `.gitlab-ci/scripts/report_tandem.py`:
* catch wrong or missing log directory
* catch wrong yaml reports
2024-11-12 14:56:25 +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
Valentin Thomazic
3d267f9344
refactor gitlab ci & collect full fpga build artifacts (#2576)
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
* refactor gitlab ci & collect full fpga build artifacts
* remove fpga log.tail from dashboard
2024-11-04 19:37:52 +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
Jean-Roch Coulon
01c636dd55 report_benchmarks.py: update results
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-10-23 18:24:38 +02:00
Jean-Roch Coulon
6fc8d60c14 Dhrystone_smoke.sh: smoke-smoke is done on dhrystone for the cv32a65x configuration 2024-10-23 18:24:38 +02:00
Jean-Roch Coulon
ce24338d5b Run 4 iterations of coremark to improve results 2024-10-23 18:24:38 +02:00
Jean-Roch Coulon
fd6037fefe Set BHTEntries=128, cache=WT and scoreboardentries=8, Icache size=16384 to improve Coremark and Dhrystone results 2024-10-23 18:24:38 +02:00
JeanRochCoulon
45eaace82b
Revert "Multicommits to shorten smoke-tests duration, to declare VLEN as para…" (#2564)
This reverts commit 0877e8e446.
2024-10-23 18:12:49 +02:00
JeanRochCoulon
0877e8e446
Multicommits to shorten smoke-tests duration, to declare VLEN as parameter, to improve coremark results, to implement spike.yaml/linker dedicated to 65x (#2563)
- FIX: Replace riscv_pkg:VLEN by CVA6Cfg.VLEN
- Declare VLEN as new CVA6 parameter
- smoke-hwconfig: run with vcs-uvm and use return0 tests to speed-up CI light stage timing execution
- Use dedicated linker scripts for 65x configuration.
- Use dedicated spike.yaml for 65x configuration.
- Set BHTEntries=128, cache=WT, scoreboard entries=8 to improve Coremark and Dhrystone results
- Run 4 iterations of coremark to improve results
2024-10-23 17:56:06 +02:00
Côme
c1c2f9d922
ci: print results in job logs (#2561)
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 modification allows:
- printing the results in the terminal
- running the script from the terminal (without the environment variables from CI)
The yaml report is only built in CI, but the results are always printed.
2024-10-22 19:03:46 +02: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
JeanRochCoulon
7ae870e02f
cv32a65x CI: Enlarge cache to increase bench result and switch from -O3 to -Os compiler option (#2541)
* .gitlab-ci.yml: Enlarge cv32a65x cache size

* Dhrystone_smoke.sh: switch from -O3 to -Os option
2024-10-11 09:42:37 +02:00
Jean-Roch Coulon
b744f9bb09 Create job dedicated to benchmark CVA6 2024-10-08 21:14:33 +02:00
JeanRochCoulon
08c81658ec
Display report at the end of dhrystone and coremark executions (#2529) 2024-10-04 17:52:06 +02:00
jzthales
6ccd8d8bfa
Refactor forwarding in issue_stage module (#2519) 2024-10-01 06:13:30 +02:00
JeanRochCoulon
56532c6963
Simplify CI (#2517)
Modify CI to always check with Tandem and promote UVM TB use
2024-09-27 10:01:46 +02:00
André Sintzoff
6561f2c641
report_benchmark.py: fix Dhrystone cycles after PR #2484 (#2488)
after commit 111df66 the CVA6 configuration used for Dhrystone
benchmark is rv64gc_zba_zbb_zbs_zbc instead of rv64imafdc_zicsr_zifencei

therefore the number of cycles is reduced
2024-09-02 16:39:12 +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
Côme
4c36aafaf0
fix CI (#2460)
* fix .gitlab-ci.yml

* Update report_tandem.py
2024-08-23 11:34:17 -04:00
valentinThomazic
28affa2346
[CI] use spike tandem on smoke-tests (#2438) 2024-08-22 17:04:48 +02:00
valentinThomazic
7435cb310e
fix Spyglass job falsely reporting fail (#2435) 2024-08-07 12:12:38 +02:00
JeanRochCoulon
14fd617455
Fix expected_synth.yml (#2428)
Difficult to adjust it all the time !
2024-08-02 06:47:03 +02:00
Asmaa Kassimi
12be3adb81
Solve some of W240 and W415a warnings increased by PMP entries (#2415) 2024-08-01 18:43:13 +02:00
Asmaa Kassimi
d4b62d7372
automate lint check process (#2414) 2024-07-30 09:22:13 +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
valentinThomazic
d4809a7e2b
change required dhrystone cycles count value (#2386) 2024-07-23 17:55:43 +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