Fixes and Update CVXIF non regression tests, regression and TB (#2424)

This commit is contained in:
Guillaume Chauvon 2024-08-01 16:06:24 +02:00 committed by GitHub
parent 6269f72b63
commit 81671e39fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 149 additions and 98 deletions

View file

@ -232,6 +232,24 @@ spyglass:
- mv spyglass/sg_run_results/cva6_sg_reports/cva6_lint_lint_rtl artifacts/lint_reports
- python3 .gitlab-ci/scripts/report_spyglass_lint.py spyglass/reference_summary.rpt artifacts/lint_reports/cva6_lint_lint_rtl/summary.rpt
cvxif-regression:
extends:
- .synthesis_test
variables:
DASHBOARD_JOB_TITLE: "CVXIF non-regression test $DV_SIMULATORS"
DASHBOARD_JOB_DESCRIPTION: "Short tests to challenge most CoreV-X-Interface in testharness"
DASHBOARD_SORT_INDEX: 5
DASHBOARD_JOB_CATEGORY: "Basic"
COLLECT_SIMU_LOGS: 1
parallel:
matrix:
- DV_SIMULATORS:
- "veri-testharness,spike"
- "vcs-testharness,spike"
script:
- bash verif/regress/cvxif_verif_regression.sh
- !reference [.simu_after_script]
asic-synthesis:
extends:
- .synthesis_test

View file

@ -11,27 +11,28 @@ module copro_alu
import cvxif_instr_pkg::*;
#(
parameter int unsigned NrRgprPorts = 2,
parameter int unsigned XLEN = 32,
parameter type hartid_t = logic,
parameter type id_t = logic,
parameter type registers_t = logic
) (
input logic clk_i,
input logic rst_ni,
input registers_t registers_i,
input opcode_t opcode_i,
input hartid_t hartid_i,
input id_t id_i,
input logic [ 4:0] rd_i,
output logic [31:0] result_o, // TODO parametrize to 64 bits
output hartid_t hartid_o,
output id_t id_o,
output logic [ 4:0] rd_o,
output logic valid_o,
output logic we_o
input logic clk_i,
input logic rst_ni,
input registers_t registers_i,
input opcode_t opcode_i,
input hartid_t hartid_i,
input id_t id_i,
input logic [ 4:0] rd_i,
output logic [XLEN-1:0] result_o,
output hartid_t hartid_o,
output id_t id_o,
output logic [ 4:0] rd_o,
output logic valid_o,
output logic we_o
);
logic [31:0] result_n, result_q;
logic [XLEN-1:0] result_n, result_q;
hartid_t hartid_n, hartid_q;
id_t id_n, id_q;
logic valid_n, valid_q;

View file

@ -12,6 +12,7 @@ module cvxif_example_coprocessor
#(
// CVXIF Types
parameter int unsigned NrRgprPorts = 2,
parameter int unsigned XLEN = 32,
parameter type readregflags_t = logic,
parameter type writeregflags_t = logic,
parameter type id_t = logic,
@ -25,7 +26,7 @@ module cvxif_example_coprocessor
parameter type x_result_t = logic,
parameter type cvxif_req_t = logic,
parameter type cvxif_resp_t = logic,
localparam type registers_t = logic [NrRgprPorts-1:0][31:0]
localparam type registers_t = logic [NrRgprPorts-1:0][XLEN-1:0]
) (
input logic clk_i, // Clock
input logic rst_ni, // Asynchronous reset active low
@ -52,8 +53,8 @@ module cvxif_example_coprocessor
hartid_t issue_hartid, hartid;
id_t issue_id, id;
logic [4:0] issue_rd, rd;
logic [31:0] result;
logic we;
logic [XLEN-1:0] result;
logic we;
// Issue and Register interface
// Mandatory when X_ISSUE_REGISTER_SPLIT = 0
@ -117,6 +118,7 @@ module cvxif_example_coprocessor
// Result interface
copro_alu #(
.NrRgprPorts(NrRgprPorts),
.XLEN(XLEN),
.hartid_t(hartid_t),
.id_t(id_t),
.registers_t(registers_t)

View file

@ -56,7 +56,7 @@ module cvxif_fu
assign x_ready_o = 1'b1; // Readyness of cvxif_fu is determined in issue stage by CVXIF issue interface
// Result signals
assign x_valid_o = x_illegal_i ? 1'b1 : result_valid_i;
assign x_valid_o = x_illegal_i && x_valid_i ? 1'b1 : result_valid_i;
assign x_result_o = result_i.data;
assign x_trans_id_o = x_illegal_i ? x_trans_id_i : result_i.id;
assign x_we_o = result_i.we;
@ -65,7 +65,7 @@ module cvxif_fu
// Handling of illegal instruction exception
always_comb begin
x_exception_o = '0; // No exception in this interface
if (x_illegal_i) begin
if (x_illegal_i && x_valid_i) begin
x_exception_o.valid = '1;
x_exception_o.cause = riscv::ILLEGAL_INSTR;
if (CVA6Cfg.TvalEn)

View file

@ -394,10 +394,10 @@ module issue_read_operands
// check that all operands are available, otherwise stall
// forward corresponding register
always_comb begin : operands_available
stall_raw = '{default: stall_i};
stall_rs1 = '{default: stall_i};
stall_rs2 = '{default: stall_i};
stall_rs3 = '{default: stall_i};
stall_raw = '{default: stall_i};
stall_rs1 = '{default: stall_i};
stall_rs2 = '{default: stall_i};
stall_rs3 = '{default: stall_i};
// operand forwarding signals
forward_rs1 = '0;
forward_rs2 = '0;
@ -417,10 +417,7 @@ module issue_read_operands
if (!issue_instr_i[i].use_zimm && ((CVA6Cfg.FpPresent && is_rs1_fpr(
issue_instr_i[i].op
)) ? rd_clobber_fpr_i[issue_instr_i[i].rs1] != NONE :
rd_clobber_gpr_i[issue_instr_i[i].rs1] != NONE) ||
((CVA6Cfg.CvxifEn && x_issue_valid_o &&
x_issue_resp_i.accept && x_issue_resp_i.register_read[0]) &&
rd_clobber_gpr_i[issue_instr_i[i].rs1] != NONE)) begin
rd_clobber_gpr_i[issue_instr_i[i].rs1] != NONE)) begin
// check if the clobbering instruction is not a CSR instruction, CSR instructions can only
// be fetched through the register file since they can't be forwarded
// if the operand is available, forward it. CSRs don't write to/from FPR
@ -438,10 +435,7 @@ module issue_read_operands
if (((CVA6Cfg.FpPresent && is_rs2_fpr(
issue_instr_i[i].op
)) ? rd_clobber_fpr_i[issue_instr_i[i].rs2] != NONE :
rd_clobber_gpr_i[issue_instr_i[i].rs2] != NONE) ||
((CVA6Cfg.CvxifEn &&
x_issue_valid_o && x_issue_resp_i.accept && x_issue_resp_i.register_read[1]) &&
rd_clobber_gpr_i[issue_instr_i[i].rs2] != NONE)) begin
rd_clobber_gpr_i[issue_instr_i[i].rs2] != NONE)) begin
// if the operand is available, forward it. CSRs don't write to/from FPR
if (rs2_valid_i[i] && (CVA6Cfg.FpPresent && is_rs2_fpr(
issue_instr_i[i].op
@ -455,12 +449,9 @@ module issue_read_operands
end
// Only check clobbered gpr for OFFLOADED instruction
if (((CVA6Cfg.FpPresent && is_imm_fpr(
if ((CVA6Cfg.FpPresent && is_imm_fpr(
issue_instr_i[i].op
)) ? rd_clobber_fpr_i[issue_instr_i[i].result[REG_ADDR_SIZE-1:0]] != NONE : 0) ||
((CVA6Cfg.CvxifEn && OPERANDS_PER_INSTR == 3 &&
x_issue_valid_o && x_issue_resp_i.accept && x_issue_resp_i.register_read[2]) &&
rd_clobber_gpr_i[issue_instr_i[i].result[REG_ADDR_SIZE-1:0]] != NONE)) begin
)) ? rd_clobber_fpr_i[issue_instr_i[i].result[REG_ADDR_SIZE-1:0]] != NONE : 0) begin
// if the operand is available, forward it. CSRs don't write to/from FPR so no need to check
if (rs3_valid_i[i]) begin
forward_rs3[i] = 1'b1;
@ -470,6 +461,24 @@ module issue_read_operands
end
end
end
if (CVA6Cfg.CvxifEn) begin
// Remove unecessary forward and stall in case source register is not needed by coprocessor.
if (x_issue_valid_o && x_issue_resp_i.accept) begin
if (~x_issue_resp_i.register_read[0]) begin
forward_rs1[0] = 1'b0;
stall_rs1[0] = 1'b0;
end
if (~x_issue_resp_i.register_read[1]) begin
forward_rs2[0] = 1'b0;
stall_rs2[0] = 1'b0;
end
if (OPERANDS_PER_INSTR == 3 && ~x_issue_resp_i.register_read[2]) begin
forward_rs3[0] = 1'b0;
stall_rs3[0] = 1'b0;
end
end
stall_raw[0] = stall_rs1[0] || stall_rs2[0] || stall_rs3[0];
end
if (CVA6Cfg.SuperscalarEn) begin
if (!issue_instr_i[1].use_zimm && (!CVA6Cfg.FpPresent || (is_rs1_fpr(

View file

@ -111,6 +111,7 @@ module ariane import ariane_pkg::*; #(
if (CVA6Cfg.CvxifEn) begin : gen_example_coprocessor
cvxif_example_coprocessor #(
.NrRgprPorts (CVA6Cfg.NrRgprPorts),
.XLEN (CVA6Cfg.XLEN),
.readregflags_t (readregflags_t),
.writeregflags_t (writeregflags_t),
.id_t (id_t),
@ -130,6 +131,13 @@ module ariane import ariane_pkg::*; #(
.cvxif_req_i ( cvxif_req ),
.cvxif_resp_o ( cvxif_resp )
);
end else begin
always_comb begin
cvxif_resp = '0;
cvxif_resp.compressed_ready = 1'b1;
cvxif_resp.issue_ready = 1'b1;
cvxif_resp.register_ready = 1'b1;
end
end

View file

@ -4,7 +4,7 @@
# This file has been generated by SpyGlass:
# Report Name : summary
# Report Created by: runner_riscv-public
# Report Created on: Fri Jul 26 00:36:54 2024
# Report Created on: Thu Aug 1 11:05:24 2024
# Working Directory: /gitlab-runner/runner_riscv-public/builds/yD5zmwgi3/0/riscv-ci/cva6/spyglass
# SpyGlass Version : SpyGlass_vS-2021.09-SP2-3
# Policy Name : SpyGlass(SpyGlass_vS-2021.09-SP2-03)
@ -17,9 +17,9 @@
# starc(SpyGlass_vS-2021.09-SP2-03)
# starc2005(SpyGlass_vS-2021.09-SP2-03)
#
# Total Number of Generated Messages : 1521
# Total Number of Generated Messages : 1526
# Number of Waived Messages : 2
# Number of Reported Messages : 1519
# Number of Reported Messages : 1524
# Number of Overlimit Messages : 0
#
#
@ -106,24 +106,24 @@ WARNING STARC05-2.1.3.1 2 Bit-width of function arguments must
WARNING STARC05-2.1.4.5 1 Bit-wise operators must be used instead
of logic operators in multi-bit
operations.
WARNING STARC05-2.1.5.3 1 Conditional expressions should evaluate
WARNING STARC05-2.1.5.3 2 Conditional expressions should evaluate
to a scalar.
WARNING STARC05-2.2.3.3 14 Do not assign over the same signal in
an always construct for sequential
circuits
WARNING W224 1 Multi-bit expression found when one-bit
WARNING W224 2 Multi-bit expression found when one-bit
expression expected
WARNING W240 322 An input has been declared but is not
WARNING W240 319 An input has been declared but is not
read
WARNING W263 4 A case expression width does not match
case select expression width
WARNING W287b 36 Output port of an instance is not
connected
WARNING W415a 537 Signal may be multiply assigned (beside
WARNING W415a 544 Signal may be multiply assigned (beside
initialization) in the same scope.
WARNING W480 3 Loop index is not of type integer
WARNING W486 2 Shift overflow - some bits may be lost
WARNING W528 487 A signal or variable is set but never
WARNING W528 486 A signal or variable is set but never
read
INFO W240 1 An input has been declared but is not
read

View file

@ -11,7 +11,9 @@
Custom Instruction to challenge CV-X-IF protocol
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This section describes some custom instruction, for stress or challenge the CV-X-IF protocol for the 3 implemented interfaces, it's just to interact with the cvxif agent.
All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
Most instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
Except for 4 of them using opcode `MADD, MSUB, NMADD, NMSUB`
- **CUS_NOP**: Custom No Operation
**Format**: cus_nop -> |0000000000000000000000000|111_1011|
@ -20,8 +22,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: cus_nop
**Invalid values**: NONE
- **CUS_ADD**: Custom Add
**Format**: cus_add rd, rs1, rs2 -> |0000000|rs2|rs1|001|rd|111_1011|
@ -30,8 +30,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs1] + x[rs2]
**Invalid values**: NONE
- **CUS_DOUBLE_RS1**: Custom Double RS1
**Format**: cus_add rd, rs1, rs1 -> |0000001|rs2|rs1|001|rd|111_1011|
@ -42,8 +40,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs1] + x[rs1]
**Invalid values**: NONE
- **CUS_DOUBLE_RS2**: Custom Double RS2
**Format**: cus_add rd, rs2, rs2 -> |0000010|rs2|rs1|001|rd|111_1011|
@ -54,8 +50,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs2] + x[rs2]
**Invalid values**: NONE
- **CUS_ADD_MULTI**: Custom Multicycle Add
**Format**: addi rd, rs1, rs2 -> |0000011|rs2|rs1|001|rd|111_1011|
@ -64,8 +58,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs1] + x[rs2]
**Invalid values**: NONE
- **CUS_ADD_RS3_MADD**: Custom Add with RS3 opcode == MADD
**Format**: addi rd, rs1, rs2, rs3 -> |rs3|00|rs2|rs1|000|rd|100_0011|
@ -74,8 +66,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs1] + x[rs2] + x[rs3]
**Invalid values**: NONE
- **CUS_ADD_RS3_MSUB**: Custom Add with RS3 opcode == MSUB
**Format**: addi rd, rs1, rs2, rs3 -> |rs3|00|rs2|rs1|000|rd|100_0111|
@ -84,8 +74,6 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs1] + x[rs2] + x[rs3]
**Invalid values**: NONE
- **CUS_ADD_RS3_NMADD**: Custom Add with RS3 opcode == NMADD
**Format**: addi rd, rs1, rs2, rs3 -> |rs3|00|rs2|rs1|000|rd|100_1111|
@ -94,18 +82,14 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[rd] = x[rs1] + x[rs2] + x[rs3]
**Invalid values**: NONE
- **CUS_ADD_RS3_NMSUB**: Custom Add with RS3 opcode == NMSUB
- **CUS_ADD_RS3_NMADD**: Custom Add with RS3 opcode == NMSUB
**Format**: addi rd, rs1, rs2, rs3 -> |rs3|00|rs2|rs1|000|rd|100_0011|
**Format**: addi rd, rs1, rs2, rs3 -> |rs3|00|rs2|rs1|000|rd|100_1011|
**Description**: add register rs1, rs2 to rs3, and store the result in rd.
**Pseudocode**: x[rd] = x[rs1] + x[rs2] + x[rs3]
**Invalid values**: NONE
- **CUS_ADD_RS3_RTYPE**: Custom Add with RS3, rd is x10 (a0)
**Format**: addi a0, rs1, rs2, rs3 -> |0000100|rs2|rs1|001|rs3|100_0011|
@ -114,18 +98,14 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Pseudocode**: x[10] = x[rs1] + x[rs2] + x[rs3]
**Invalid values**: NONE
- **CUS_CNOP** : Custom Compressed NOP
**Format**: cus_cnop -> |111|0|00000|00000|00|
**Format**: cus_cnop -> |111|0|rs1|rs2|00|
**Description**: Extends to CUS_NOP : do nothing, it's just a hint instruction.
**Pseudocode**: cus_cnop
**Invalid values**: NONE
- **CUS_CADD** : Custom Compressed ADD
**Format**: cus_cnop -> |111|1|rs1|rs2|00|
@ -133,5 +113,3 @@ All instructions use opcode `CUSTOM_3`(0x7b, 0b111_1011).
**Description**: Extends to CUS_ADD rs1, rs2 -> x10 : Add rs1 + rs2 into x10 (a0).
**Pseudocode**: cus_cadd
**Invalid values**: NONE

View file

@ -0,0 +1,52 @@
# Copyright 2024 Thales DIS France SAS
#
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
# You may obtain a copy of the License at https://solderpad.org/licenses/
#
# Original Author: Guillaume Chauvon
# where are the tools
if ! [ -n "$RISCV" ]; then
echo "Error: RISCV variable undefined"
return
fi
# install the required tools
source ./verif/regress/install-verilator.sh
source ./verif/regress/install-spike.sh
# install the required test suites
source ./verif/regress/install-riscv-tests.sh
# setup sim env
source ./verif/sim/setup-env.sh
echo "$SPIKE_INSTALL_DIR$"
if ! [ -n "$DV_SIMULATORS" ]; then
DV_SIMULATORS=vcs-testharness,spike
fi
if ! [ -n "$UVM_VERBOSITY" ]; then
export UVM_VERBOSITY=UVM_NONE
fi
export cvxif=1 # For CVXIF in Spike
export DV_OPTS="$DV_OPTS --issrun_opts=+debug_disable=1+UVM_VERBOSITY=$UVM_VERBOSITY"
cd verif/sim/
make -C ../.. clean
make clean_all
python3 cva6.py --testlist=../tests/testlist_cvxif.yaml --test cvxif_add_nop --iss_yaml cva6.yaml --target cv64a6_imafdc_sv39 --iss=$DV_SIMULATORS $DV_OPTS
make -C ../.. clean
make clean_all
python3 cva6.py --testlist=../tests/testlist_cvxif.yaml --test cvxif_add_nop --iss_yaml cva6.yaml --target cv32a65x --iss=$DV_SIMULATORS $DV_OPTS
make -C ../.. clean
make clean_all
cd -

View file

@ -36,7 +36,6 @@ if ! [ -n "$UVM_VERBOSITY" ]; then
export UVM_VERBOSITY=UVM_NONE
fi
export cvxif=1 # For CVXIF in Spike
export DV_OPTS="$DV_OPTS --issrun_opts=+debug_disable=1+UVM_VERBOSITY=$UVM_VERBOSITY"
CC_OPTS="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -I../tests/custom/env -I../tests/custom/common -lgcc"
@ -62,7 +61,6 @@ make clean_all
python3 cva6.py --testlist=../tests/testlist_riscv-compliance-cv32a60x.yaml --test rv32i-I-ADD-01 --iss_yaml cva6.yaml --target cv32a65x --iss=$DV_SIMULATORS $DV_OPTS
python3 cva6.py --testlist=../tests/testlist_riscv-tests-cv32a60x-p.yaml --test rv32ui-p-add --iss_yaml cva6.yaml --target cv32a65x --iss=$DV_SIMULATORS $DV_OPTS
python3 cva6.py --testlist=../tests/testlist_riscv-arch-test-cv32a60x.yaml --test rv32im-cadd-01 --iss_yaml cva6.yaml --target cv32a65x --iss=$DV_SIMULATORS $DV_OPTS --linker=../tests/riscv-arch-test/riscv-target/spike/link.ld
python3 cva6.py --testlist=../tests/testlist_cvxif.yaml --test cvxif_add_nop --iss_yaml cva6.yaml --target cv32a65x --iss=$DV_SIMULATORS $DV_OPTS
python3 cva6.py --c_tests ../tests/custom/hello_world/hello_world.c --iss_yaml cva6.yaml --target cv32a65x --iss=$DV_SIMULATORS --linker=../tests/custom/common/test.ld --gcc_opts="$CC_OPTS" $DV_OPTS
make -C ../.. clean
make clean_all

View file

@ -114,28 +114,13 @@ module cva6_tb_wrapper import uvmt_cva6_pkg::*; #(
.noc_resp_i ( axi_ariane_resp )
);
if (CVA6Cfg.CvxifEn) begin : gen_example_coprocessor
cvxif_example_coprocessor #(
.NrRgprPorts (CVA6Cfg.NrRgprPorts),
.readregflags_t (readregflags_t),
.writeregflags_t (writeregflags_t),
.id_t (id_t),
.hartid_t (hartid_t),
.x_compressed_req_t (x_compressed_req_t),
.x_compressed_resp_t (x_compressed_resp_t),
.x_issue_req_t (x_issue_req_t),
.x_issue_resp_t (x_issue_resp_t),
.x_register_t (x_register_t),
.x_commit_t (x_commit_t),
.x_result_t (x_result_t),
.cvxif_req_t (cvxif_req_t),
.cvxif_resp_t (cvxif_resp_t)
) i_cvxif_coprocessor (
.clk_i ( clk_i ),
.rst_ni ( rst_ni ),
.cvxif_req_i ( cvxif_req ),
.cvxif_resp_o ( cvxif_resp )
);
if (CVA6Cfg.CvxifEn) begin : gen_cvxif_default_response
always_comb begin
cvxif_resp = '0;
cvxif_resp.compressed_ready = 1'b1;
cvxif_resp.issue_ready = 1'b1;
cvxif_resp.register_ready = 1'b1;
end
end
//----------------------------------------------------------------------------

View file

@ -30,7 +30,7 @@ start0:
CUS_ADD(01011, 01010, 01011);
CUS_ADD(01010, 01011, 01011);
lw a0, num1;
CUS_ADD_RS1(01000,01010,01011);
CUS_ADD_RS1(01100,01010,01011);
lw a1, num2;
CUS_ADD(01010,01011,00000);
@ -48,7 +48,7 @@ branch1:
branch2:
CUS_ADD(01010, 01010, 01011);
lw a0, num1;
CUS_ADD_RS1(01000,01010,01011);
CUS_ADD_RS1(01100,01010,01011);
lw a1, num2;
CUS_ADD(01010,01011,00000);