Question
In a previous homework, you had to fake a time delay, and you will implement this delay in this homework. There are two common methods
In a previous homework, you had to fake a time delay, and you will implement this delay in this homework. There are two common methods for implementing delays: 1. Use external hardware that acts as a timer, typically interfaced to using interrupts which we will cover later. 2. Write a delay loop. For this homework, you will use the latter approach. Consider the following MIPS fragment: addi $t1 , $zero ,N add $t1 , $t1 , $t1 beq $t1 , $zero ,End lw $s1 ,0($s2) sub $s1 , $s1 , $t1 add $s1 , $s1 , $s1 sw $s1,0($t2) addi $t1,$t1,1 # N is some positive immediate L2: j L2 End : lw $s1,0($s1) lw $s1,0($s1) lw $s1,0($s1) You are running this on a 4GHz CPU, which requires 1 CPI for R-type arithmetic instructions, 2 CPI for immediate arithmetic instructions, 3 CPI for jumps, 4 CPI for memory instructions, and 5 CPI for branches. 1. Determine an appropriate value of N for this fragment to run in as close to 50 s. as possible. 2. What is the largest delay possible using this code fragment (on our 32-bit MIPS)? For purposes of this problem, please assume that MIPS does not allow arithmetic overflows (even though this assumption isnt quite correct). Make sure to show your work and draw a box around your final answers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started