Rephrase instruction fetch-decode-execute description.

This commit is contained in:
John Winans 2019-09-01 20:04:11 -05:00
parent 172cb76c1c
commit 901e5c1752

View File

@ -257,18 +257,22 @@ placed into the \reg{pc} register.
\index{instruction fetch} \index{instruction fetch}
In order to {\em fetch} an instruction from the main memory the CPU In order to {\em fetch} an instruction from the main memory the CPU
must have a method to identify which instruction should be fetched and will update the address in the \reg{pc} register and then request that
a method to fetch it. the main memory return the value of the data stored at that address.
\footnote{RV32I instructions are more than one byte in size, but
this general description is suitable for now.}
%must have a method to identify which instruction should be fetched and
%a method to fetch it.
%Given that the main memory is broken up and that each of its bytes is %Given that the main memory is broken up and that each of its bytes is
%assigned an address, the \reg{pc} is used to hold the address of the %assigned an address, the \reg{pc} is used to hold the address of the
%location where the next instruction to execute is located. %location where the next instruction to execute is located.
Given an instruction address, the CPU can request that the main memory %Given an instruction address, the CPU can request that the main memory
locate and return the value of the data stored there using what is called %locate and return the value of the data stored there using what is called
a {\em memory read} operation and then the CPU can treat that {\em fetched} %a {\em memory read} operation and then the CPU can treat that {\em fetched}
value as an instruction and execute it.\footnote{RV32I instructions are %value as an instruction and execute it.
more than one byte in size, but this general description is suitable for now.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -276,10 +280,9 @@ more than one byte in size, but this general description is suitable for now.}
\index{instruction decode} \index{instruction decode}
Once an instruction has been fetched, it must be inspected to determine what Once an instruction has been fetched, it must be inspected to determine what
operation(s) are to be performed. This primairly boils down to inspecting operation(s) are to be performed. This means inspecting the portions of the
the portions of the instruction that dictate which registers are involved instruction that dictate which registers are involved and what that, if
and, if the ALU is required, what it should do. anything, ALU should do.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Instruction Execute} \subsection{Instruction Execute}
@ -309,13 +312,18 @@ The RISC-V ISA uses the word {\em jump} to refer to an {\em unconditional}
change in the sequential processing of instructions and the word change in the sequential processing of instructions and the word
{\em branch} to refer to a {\em conditional} change. {\em branch} to refer to a {\em conditional} change.
For example, a (conditional) branch instruction might instruct the CPU Conditional branch instructions can be used to tell the CPU to
to proceed to the instruction at the next main memory address if the value do things like:
in x8 is currently less than the value in x24 {\em but otherwise}
proceed to an instruction at a different address \begin{quote}
when it is not. This type of instruction can therefore result in having If the value in x8 is currently less than the value in x24 then
one of two different actions pending the resulting {\em condition} of proceed to the instruction at the next main memory address, otherwise
the comparison.\footnote{This is the fundamental method used by a CPU branch to an instruction at a different address.
\end{quote}
This type of instruction can therefore result in one of two different
actions pending the result of the
comparison.\footnote{This is the fundamental method used by a CPU
to make decisions.} to make decisions.}
Once the instruction execution phase has completed, the next instruction Once the instruction execution phase has completed, the next instruction