mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-07 06:33:24 +00:00
cxxrtl: use CXXRTL_ASSERT for RTL contract violations instead of assert.
RTL contract violations and C++ contract violations are different: the former depend on the netlist and will never violate memory safety whereas the latter may. When loading a CXXRTL simulation into another process, RTL contract violations should generally not crash it, while C++ contract violations should.
This commit is contained in:
parent
7b0cfd5c36
commit
aa0a15a42c
2 changed files with 16 additions and 2 deletions
|
@ -1154,7 +1154,7 @@ struct CxxrtlWorker {
|
|||
// larger program) will never crash the code that calls into it.
|
||||
//
|
||||
// If assertions are disabled, out of bounds reads are defined to return zero.
|
||||
f << indent << "assert(" << valid_index_temp << ".valid && \"out of bounds read\");\n";
|
||||
f << indent << "CXXRTL_ASSERT(" << valid_index_temp << ".valid && \"out of bounds read\");\n";
|
||||
f << indent << "if(" << valid_index_temp << ".valid) {\n";
|
||||
inc_indent();
|
||||
if (writable_memories[memory]) {
|
||||
|
@ -1211,7 +1211,7 @@ struct CxxrtlWorker {
|
|||
// See above for rationale of having both the assert and the condition.
|
||||
//
|
||||
// If assertions are disabled, out of bounds writes are defined to do nothing.
|
||||
f << indent << "assert(" << valid_index_temp << ".valid && \"out of bounds write\");\n";
|
||||
f << indent << "CXXRTL_ASSERT(" << valid_index_temp << ".valid && \"out of bounds write\");\n";
|
||||
f << indent << "if (" << valid_index_temp << ".valid) {\n";
|
||||
inc_indent();
|
||||
f << indent << mangle(memory) << ".update(" << valid_index_temp << ".index, ";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue