3.6.3.1. Instruction Cache Tag RAM
1. Ensure all code up to the JMP instruction is in the same instruction cache line or is
located in an ITCM.
2. Use a
FLUSHI
instruction to flush an instruction cache line other than the line
containing the executing code.
3. Use a
FLUSHP
instruction to flush the pipeline.
4. Use a
WRCTL
instruction to set
ECCINJ.ICTAG
to
INJS
or
INJD
. This setting
causes an ECC error to occur on the start of the next line fill.
5. Use a
JMP
instruction to jump to an instruction address in the flushed line.
6. The ECC error is injected when writing the tag RAM at the start of the line fill.
7. Use a
RDCTL
instruction to ensure that the value of
ECCINJ.ICTAG
is
NOINJ
.
8. The ECC error triggers after the target of the
JMP
instruction.
3.6.3.2. Instruction Cache Data RAM
1. Ensure all code up to the JMP instruction is in the same instruction cache line or is
located in an ITCM.
2. Use a
FLUSHI
instruction to flush an instruction cache line other than the line
containing the executing code.
3. Use a
FLUSHP
instruction to flush the pipeline.
4. Use a
WRCTL
instruction to set
ECCINJ.ICDAT
to
INJS
or
INJD
. This setting
causes an ECC error to occur on the start of the next line fill.
5. Use a
JMP
instruction to jump to an instruction address in the flushed line.
6. The ECC error is injected when writing the tag RAM at the start of the line fill.
7. Use a
RDCTL
instruction to ensure that the value of
ECCINJ.ICDAT
is
NOINJ
.
8. Execute the target of the
JMP
instruction twice (first to inject the ECC error and
second to be triggered by it).
3.6.3.3. ITCMs
Software running on the Nios II cannot directly inject an ECC error in an
ITCM
because the Nios II only writes
ITCM
s when correcting ECC errors. To inject an ECC in
an
ITCM
, the TCM RAM must also be connected to a
DTCM
master. The Nios II
provided
DTCM
error injection mechanism (i.e.
ECCINJ
register) is used to inject an
error in the TCM RAM as follows:
1. Use a
WRCTL
instruction to set
ECCINJ
so that it will inject ECC errors in the
DTCM
connected to the
ITCM
.
2. Use a
STW
instruction to write the
DTCM
.
3. Use a
RDCTL
instruction to ensure the value of the
ECCINJ
field written by the
WRCTL
is
NOINJ
.
4. Use a
JMP
instruction to jump to an instruction address in the ITCM.
5. The ECC error should be triggered on the target of the
JMP
instruction.
3. Programming Model
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
71