Given the following sequence of assembly language instructions: I1: lw $3, 100($
ID: 3838605 • Letter: G
Question
Given the following sequence of assembly language instructions:
I1: lw $3, 100($5)
I2: add $6, $3, $2
I3: sub $9, $3, $8
I4: lw $1, 2000($9)
I5: add $5, $4, $3
I6: addi $7, $1, #8
(a) Assume there is a data forwarding circuit in this pipelined processor and data is written in the first half-cycle and read in the second half-cycle, insert nop instructions to eliminate the data hazard in the above program. Show a pipeline execution diagram for the program, where all data forwards are marked with arrows. Moreover, on the data path circuit, identify the data value, inputs and outputs of the data forwarding unit in cycles when data is forwarded.
(b) Assume there is a data forwarding circuit and hazard detection unit in this pipelined processor and data is written in the first half-cycle and read in the second half-cycle. Show a pipeline execution diagram for the program, where all stalls are marked with “**” and identify the inputs and outputs of the data hazard detection unit in cycles when stalls are inserted.
Explanation / Answer
For the CDA 5155 programming assignments, you will utilize the LC2
(Little Computer 2014). The LC2 is exceptionally basic, yet it is general
enough to take care of complex issues. For this venture, you will just need to know
the direction set and guideline configuration of the LC2.
The LC2 is a 8-enroll, 32-bit PC. All locations are
word-addresses. The LC2 has 65536 expressions of memory. By low level computing construct
tradition, enroll 0 will dependably contain the esteem 0.
There are 4 direction positions (bit 0 is the slightest critical piece). Bits
31-25 are unused for all guidelines, and ought to dependably be 0.
R-sort guidelines (include, nand, mult):
bits 24-22: opcode
bits 21-19: reg A
bits 18-16: reg B
bits 15-3: unused (ought to all be 0)
bits 2-0: destReg
I-write directions (lw, sw, beq):
bits 24-22: opcode
bits 21-19: reg A
bits 18-16: reg B
bits 15-0: offsetField (a 16-bit, 2's supplement number with a scope of
- 32768 to 32767)
O-sort directions (end, noop):
bits 24-22: opcode
bits 21-0: unused (ought to all be 0)
- - - - -
Table 1: Description of Machine Instructions
- - - - -
Low level computing construct Opcode in binary Action
name for instruction (bits 24, 23, 22)
- - - - -
include (R-sort format) 000 add substance of regA with
substance of regB, store
brings about destReg.
nand (R-sort format) 001 nand substance of regA with
substance of regB, store
brings about destReg.
lw (I-write format) 010 load regB from memory. Memory
address is framed by including
offsetField with the substance of
regA.
sw (I-write format) 011 store regB into memory. Memory
address is framed by including
offsetField with the substance of
regA.
beq (I-write format) 100 if the substance of regA and
regB are the same, then branch
to the address PC+1+offsetField,
where PC is the address of the
beq direction.
mult (R-sort format) 101 multiplies substance of regA with
substance of regB, store
brings about destReg.
end (O-sort format) 110 increment the PC (as with all
guidelines), then end the
machine (let the test system
see that the machine
ended).
noop (O-sort format) 111 do nothing.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.