The first stage (FetchDecode/FD) of the pipe operates directly on the instruction memory read data input. This stage consists of the following:
- Instructions are decoded to determine
- size of the instruction (32 bit/16 bit)
- source operand, destination operand (in architectural and control register file)
- if it is a blocking multi-execute cycle instruction
- Source operands are read from architectural register file
In the second stage (Execute/EXE) of the pipe:
- All arithmetic/data processing instructions are executed.
- For a single execute cycle instruction, the results are available at the end of this stage and are written back to architectural register file and control register file (if required).
- Instructions requiring data memory access (load, store, call, return etc) compute the access address in this cycle and place the memory access request on data memory bus (along with all other qualifiers). For write accesses, write data is also provided in this stage.
In the last stage (MemoryWriteback/WB) of the pipe:
- All instructions having data memory access request issued in EXE stage waits for the read data (for read accesses) or write completion notification (for write accesses) via the data memory ‘ready’ signal.
- If memory subsystem asserts the ready signal, the read data is updated to architectural register file
Note: The Writeback stage is really outside the processor core and is used for load/store instructions only. All other instructions complete at EXE stage updating the result. Hence, in some sense the pipe depth of the ARP32 processor is really 2 (Fetch-Decode, Execute).
Consider the following example code sequence in Example8-1. Figure 8-29 shows how the instructions flows through the pipe, highlighting the fact that only load/store instructions use the WB stage (others complete/retire at EXE).