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

[rv_dm] Return a TL-UL error on writes to ROM region #15166

Closed
wants to merge 1 commit into from

Conversation

msfschaffner
Copy link
Contributor

This fixes multiple TL-UL errors that we are currently seeing at the chip-level: #14200, #14653 and #14921. I am currently running the seeds mentioned on these issues to double check whether they can be closed.

Signed-off-by: Michael Schaffner [email protected]

@msfschaffner
Copy link
Contributor Author

msfschaffner commented Sep 28, 2022

Looks like I got ahead of myself with this one.

This cannot be fixed in this way, because the RV_DM debug memory has both RO and RW regions. These regions are implemented inside the vendored-in RV_DM code, and hence this is not accurately captured in rv_dm.hjson.

@sriyerg has added support for the custom CSR node manually in the block-level DV environment by adding rv_dm_debug_mem.hjson. The debug memory RAL is included in the top-level simulation as well, but probably the exceptions for read-only and unmapped memory regions are missing (the RV_DM does currently not error back if these regions are accessed). These exceptions are defined in the env config in the block-level testbench, and probably need to be added to the chip-level environment as well:

protected virtual function void post_build_ral_settings(dv_base_reg_block ral);
// The backdoor HDL paths are set incorrectly on the debug mem RAL structures by the reggen
// tool. We just remove all HDL paths and skip backdoor writes entirely.
// TODO: Enable backdoor writes later.
if (ral.get_name() == rom_ral_name) begin
rv_dm_debug_mem_reg_block debug_mem_ral;
uvm_reg regs[$];
ral.get_registers(regs);
foreach (regs[i]) begin
regs[i].clear_hdl_path("ALL");
end
// ROM within the debug mem is RO - it ignores writes instead of throwing an error response.
`downcast(debug_mem_ral, ral)
debug_mem_ral.rom.set_write_to_ro_mem_ok(1);
debug_mem_ral.rom.set_mem_partial_write_support(1);
// TODO(#10837): Accesses to unmapped regions of debug mem RAL space does not return an error
// response. Fix this if design is updated.
debug_mem_ral.set_unmapped_access_ok(1);
// Debug mem does not error on any type of sub-word writes.
debug_mem_ral.set_supports_sub_word_csr_writes(1);
end
endfunction

I will open another PR once this is working.

@msfschaffner
Copy link
Contributor Author

msfschaffner commented Sep 28, 2022

Update: it looks like the exceptions are fully defined for the rv_dm_debug_mem RAL model in the chip-level environment:

// ROM within the debug mem is RO - it ignores writes instead of throwing an error response.
`downcast(debug_mem_ral, ral)
debug_mem_ral.rom.set_write_to_ro_mem_ok(1);
debug_mem_ral.rom.set_mem_partial_write_support(1);
// TODO(#10837): Accesses to unmapped regions of debug mem RAL space does not return an error
// response. Fix this if design is updated.
debug_mem_ral.set_unmapped_access_ok(1);
// Debug mem does not error on any type of sub-word writes.
debug_mem_ral.set_supports_sub_word_csr_writes(1);

That probably means that we need to add an exclusion tag to the ROM window stub which overlaps with the rv_dm_debug_mem RAL model, since the blanket ro swaccess attribute is not correct:

rom: [
// ROM size (given as `items` below) must be a power of two.
{ window: {
name: "ROM"
items: "1024" // 4 KiB
swaccess: "ro",
desc: '''Access window into the debug ROM.'''
}
}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants