Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

ECE 371 Exam 2024 term, Exams of Electrical and Electronics Engineering

Midterm of Doug's midterm exam 2023 for fall term.

Typology: Exams

2022/2023

Uploaded on 02/14/2024

hiep-thieu
hiep-thieu 🇺🇸

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 371 MIDTERM EXAM (A) FALL 2022 NAME____KEY__________________ 1
1. The 8-bit two’s complement Sign and Magnitude representation for the decimal
number –25 is ______________ (show work)
00011001 = 25
11100110
+1
11100111 = -25
2. The diagram below shows a section of a pipelined machine that essentially
functions as a shift register. The registers each have a propagation delay of 5 ns, a
setup time of 2 ns and a hold time of 1 ns. Logic block A has a propagation delay of 2
ns and logic block B has a propagation delay of 3 ns. Calculate the minimum clock
period and the maximum frequency at which this circuit can be clocked with no slack
time. (Think about which stage is the worst case (limiting factor.) (Show all work.)
Tclk-min = TFFpd + TBlock b + Tsu
Tclk-min = 5 ns + 3 ns + 2 ns = 10 ns
FMAX = 1/10 ns = 100 MHz
3. Briefly explain how a Branch Target buffer and two-bit branch prediction reduces
pipeline stalls during execution of a program loop such as the one in Figure 2-9 that
executes many times.
The first time execution reaches the branch at the end of the loop there will be
stalls, because the Branch target address is not known until the EX stage and by
then the processor has fetched two instructions that will be flushed. However, the
Branch target address is put in the Branch Target buffer for future use and the
prediction bits are moved toward taken. The next time execution reaches the
branch instruction there may be stalls, if the prediction bits do not predict taken.
If the prediction bits predict taken, the address in the BTB will be used to fetch
the first instruction of the loop with no stalls. In the last execution of the loop,
the prediction of taken will be wrong, so the instructions fetched from the BTB
access will be cancelled and ths stalls the pipeline while the correct instructions
are fetched (See Text page 78)
pf3
pf4

Partial preview of the text

Download ECE 371 Exam 2024 term and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

ECE 371 MIDTERM EXAM (A) FALL 2022 NAME____KEY__________________ 1

  1. The 8-bit two’s complement Sign and Magnitude representation for the decimal number –25 is ______________ (show work) 00011001 = 25 11100110 + 11100111 = -
  2. The diagram below shows a section of a pipelined machine that essentially functions as a shift register. The registers each have a propagation delay of 5 ns, a setup time of 2 ns and a hold time of 1 ns. Logic block A has a propagation delay of 2 ns and logic block B has a propagation delay of 3 ns. Calculate the minimum clock period and the maximum frequency at which this circuit can be clocked with no slack time. (Think about which stage is the worst case (limiting factor.) (Show all work.) Tclk-min = TFFpd + TBlock b + Tsu Tclk-min = 5 ns + 3 ns + 2 ns = 10 ns FMAX = 1/10 ns = 100 MHz
  3. Briefly explain how a Branch Target buffer and two-bit branch prediction reduces pipeline stalls during execution of a program loop such as the one in Figure 2-9 that executes many times. The first time execution reaches the branch at the end of the loop there will be stalls, because the Branch target address is not known until the EX stage and by then the processor has fetched two instructions that will be flushed. However, the Branch target address is put in the Branch Target buffer for future use and the prediction bits are moved toward taken. The next time execution reaches the branch instruction there may be stalls, if the prediction bits do not predict taken. If the prediction bits predict taken, the address in the BTB will be used to fetch the first instruction of the loop with no stalls. In the last execution of the loop, the prediction of taken will be wrong, so the instructions fetched from the BTB access will be cancelled and ths stalls the pipeline while the correct instructions are fetched (See Text page 78)
  1. Tell which program structures in Figure 3-15 are likely to benefit most from a cache and give the simple reason why based on how a cache works. The basic principle of a cache is to store instructions or data that will be used again, in a fast SRAM memory that is close to the processor and can be accessed much more quickly than the DRAM main memory. The first time an instruction is fetched from DRAM main memory there is a long propagation delay. However, when the instruction comes into the processor, it is also put in the fast cache. If the instruction is needed again, it can be accessed from the cache with much lower propagation delay. Therefore, any program structure that repeats a sequence of instructions will benefit from a cache. The two structures that potentially repeat instruction sequences are Repeat-Until and While-Do, so these will likely benefit from a cache. (Text Page 74) 5.Given the User Mode register and memory contents shown below, predict the register contents and, where appropriate, the flag states produced by each of the following ARM instructions. Assume the values shown for register and memory contents are all in hexadecimal, assume LITTLE-ENDIAN memory storage, and assume the instructions are not sequential. NA for flags not affected. R0 – 12345678 R8 – 0000003F R1 – FFFF0000 R9 - R2 – E0AB5023 R10 - R3 – 00000000 R11 - R4 – 80000130 R R5 – 80000138 R R6 --FFFFFFFF R R7 – PC(R15) ADDRESS CONTENTS (INCREASING ADDRESSES left to right) (hex) (hex) SCORES 80000130 04 77 59 27 80000134 FF 73 92 45 80000138 27 98 42 70 NZ a. ANDS R2, R2, R1 ;R1_ FFFF0000 _ R2 _ E0AB0000 _ Flags_10___ b. LDR R0, [R4], #4 ;R0 27597704 ____ R4_ 80000134 _____ Flags__NA_____
  2. Write the assembly language instruction that will cause the processor to Branch to the label ANOTHER: if the zero flag is not set BNE ANOTHER

8b. Using only the STANDARD PROGRAM STRUCTURES shown in text Figure 3-15, write the ALGORITHM/task list for a simple program that calculates the rounded average of the 8 values and puts the result in the memory location you have created for the average. As always, simply think of the initializations and the steps you would take, if you were doing it with pencil and paper.

. Initialize pointer to WTRF array R Initialize pointer to DayAv memory location R Initialize counter to 8 since 8 elements R Initialize Sum to zero to act as accumulator R Repeat Read half word from WTRF and INC pointer to next value in WTRF Add to value read from WTRF to sum Decrement counter Until all 8 elements of WTRF added Divide sum by 8 to get average (shift right 3 bit positions, 8 is power of 2?) Round average Write average to DayAv memory location 8c. Show the assembly language instructions you would use to initialize pointers to the WTRF array and the DayAv variable. LDR R0, = WTRF @ Initialize pointer to WTRF array LDR R1, = DayAv @Initialize pointer to DayAv location