Question: Exercise # 1 :Exercise # 1 : The Fetch - Decode - Execute Cycle The purpose of this exerci The Fetch - Decode -
Exercise #:Exercise #: The FetchDecodeExecute Cycle
The purpose of this exerci The FetchDecodeExecute Cycle
The purpose of this exercise is to test the understanding of the FetchDecodeExecute cycle.
Consider a fictitious and very simplified VonNeumann architecture with:
bit addressesbit values memory
bit registers for computation named A and B;
bit Program Counter register;
bit Current Instruction register;
bit error register set at the end of the cycle when the execution of an instruction creates an error condition.
instructions: LOAD, STORE, SUBTRACT, JE Jump on Error and STOP detailed in the table below
Each instruction is encoded using bits:
the first bits give the mnemonics or operation code identifying the instruction see table below;
the next bit gives the id of the register that the instruction operates on: identifying A identifying B; and
the last bits are an operand which can be anything eg an integer number, an address, or even ignored depending on the instruction.
CPU Instruction Opcode Description
LOAD Load register value with value from address operand
Example: is executed as LOAD, B with the value at address ie LOAD B
For instance, if the memory content at address is then, at the end of the fetchdecodeexecute cycle, the register B will contain the value
The value of the error register is not used. It is set to when this instruction has completed its execution.
STORE Store register value to address operand
Example: is executed as STORE, A with the value at address ie STORE A
For instance, if the content of the register A is d then, at the end of the fetchdecodeexecute cycle, the memory location at address will contain the value
The value of the error register is not used. It is set to when this instruction has completed its execution.
SUB Subtract register B contents from register A contents. The result is written in A The error register is set if an underflow happens.
: SUB A B Note that bits are ignored
If initially A contains the value and B then, at the end of the fetchdecodeexecute cycle, A will contain ie b The error register is set to no error
If initially A contains the value and B then, at the end of the fetchdecodeexecute cycle, A will contain while it should be and the error register will be set to signaling the underflow error
The value of the error register is not used for the execution of this instruction.
JE If the error register value is set to set the Program Counter PC value to operand Otherwise, nothing happens ie increment the PC by In any case the error register value is set to at the end of the fetchdecodeexecute cycle
For instance: translates to JE
Case : If initially the error register is and the PC value is then at the end of the fetchdecodeexecute cycle, the PC value will be set to
Case : If initially the error register is and the PC value is then at the end of the fetchdecodeexecute cycle, the PC value will be set to
The value of the error register is used for the execution of this instruction.
STOP Terminates program
For instance: translates to STOP. Note that all bits after the first three ones in this example are ignored.
The value of the error register is not used for the execution of this instruction.
Part : Warmup
Question points
What does the instruction encoded by do Show your work.
Question points
Translate LOAD A to binary. Show your work.
Question point
Among the instruction encodings below, which one is invalid? Give an explanation.
Part : Case study
Assume that initially:
The Program Counter value is set to db; The values of the other registers are undefined.
The memory has the following contents:
Address Contents Address Contents Address Contents Address Contents
Question points
What is the address and the first instruction executed by the program? Explain.
Question points
Detail the program execution instruction by instruction the program stops after executing the first STOP
Detail what each stage of the FetchDecodeExecute cycl
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
