2.1.3.4.2 Verilog Task-Based Flag Assertion

The LSRAM simulation model feature allows you to control the ECC error flags through your environment by using Verilog tasks. While using this feature, ensure that you have not activated the probability based ECC error flag simulation as described in Probability-Based ECC Flag Assertion.

The Verilog task-based simulation can be performed on any of your projects without regenerating any of the cores. To use this feature, you must enter the address for which you want an ECC flag along with data mask bits, which decide to assert either SB_CORRECT or DB_DETECT flags in the user_ecc_wrapper.v, and include the generated_ecc_wrapper.v file in the active test bench.

To enable or disable the ECC error flags feature in the simulation model, execute the ecc_err_inject_inst.enable_ecc_err_inject(1’b<user-input>) task with the values described in the following table:

Table 2-12. Enable/Disable ECC Error Flag–User-Input Values
User-InputResult
1The ECC error flag feature is enabled.
0The ECC error flag feature is disabled (default).
Note: If this feature is disabled, the simulation model does not respond to other related tasks.

To control the ECC error flags for a single address, execute the inject_single_addr_ecc_errors(<address>,<data_mask>) task with the values described in the following table:

Table 2-13. Controlling ECC Error Flag–User-Input Values
ArgumentDescription
addressThe user address to which the simulation model must drive the ECC error flags.
data_maskThe data mask bits that decide single or dual bit ECC flag.

During read operation, when the read address is equal to the <address> specified in this task, the following conditional results are achieved:

Table 2-14. Controlling ECC Error Flag–Results
Result...if...
The SB_CORRECT error flag is asserted to 1 and read data remains unchanged.The specified <data_mask> has only one non-zero bit.
The DB_DETECT and SB_CORRECT error flags are asserted to 1 and the read data bit is negated where <data_mask> bit is 1.
Note: For some configurations, even though you provide the Data Mask bits > 1, it may still turn into SB flag only and not DB flag, as each of those Data mask bits belong to different physical instance block.
The specified <data_mask> has more than one non-zero bit.