Skip to content

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

Description

@ZhongYic00

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions