Register Hazards - Fujitsu FR Family Instruction Manual

32-bit microcontroller
Hide thumbs Also See for FR Family:
Table of Contents

Advertisement

CHAPTER 5 PRECAUTIONARY INFORMATION FOR THE FR FAMILY CPU
5.3

Register Hazards

The FR family CPU executes program steps in the order in which they are written, and is
therefore equipped with a function that detects the occurrence of register hazards and
stops pipeline processing when necessary. This enables programs to be written without
attention to the order in which registers are used
■ Overview of Register Hazards
The CPU in pipeline operation may simultaneously process one instruction that involves writing values to a
register, and a subsequent instruction that attempts to refer to the same register before the write process is
completed. This is called a register hazard.
In the example in Figure 5.3-1, the program will read the address value at "R1" before the desired value has
been written to "R1" by the previous instruction. As a result, the old value at "R1" will be read instead of
the new value.
ADD R0, R1
SUB R1, R2
■ Register Bypassing
Even when a register hazard does occur, it is possible to process instructions without operating delays if the
data intended for the register to be accessed can be extricated from the preceding instruction. This type of
data transfer processing is called register bypassing, and the FR family CPU is equipped with a register
bypass function.
In the example in Figure 5.3-2, instead of reading the "R1" in the "ID" stage of the "SUB" instruction, the
program uses the results of the calculation from the "EX" stage of the "ADD" instruction (before the results
are written to the register) and thus executes the instruction without delay.
ADD R0, R1
SUB R1, R2
56
Figure 5.3-1 Example of a Register Hazard
IF
ID
EX
MA
IF
ID
EX
Figure 5.3-2 Example of a Register Bypass
IF
ID
EX
MA
IF
ID
EX
WB
MA
WB
WB
: Data calculation cycle to R1
MA
WB
: Read cycle from R1
: Write cycle to R1
: Read cycle from R1

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fr series

Table of Contents