1. The function L is defined as L(1) = 2,L(2) = 1,L(3) = 3,L(4) = 4 and for n ≥ 4,
L(n + 1) = L(n) + L(n − 1) + L(n − 2)
L(n − 3)
i.e., the (n + 1)-th value is given by the sum of the n-th, n − 1-th and n − 2-th values divided by the n − 3-th value.
(a) Write an assembly program for computing the k-th value L(k), where k is an integer bigger than 4 and read from a memory location M , and storing L(k) at memory location M . Use the instruction set in the Instruction Set Architecture described in Appendix A.
(b) Consider a pipelined processor, where the pipeline stages are those described in the appendix. Describe what happens in the pipeline stages for the various types (data movement, data processing, control) of instructions.
(c) Show the execution of your program on the above pipelined processor for k = 6 by drawing a diagram. Assume that the fetched and decoded instructions are stored in an instruction window IW with unlimited capacity (and so you can store any number of instruction in the IW). Explain where and why delay slots appear. Assume that the processor can do out-of-order execution to speed up the completion of the program. Assume that there is only one bus, and that the fetching of instructions uses this bus. So the fetching of an instruction can conflict with a stage where an instruction accesses memory.
We present a list of instructions typical of a RISC (reduced instruction set computer) machine. In data-movement and control instructions, the addresses may be immediate #X, direct (memory) M, indirect (memory) [M], register r, or register indirect [r] addresses. Data-processing instructions use immediate or register addressing. PC is the programme counter and a <- b indicates that the value of b is placed in a.
LOAD a, b a <- b
STOR a, b a <- b
ADD a, b, c a <- b + c
ASH a, b, c a <- (b >>[s] c)
LSH a, b, c a <- (b >>[u] c) BR a PC <- a
SUB | a, | b, | c | a | <- | b | - c | BEQ | a, | b, | c | PC | <- | a | if | b = | c |
MUL | a, | b, | c | a | <- | b | * c | BNE | a, | b, | c | PC | <- | a | if | not | b = c |
DIV | a, | b, | c | a | <- | b | / c | BLT | a, | b, | c | PC | <- | a | if | b < | c |
AND | a, | b, | c | a | <- | b | & c | BGT | a, | b, | c | PC | <- | a | if | b > | c |
OR a, b, c a <- b | c
NOT a, b a <- !b
BLE a, b, c PC <- a if b <= c BGE a, b, c PC <- a if b >= c
Note: Here b >>[s] c denotes the arithmetical shift of b to the right by c positions, and
b >>[u] c denotes the logical shift of b to the right by c positions.
We will use a five-stage pipeline:
• IF (instruction fetch),
• ID (instruction decode),
• RR (register read),
• EX (execute instruction),
• WB (write back result into register).
• Note that for some instructions (e.g., LOAD r, #X) some of the pipeline stages (e.g., RR) are not needed.
The rules for the execution of instructions are as follows:
1. All instructions go through the IF and ID stages
2. For data-movement instructions the data transfer between the CPU and main mem- ory happens in the execute stage. (This means that if a data transfer operation is executing, no data can be transferred across the main-memory bus.)
3. Immediate addressing for input arguments does not require RR or EX (e.g., LOAD r1, #X).
4. Arithmetic and logic instructions need RR, EX and WB.
5. Branching operations require RR, EX and WB, unless all operands are immediate, in which case only EX and WB are required.
6. For the instruction LOAD a, b the argument b must be an immediate address or memory location and a must be a register.
7. For the instruction STOR a, b the argument b must be an immediate address or register and a must be a memory location.
8. For each of the remaining instructions the arguments a, b and c must all be registers or immediate addresses.
You may assume for the sake of the assignment that the ISA supports floating point arithmetic with no loss of precision.
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
The Fibonacci sequence F is defined as F(1) = F(2) = 1 and for n>= 2, F(n + 1) = F(n) + F(n − 1) i.e., the (n + 1)th value is given by the sum of the nth value and the (n − 1)th value. 1. Write an assembly program typical of RISC machines for computing the kth value F(k), where k is a natural number greater than 2 loaded from a memory location M, and storing the result...
the necessary steps in RTL (Register Transfer Languag fetch and execute to the instructions addi (add immediate), bne (branch not equal), and j Üump) on a multicycle MIPS machine. (10 points) Stepl: (IF) Instruction Fetch Step2: (ID) Instruction Decode and Rek. Fetch Step 3 (EX) Exerution Stepi: (MEM) Memory Access itepl: (WB) Whte Back 1. Write the necessary steps in RTL (Register Transfer Language), to fetch and execute (10 points) the instructions addi (add immediate), bne (branch not equal), and...
Consider a standard 5-stage MIPS pipeline of the type discussed during the class sessions: IF- ID-EX-M-WB. Assume that forwarding is not implemented and only the hazard detection and stall logic is implemented so that all data dependencies are handled by having the pipeline stall until the register fetch will result in the correct data being fetched. Furthermore, assume that the memory is written/updated in the first half of the clock cycle (i.e. on the rising edge of the clock) and...
Question 3: ARM Processor a) What is the number of bits in a general-purpose register (e.g., R1) of the ARM Cortex-M4 processor (CPU)? b) What is the number of bits in a memory address for the ARM processor architecture? c) What is the number of bits in an assembly instruction for the ARM Thumb-2 instruction set? d) Consider the memory map used with the TM4C123 microcontroller shown below. If the stack is in data memory, what is the initial address...
A 5-Stage pipeline is composed of the following stages Instruction Fetch (IF), Decode (DE), Execute (EX), Memory Access (ME) and Register Write-back (WB). Assume the pipeline does not have a branch prediction unit, does not have superscalar support and does not support out of order execution. Assume that all memory accesses are in the L1 cache and therefore do not introduce any stalls. Show a pipeline diagram that shows the execution of each stage for the assembly code below. Also...
The functional decomposition flowchart shows a. how variables are used from procedures b. how procedures are called c. the addressing modes used in the code d. all the above 2. The pipeline a. transfers the data from the memory to the CPU b. offers processor-level parallelism C. transfers the data for memory to 1/0 d. offers instruction-level parallelism 2 The three last steps in the instruction execution cycle are a. IF, EX, WB b. EX, OF, WB C. OF, EX,...
T F Xilinx's SDK assembler supports both FOR statements, but not wHILE statements T F In the ARM processor, immediate operands are stored in data memory, and not in the opcode T F In ARM processor instructions, one but not both operands can come from main T F In the ARM processor, a single load/store instruction T F It is possible for a microprocessor to use a virtual TCache memory is typically much faster and much larger than main memory...
4) Consider the following assembly language code: INSTRUCTIONS T01 T02 T03 T04 T05 T06 T07 T08 T09 T10 T11 T12 T13 T14 (as a table) Loop: sll $t1, $s3, 2 add $t1, $t1, $s6 lw $t0, 0($t1) beq $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit: Use a pipeline with forwarding, hazard detection, and 1 delay slot for branches. The pipeline is the typical 5-stage IF, ID, EX, MEM, WB MIPS design. For the above code, complete the...
Assume the program counter (PC) is initially equal to n. Assume that the word length of the processor is 1. a) How many fetches are required to make PC equal to m if there are no branch instructions between n and m? b) What is the content of the instruction register (IR) when the PC’s value is n+k? Justify your answer. Why we are not using a hundred pipeline stages if anoperation can be divided up into a hundred steps,...
Questions 6-10: Prior to execution of the instruction MOV CX,[1234H) - following are the information given on the state of the processor CS = 0100H; DS=0200H; IP = 0000H; CX = 8B3AH Machine code for the above instruction=8B0E3412H; Answer the following questions 6-10 given below related to this instruction - 6. What is the content of the destination-operand prior to the instructions execution? a. 1234H b. 43211 c. 8B3AH d. 3A8BH e. Unknown 7. What is the content of the...