Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dv] tb_cs_registers golden-model error in ePMP extension #2242

Open
ZhongYic00 opened this issue Jan 7, 2025 · 0 comments
Open

[dv] tb_cs_registers golden-model error in ePMP extension #2242

ZhongYic00 opened this issue Jan 7, 2025 · 0 comments
Labels

Comments

@ZhongYic00
Copy link

ZhongYic00 commented Jan 7, 2025

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.
Image

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.

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:

8f4c75c

@ZhongYic00 ZhongYic00 added the Type:Bug Bugs label Jan 7, 2025
@ZhongYic00 ZhongYic00 changed the title [dv] CS_registers golden-model error in ePMP extension [dv] tb_cs_registers golden-model error in ePMP extension Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant