[dv] tb_cs_registers golden-model error in ePMP extension
Nobody has claimed this yet.
- Dominant language
- SystemVerilog
- Stars
- 2.1k
- Forks
- 810
- Avg merge
- 5d 23h
- Merged PRs (30d)
- 9
Description
## Observed Behavior
DV test `lowrisc:ibex:tb_cs_registers` fails given `+ntb_random_seed=111`
```
Error, transaction:
Register transaction:
Operation: CSR Read
Address: PMPCfg0
Read data: 6981400
Expected rdata: 6981484
- ../src/lowrisc_ibex_tb_cs_registers_0/tb/tb_cs_registers.sv:111: Verilog $finish
Received $finish() from Verilog, shutting down simulation.
[Reg driver] drove: 4970 register transactions
//-------------//
// TEST FAILED //
//-------------//
```
## Expected Behavior
CS_Registers test should pass, RTL's dealing with mseccfg and pmpcfg is right.
At that point, mseccfg.MML is set, write a **new entry with exec privilege** to pmpcfg results in no change.

The provided golden-model in `base_register.cc` is wrong when handling CSRWrite to `pmpcfg`.
~~It should first check mseccfg.MML then write, rather than dealing with `// No reserved L/R/W/X values when MML Set`.~~
It should check whether the new entry is a "new rule with executable privilege".
This may be due to SMEPMP extension's evolving.
```c++
uint32_t PmpCfgRegister::RegisterWrite(uint32_t newval) {
uint32_t lock_mask = GetLockMask();
uint32_t read_value = register_value_;
register_value_ &= lock_mask;
register_value_ |= (newval & ~lock_mask);
register_value_ = HandleReservedVals(register_value_);
return read_value;
}
```
## Steps to reproduce the issue
```
fusesoc --cores-root=. run --target=sim --tool=verilator lowrisc:ibex:tb_cs_registers --run_options='+
ibex_tracer_enable=1 +ntb_random_seed=0'
```
## My Environment
**EDA tool and version:**
Verilator 4.210 2021-07-07 rev v4.210
**Operating system:**
Ubuntu Linux 22.04
**Version of the Ibex source code:**
8f4c75c5e43e61b994248307c814e01860303056
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the provided FuseSoC Verilator command and seed, then inspect PmpCfgRegister::RegisterWrite in base_register.cc alongside the failure at tb_cs_registers.sv:111. Compare the golden model's pmpcfg handling with the described mseccfg.MML and executable-privilege behavior. Done means the tb_cs_registers test passes for the reproducing seed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100