You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains a **UVM testbench**for verifying the **CVFPU (Core-V Floating Point Unit)**. DUT is the CVA6 wrapper of the floatingpoint unit.
4
+
This repository contains a UVM Verification Environment for the [CVFPU](https://github.com/openhwgroup/cvfpu.git). DUT is the CVA6 wrapper of the floating-point unit.
-**fpu_common/** Contains package used accross UVM testbench
15
-
-**ref_model_csim/** Contains C++ reference model as well as SV wrapper
16
+
-**modules/** Contains dependencies of the project: [cva6](https://github.com/openhwgroup/cva6.git) and [core-v-verif](https://github.com/openhwgroup/core-v-verif.git) repositories. Both are included as git submodules.
17
+
-**ref_model_csim/** Contains C++ reference model as well as SystemVerilog wrapper
16
18
-**simu/** Contains regression test list and yaml files needed to run simulation and regression scripts. It also holds log files
17
19
-**tests/** Contains UVM test classes
18
-
-**top/** Contains top-level testbench file.
20
+
-**top/** Contains top-level testbench file
21
+
-**scripts/** Contains `scan_logs.pl` perl script for parsing log files, reporting errors and warnings, and generating summary reports.
19
22
20
23
## 4. Getting started
21
-
### 4.1. Compile C++ Reference Model
22
-
The first step is to build the shared library `refmodel_csim_lib.so` that will be used in the UVM testbench via DPI.
24
+
### 4.1 Environment Setup
25
+
Before building or running the project, you must configure your environment variables. The testbench requires QuestaSim simulator, so ensure the `QUESTA_PATH` variable is set to your Questa installation directory.
-**MPFR** (Multiple Precision Floating-Point Reliable Library): Section [*2.1 How to Install*](https://www.mpfr.org/mpfr-current/mpfr.html) details the steps to follow to install the library, use preferably version **4.2.2**.
29
53
30
-
Then, set GMP/MPFR directory path variables in the environment
54
+
Set GMP/MPFR directory path variables in the environment.
55
+
56
+
**tcsh**
57
+
```
58
+
setenv GMP_DIR <gmp_dir_absolute_path>
59
+
setenv MPFR_DIR <mpfr_dir_absolute_path>
60
+
```
61
+
**bash**
31
62
```
32
-
setenv GMP_DIR <gmp_dir_path>
33
-
setenv MPFR_DIR <mpfr_dir_path>
63
+
export GMP_DIR=<gmp_dir_absolute_path>
64
+
export MPFR_DIR=<mpfr_dir_absolute_path>
34
65
```
66
+
It is important to note that the reference model includes `dpiheader.h` file that is tool specific to QuestaSim.
35
67
36
68
#### Compilation
37
69
```
@@ -40,43 +72,141 @@ make
40
72
```
41
73
42
74
### 4.2. Build and run simulation
43
-
#### Setup
44
-
45
-
At the root of the project, set the following environment variables.
The number of transactions is set by the variable `+NB_TXNS` (passed as simulation option) in the `sim_questa.yaml`script. It is currently fixed to 10 000.
82
+
The number of transactions is set by the variable `+NB_TXNS` (passed as simulation option) in the `sim_questa.yaml`file. It is currently fixed to 10 000.
Regression logs can be found in the `regression` folder. To parse through them, run the following script which will return result of the tests with either PASS or FAIL.
107
+
Regression logs can be found in the `regression/` folder. To parse through them, run the following script which will return result of the tests with either PASS or FAIL.
> Some regression failures may currently be expected because of known bugs in the DUT. These are being tracked, check [CVFPU Issues](https://github.com/openhwgroup/cvfpu/issues) section to confirm whether it is a known bug or a new issue that should be reported.
114
+
115
+
### 4.2. Known Limitations
116
+
* The current verification environment targets the CVA6 core exclusively.
117
+
*`RMM`, `ROD`, and `DYN` rounding modes have not been fully verified.
118
+
* Vector floating-point operations are not supported by the current testbench.
119
+
* Only `FP32` and `FP64` formats are thoroughly tested. Other formats are verified only within `F2F` (float-to-float) conversion operations.
120
+
* For `F2I` (float-to-integer) and `I2F` (integer-to-float) operations, only `INT32` and `INT64` integer formats are tested.
121
+
122
+
### 4.3 Adding a new test
123
+
For users who are not familiar with UVM, here are some simple steps to follow to create a new test to verify a new feature.
124
+
125
+
---
126
+
#### Step 1: Create a New Sequence
127
+
A **sequence** generates the transactions (stimulus) that will be driven to the DUT.
128
+
129
+
Example: create a new sequence class in `fpu_sequences.svh` file:
// Randomize or constrain the transaction to target your feature
149
+
if (!item.randomize() with {
150
+
m_operation == FDIV; // force divide operation
151
+
m_fmt == FP32; // force single-precision format
152
+
m_operand_a == opA;
153
+
m_operand_b == opB;
154
+
m_imm == imm;
155
+
m_rm == 0; // force round to nearest, ties to even
156
+
}) begin
157
+
`uvm_fatal("SEQ", "Randomization failed");
158
+
end
159
+
160
+
start_item(item);
161
+
finish_item(item);
162
+
end
163
+
endtask
164
+
endclass
165
+
```
166
+
You can change constraints to target the feature you want to verify. Sequence item fields to randomize are defined in `fpu_txn.svh` file.
167
+
168
+
---
169
+
#### Step 2: Create a New Test Class
170
+
171
+
The test class instantiates and starts your new sequence.
172
+
Create a new file under `tests/` called `my_feature_test.svh`:
173
+
174
+
```systemverilog
175
+
class my_feature_test extends base_test;
176
+
177
+
`uvm_component_utils(my_feature_test)
178
+
179
+
my_feature_seq m_seq;
180
+
181
+
function new(string name, uvm_component parent);
182
+
super.new(name, parent);
183
+
endfunction
184
+
185
+
virtual task pre_main_phase(uvm_phase phase);
186
+
m_seq = my_feature_seq::type_id::create("seq");
187
+
if(!$cast(base_sequence, m_seq))
188
+
`uvm_fatal("CAST FAILED", "Cannot cast base sequence");
189
+
190
+
super.pre_main_phase(phase);
191
+
endtask
192
+
endclass
193
+
```
194
+
---
195
+
#### Step3: Register the Test
196
+
Add the new test to the `fpu_test_pkg.sv` file.
197
+
```systemverilog
198
+
`include "my_feature_test.svh"
199
+
```
200
+
---
201
+
#### Step 4: Run the Test
202
+
From the `simu/` directory, compile and run the simulation by following directions detailed in section [4.2](#42-known-limitations).
203
+
204
+
---
205
+
206
+
#### Step 5: Check Results
207
+
Review the log file `my_feature_test_1.log` located in the `output/` directory for `UVM_ERROR` messages. You can run the `scan_logs` script to help parse through the file for errors and warnings.
208
+
209
+
Open the waveform file if needed to inspect DUT behavior.
0 commit comments