<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Final | Yao Zheng@UHM</title><link>https://gustybear.github.io/tags/final/</link><atom:link href="https://gustybear.github.io/tags/final/index.xml" rel="self" type="application/rss+xml"/><description>Final</description><generator>Hugo Blox Builder (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Fri, 08 May 2026 00:00:00 +0000</lastBuildDate><image><url>https://gustybear.github.io/media/logo_hu_d0a0b1783c391ac0.png</url><title>Final</title><link>https://gustybear.github.io/tags/final/</link></image><item><title>Practice Final Exam</title><link>https://gustybear.github.io/docs/exams/course_ece260_2025_fall/final_practice/</link><pubDate>Tue, 25 Nov 2025 00:00:00 +0000</pubDate><guid>https://gustybear.github.io/docs/exams/course_ece260_2025_fall/final_practice/</guid><description>&lt;p>&lt;strong>Scope:&lt;/strong> Combinational Logic, Sequential logic, RTL Design&lt;br>
&lt;strong>Duration:&lt;/strong> 2 hours&lt;br>
&lt;strong>Instructions&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Attempt &lt;strong>all&lt;/strong> questions. Show reasoning, derivations, and clearly state assumptions.&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="part-a--multiple-choice-5--4-pts--20-pts">Part A — Multiple Choice (5 × 4 pts = 20 pts)&lt;/h2>
&lt;p>Select the &lt;strong>best&lt;/strong> answer.&lt;/p>
&lt;p>&lt;strong>Q1.&lt;/strong> In a pipelined RTL datapath, a structural hazard occurs when:&lt;/p>
&lt;ul>
&lt;li>A. Multiple pipeline stages need the same hardware resource&lt;/li>
&lt;li>B. Instructions depend on the results of prior instructions&lt;/li>
&lt;li>C. The clock frequency is too low&lt;/li>
&lt;li>D. Control signals are not registered&lt;br>
&lt;strong>Answer:&lt;/strong> A&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Q2.&lt;/strong> In a synchronous design, increasing the number of pipeline registers generally:&lt;/p>
&lt;ul>
&lt;li>A. Increases the critical-path delay&lt;/li>
&lt;li>B. Decreases the maximum clock frequency&lt;/li>
&lt;li>C. Reduces combinational delay per stage&lt;/li>
&lt;li>D. Eliminates data hazards entirely&lt;br>
&lt;strong>Answer:&lt;/strong> C&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Q3.&lt;/strong> A register file with two read ports and one write port requires:&lt;/p>
&lt;ul>
&lt;li>A. Two physical register copies&lt;/li>
&lt;li>B. One array with dual-read-access mechanisms&lt;/li>
&lt;li>C. Flip-flops instead of memory cells&lt;/li>
&lt;li>D. A clock enable on its read ports&lt;br>
&lt;strong>Answer:&lt;/strong> B&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Q4.&lt;/strong> In RTL modeling, the primary purpose of the register-transfer level is to:&lt;/p>
&lt;ul>
&lt;li>A. Automatically generate physical layout&lt;/li>
&lt;li>B. Describe asynchronous data transfers&lt;/li>
&lt;li>C. Capture clocked state transitions and datapath flow&lt;/li>
&lt;li>D. Specify combinational logic through truth tables&lt;br>
&lt;strong>Answer:&lt;/strong> C&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Q5.&lt;/strong> A Mealy-type controller is preferred over a Moore-type controller when:&lt;/p>
&lt;ul>
&lt;li>A. Output latency must be minimized&lt;/li>
&lt;li>B. Excessive noise immunity is required&lt;/li>
&lt;li>C. Outputs must be stable throughout the clock cycle&lt;/li>
&lt;li>D. A synchronous datapath is not available&lt;br>
&lt;strong>Answer:&lt;/strong> A&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="part-b--design--analysis-8--10-pts--80-pts">Part B — Design &amp;amp; Analysis (8 × 10 pts = 80 pts)&lt;/h2>
&lt;h3 id="problem-1--4-cycle-micro-operation-sequencing">&lt;strong>Problem 1&lt;/strong> — 4-Cycle Micro-operation Sequencing&lt;/h3>
&lt;p>Design a 4-cycle Moore FSM and datapath for:&lt;/p>
&lt;ol>
&lt;li>&lt;code>R1 ← R0 + R2&lt;/code>&lt;/li>
&lt;li>&lt;code>R3 ← R1&lt;/code>&lt;/li>
&lt;li>&lt;code>R4 ← R3 - 1&lt;/code>&lt;/li>
&lt;li>&lt;code>R5 ← R4&lt;/code>&lt;/li>
&lt;/ol>
&lt;p>Show datapath (ALU, MUXes, reg enables) and FSM transitions.&lt;/p>
&lt;h3 id="problem-2--3-input-conditional-datapath">&lt;strong>Problem 2&lt;/strong> — 3-Input Conditional Datapath&lt;/h3>
&lt;p>Implement:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">if (A &amp;gt; B)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> X ← A - C
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">else
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> X ← B + C
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Draw datapath (CMP, ALU, MUX) and two-cycle control sequence.&lt;/p>
&lt;h3 id="problem-3--4-bit-barrel-shifter">&lt;strong>Problem 3&lt;/strong> — 4-bit Barrel Shifter&lt;/h3>
&lt;p>Draw a 4-bit rotate-left barrel shifter (k ∈ {0,1,2,3}) with MUX stages.&lt;/p>
&lt;h3 id="problem-4--5-state-memory-controller">&lt;strong>Problem 4&lt;/strong> — 5-State Memory Controller&lt;/h3>
&lt;p>States: &lt;code>IDLE → REQ → WAIT → LATCH → DONE&lt;/code>&lt;br>
WAIT repeats until &lt;code>mem_ready=1&lt;/code>.&lt;br>
Draw state diagram + control signals.&lt;/p>
&lt;h3 id="problem-5--16-bit-accumulator">&lt;strong>Problem 5&lt;/strong> — 16-bit Accumulator&lt;/h3>
&lt;p>Accumulator operations:&lt;/p>
&lt;ul>
&lt;li>&lt;code>ACC ← ACC + IN&lt;/code>&lt;/li>
&lt;li>&lt;code>ACC ← IN&lt;/code>&lt;/li>
&lt;li>&lt;code>ACC ← 0&lt;/code>&lt;br>
Show ALU, zero-path, MUXing, ACC register control.&lt;/li>
&lt;/ul>
&lt;h3 id="problem-6--pipeline-raw-hazard-detection">&lt;strong>Problem 6&lt;/strong> — Pipeline RAW Hazard Detection&lt;/h3>
&lt;p>For a 2-stage pipeline (F → X), draw RAW hazard detection hardware and stall logic.&lt;/p>
&lt;h3 id="problem-7--signedunsigned-compare-block">&lt;strong>Problem 7&lt;/strong> — Signed/Unsigned Compare Block&lt;/h3>
&lt;p>Mode bit: &lt;code>0 = signed&lt;/code>, &lt;code>1 = unsigned&lt;/code>.&lt;br>
Draw comparator datapath + control.&lt;/p>
&lt;h3 id="problem-8--iterative-multiply-datapath">&lt;strong>Problem 8&lt;/strong> — Iterative Multiply Datapath&lt;/h3>
&lt;p>Given:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">P ← P + A (if B[0]=1)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">A ← A &amp;lt;&amp;lt; 1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">B ← B &amp;gt;&amp;gt; 1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Draw shift registers, adder, and control FSM.&lt;br>
Show cycle-by-cycle micro-ops.&lt;/p></description></item><item><title>Practice Final Exam</title><link>https://gustybear.github.io/docs/exams/course_ece260_2026_spring/final_practice/</link><pubDate>Fri, 08 May 2026 00:00:00 +0000</pubDate><guid>https://gustybear.github.io/docs/exams/course_ece260_2026_spring/final_practice/</guid><description>&lt;p>weight: 5&lt;/p>
&lt;h1 id="ece-260--practice-final-exam-2-hours">ECE 260 — Practice Final Exam (2 Hours)&lt;/h1>
&lt;p>&lt;strong>Course:&lt;/strong> ECE 260 Introduction to Digital Design&lt;br>
&lt;strong>Duration:&lt;/strong> 2 Hours&lt;br>
&lt;strong>Coverage:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Combinational Logic&lt;/li>
&lt;li>Sequential Logic&lt;/li>
&lt;li>FSM Design&lt;/li>
&lt;li>RTL Design&lt;/li>
&lt;li>Pipelines and Hazards&lt;/li>
&lt;li>Cache and Memory Hierarchy&lt;/li>
&lt;li>RISC Pipelines&lt;/li>
&lt;li>Out-of-Order Processors&lt;/li>
&lt;/ul>
&lt;h1 id="part-a--multiple-choice-15--2-pts--30-pts">Part A — Multiple Choice (15 × 2 pts = 30 pts)&lt;/h1>
&lt;p>Select the &lt;strong>best&lt;/strong> answer.&lt;/p>
&lt;h3 id="q1">Q1.&lt;/h3>
&lt;p>A structural hazard occurs when:&lt;/p>
&lt;ul>
&lt;li>A. Two pipeline stages require the same hardware resource&lt;/li>
&lt;li>B. A branch instruction changes PC&lt;/li>
&lt;li>C. The clock frequency is too high&lt;/li>
&lt;li>D. A cache miss occurs&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> A&lt;br>
Structural hazards occur due to hardware resource conflicts.&lt;/p>
&lt;h3 id="q2">Q2.&lt;/h3>
&lt;p>Which memory technology is typically used for CPU cache?&lt;/p>
&lt;ul>
&lt;li>A. DRAM&lt;/li>
&lt;li>B. SRAM&lt;/li>
&lt;li>C. Flash&lt;/li>
&lt;li>D. EEPROM&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;br>
SRAM is faster and used for cache.&lt;/p>
&lt;h3 id="q3">Q3.&lt;/h3>
&lt;p>A Moore FSM output depends on:&lt;/p>
&lt;ul>
&lt;li>A. Inputs only&lt;/li>
&lt;li>B. Current state only&lt;/li>
&lt;li>C. Inputs and outputs&lt;/li>
&lt;li>D. Clock frequency&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q4">Q4.&lt;/h3>
&lt;p>Forwarding in a pipeline mainly reduces:&lt;/p>
&lt;ul>
&lt;li>A. Structural hazards&lt;/li>
&lt;li>B. RAW hazards&lt;/li>
&lt;li>C. WAR hazards&lt;/li>
&lt;li>D. WAW hazards&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q5">Q5.&lt;/h3>
&lt;p>Which cache organization generally has the fewest conflict misses?&lt;/p>
&lt;ul>
&lt;li>A. Direct mapped&lt;/li>
&lt;li>B. 2-way set associative&lt;/li>
&lt;li>C. Fully associative&lt;/li>
&lt;li>D. Write-through&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> C&lt;/p>
&lt;h3 id="q6">Q6.&lt;/h3>
&lt;p>A barrel shifter is primarily built from:&lt;/p>
&lt;ul>
&lt;li>A. Adders&lt;/li>
&lt;li>B. Flip-flops&lt;/li>
&lt;li>C. Multiplexers&lt;/li>
&lt;li>D. Decoders&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> C&lt;/p>
&lt;h3 id="q7">Q7.&lt;/h3>
&lt;p>In Verilog, nonblocking assignment uses:&lt;/p>
&lt;ul>
&lt;li>A. =&lt;/li>
&lt;li>B. &amp;lt;=&lt;/li>
&lt;li>C. ==&lt;/li>
&lt;li>D. :=&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q8">Q8.&lt;/h3>
&lt;p>The maximum clock frequency of a processor is determined by:&lt;/p>
&lt;ul>
&lt;li>A. Shortest path delay&lt;/li>
&lt;li>B. Critical path delay&lt;/li>
&lt;li>C. Number of registers&lt;/li>
&lt;li>D. Cache size&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q9">Q9.&lt;/h3>
&lt;p>Register renaming primarily removes:&lt;/p>
&lt;ul>
&lt;li>A. RAW hazards&lt;/li>
&lt;li>B. WAR and WAW hazards&lt;/li>
&lt;li>C. Cache hazards&lt;/li>
&lt;li>D. Structural hazards&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q10">Q10.&lt;/h3>
&lt;p>Which pipeline hazard is caused by branch instructions?&lt;/p>
&lt;ul>
&lt;li>A. RAW&lt;/li>
&lt;li>B. Structural&lt;/li>
&lt;li>C. Control&lt;/li>
&lt;li>D. WAW&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> C&lt;/p>
&lt;h3 id="q11">Q11.&lt;/h3>
&lt;p>A flip-flop updates state on:&lt;/p>
&lt;ul>
&lt;li>A. Logic transitions only&lt;/li>
&lt;li>B. Clock edge&lt;/li>
&lt;li>C. Input enable&lt;/li>
&lt;li>D. Reset signal only&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q12">Q12.&lt;/h3>
&lt;p>The reorder buffer (ROB) is mainly used in:&lt;/p>
&lt;ul>
&lt;li>A. FSM controllers&lt;/li>
&lt;li>B. Sequential datapaths&lt;/li>
&lt;li>C. Out-of-order processors&lt;/li>
&lt;li>D. SRAM arrays&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> C&lt;/p>
&lt;h3 id="q13">Q13.&lt;/h3>
&lt;p>Spatial locality means:&lt;/p>
&lt;ul>
&lt;li>A. Recently used data reused soon&lt;/li>
&lt;li>B. Nearby memory locations likely accessed&lt;/li>
&lt;li>C. Instructions always sequential&lt;/li>
&lt;li>D. Data stored in cache forever&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> B&lt;/p>
&lt;h3 id="q14">Q14.&lt;/h3>
&lt;p>Which stage performs arithmetic operations in a classic RISC pipeline?&lt;/p>
&lt;ul>
&lt;li>A. IF&lt;/li>
&lt;li>B. ID&lt;/li>
&lt;li>C. EX&lt;/li>
&lt;li>D. WB&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> C&lt;/p>
&lt;h3 id="q15">Q15.&lt;/h3>
&lt;p>Pipeline throughput improves because:&lt;/p>
&lt;ul>
&lt;li>A. Instructions execute simultaneously&lt;/li>
&lt;li>B. Clock frequency becomes zero&lt;/li>
&lt;li>C. Pipeline removes all hazards&lt;/li>
&lt;li>D. Cache misses disappear&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Solution:&lt;/strong> A&lt;/p>
&lt;h1 id="part-b--design-and-analysis-10--7-pts--70-pts">Part B — Design and Analysis (10 × 7 pts = 70 pts)&lt;/h1>
&lt;h1 id="problem-1--sequence-detector-fsm">Problem 1 — Sequence Detector FSM&lt;/h1>
&lt;p>Design a Moore FSM that detects the sequence:&lt;/p>
&lt;p>1011&lt;/p>
&lt;p>Overlapping sequences should be detected.&lt;/p>
&lt;h3 id="a">(a)&lt;/h3>
&lt;p>Draw the state diagram.&lt;/p>
&lt;h3 id="b">(b)&lt;/h3>
&lt;p>Define the state transition table.&lt;/p>
&lt;h3 id="c">(c)&lt;/h3>
&lt;p>Indicate which state produces output = 1.&lt;/p>
&lt;h3 id="d">(d)&lt;/h3>
&lt;p>Explain why a Moore FSM output changes more predictably than a Mealy FSM.&lt;/p>
&lt;h2 id="solution">Solution&lt;/h2>
&lt;h3 id="a-states">(a) States&lt;/h3>
&lt;ul>
&lt;li>S0 = initial&lt;/li>
&lt;li>S1 = detected &lt;code>1&lt;/code>&lt;/li>
&lt;li>S2 = detected &lt;code>10&lt;/code>&lt;/li>
&lt;li>S3 = detected &lt;code>101&lt;/code>&lt;/li>
&lt;li>S4 = detected &lt;code>1011&lt;/code>&lt;/li>
&lt;/ul>
&lt;h3 id="b-example-transitions">(b) Example transitions&lt;/h3>
&lt;ul>
&lt;li>S0 &amp;ndash;1→ S1&lt;/li>
&lt;li>S1 &amp;ndash;0→ S2&lt;/li>
&lt;li>S2 &amp;ndash;1→ S3&lt;/li>
&lt;li>S3 &amp;ndash;1→ S4&lt;/li>
&lt;/ul>
&lt;p>Overlapping:&lt;/p>
&lt;ul>
&lt;li>S4 &amp;ndash;0→ S2&lt;/li>
&lt;li>S4 &amp;ndash;1→ S1&lt;/li>
&lt;/ul>
&lt;h3 id="c-1">(c)&lt;/h3>
&lt;p>Output = 1 only in S4.&lt;/p>
&lt;h3 id="d-1">(d)&lt;/h3>
&lt;p>Moore outputs depend only on registered state, so outputs change only on clock edges.&lt;/p>
&lt;h1 id="problem-2--rtl-datapath-design">Problem 2 — RTL Datapath Design&lt;/h1>
&lt;p>Implement:&lt;/p>
&lt;p>if (SEL == 0)
X ← A + B
else
X ← A − B&lt;/p>
&lt;h3 id="a-1">(a)&lt;/h3>
&lt;p>Draw the datapath.&lt;/p>
&lt;h3 id="b-1">(b)&lt;/h3>
&lt;p>Identify required components.&lt;/p>
&lt;h3 id="c-2">(c)&lt;/h3>
&lt;p>Show control signals.&lt;/p>
&lt;h3 id="d-2">(d)&lt;/h3>
&lt;p>Explain how subtraction can be implemented using an adder.&lt;/p>
&lt;h2 id="solution-1">Solution&lt;/h2>
&lt;h3 id="a-datapath">(a) Datapath&lt;/h3>
&lt;p>Components:&lt;/p>
&lt;ul>
&lt;li>Register A&lt;/li>
&lt;li>Register B&lt;/li>
&lt;li>ALU&lt;/li>
&lt;li>X register&lt;/li>
&lt;li>Control line SEL&lt;/li>
&lt;/ul>
&lt;h3 id="b-2">(b)&lt;/h3>
&lt;p>Required hardware:&lt;/p>
&lt;ul>
&lt;li>Adder/Subtractor&lt;/li>
&lt;li>XOR bank for B inversion&lt;/li>
&lt;li>Carry-in control&lt;/li>
&lt;/ul>
&lt;h3 id="c-3">(c)&lt;/h3>
&lt;ul>
&lt;li>SEL=0 → addition&lt;/li>
&lt;li>SEL=1 → subtraction&lt;/li>
&lt;/ul>
&lt;h3 id="d-3">(d)&lt;/h3>
&lt;p>A - B = A + (~B) + 1&lt;/p>
&lt;p>Uses two’s complement arithmetic.&lt;/p>
&lt;h1 id="problem-3--pipeline-hazard-analysis">Problem 3 — Pipeline Hazard Analysis&lt;/h1>
&lt;p>Given:&lt;/p>
&lt;p>ADD R1,R2,R3
SUB R4,R1,R5
AND R6,R4,R7&lt;/p>
&lt;h3 id="a-2">(a)&lt;/h3>
&lt;p>Identify all RAW hazards.&lt;/p>
&lt;h3 id="b-3">(b)&lt;/h3>
&lt;p>Show where forwarding occurs.&lt;/p>
&lt;h3 id="c-4">(c)&lt;/h3>
&lt;p>Determine if stalls are required.&lt;/p>
&lt;h3 id="d-4">(d)&lt;/h3>
&lt;p>Explain how forwarding improves performance.&lt;/p>
&lt;h2 id="solution-2">Solution&lt;/h2>
&lt;h3 id="a-3">(a)&lt;/h3>
&lt;p>Hazards:&lt;/p>
&lt;ul>
&lt;li>SUB depends on ADD&lt;/li>
&lt;li>AND depends on SUB&lt;/li>
&lt;/ul>
&lt;h3 id="b-4">(b)&lt;/h3>
&lt;p>Forward:&lt;/p>
&lt;ul>
&lt;li>ADD EX/MEM → SUB EX&lt;/li>
&lt;li>SUB EX/MEM → AND EX&lt;/li>
&lt;/ul>
&lt;h3 id="c-5">(c)&lt;/h3>
&lt;p>No stalls if forwarding hardware exists.&lt;/p>
&lt;h3 id="d-5">(d)&lt;/h3>
&lt;p>Forwarding bypasses waiting for WB stage.&lt;/p>
&lt;h1 id="problem-4--cache-design">Problem 4 — Cache Design&lt;/h1>
&lt;p>Compare:&lt;/p>
&lt;ul>
&lt;li>Direct mapped&lt;/li>
&lt;li>2-way set associative&lt;/li>
&lt;li>Fully associative&lt;/li>
&lt;/ul>
&lt;h3 id="a-4">(a)&lt;/h3>
&lt;p>Draw organization of each.&lt;/p>
&lt;h3 id="b-5">(b)&lt;/h3>
&lt;p>Compare hardware complexity.&lt;/p>
&lt;h3 id="c-6">(c)&lt;/h3>
&lt;p>Compare conflict misses.&lt;/p>
&lt;h3 id="d-6">(d)&lt;/h3>
&lt;p>Which provides best performance and why?&lt;/p>
&lt;h2 id="solution-3">Solution&lt;/h2>
&lt;h3 id="direct-mapped">Direct mapped&lt;/h3>
&lt;ul>
&lt;li>Simplest&lt;/li>
&lt;li>Fastest indexing&lt;/li>
&lt;li>Highest conflict misses&lt;/li>
&lt;/ul>
&lt;h3 id="2-way-set-associative">2-way set associative&lt;/h3>
&lt;ul>
&lt;li>Better balance&lt;/li>
&lt;li>Moderate complexity&lt;/li>
&lt;/ul>
&lt;h3 id="fully-associative">Fully associative&lt;/h3>
&lt;ul>
&lt;li>Lowest conflict misses&lt;/li>
&lt;li>Requires many comparators&lt;/li>
&lt;/ul>
&lt;p>Best overall practical choice:
2-way or 4-way associative.&lt;/p>
&lt;h1 id="problem-5--register-file">Problem 5 — Register File&lt;/h1>
&lt;p>Design a register file with:&lt;/p>
&lt;ul>
&lt;li>8 registers&lt;/li>
&lt;li>2 read ports&lt;/li>
&lt;li>1 write port&lt;/li>
&lt;/ul>
&lt;h3 id="a-5">(a)&lt;/h3>
&lt;p>Draw block diagram.&lt;/p>
&lt;h3 id="b-6">(b)&lt;/h3>
&lt;p>Explain read operation.&lt;/p>
&lt;h3 id="c-7">(c)&lt;/h3>
&lt;p>Explain write operation.&lt;/p>
&lt;h3 id="d-7">(d)&lt;/h3>
&lt;p>Describe required decoders and multiplexers.&lt;/p>
&lt;h2 id="solution-4">Solution&lt;/h2>
&lt;h3 id="a-6">(a)&lt;/h3>
&lt;p>Components:&lt;/p>
&lt;ul>
&lt;li>8 registers&lt;/li>
&lt;li>Write decoder&lt;/li>
&lt;li>Two read MUXes&lt;/li>
&lt;/ul>
&lt;h3 id="b-7">(b)&lt;/h3>
&lt;p>Read ports select registers simultaneously.&lt;/p>
&lt;h3 id="c-8">(c)&lt;/h3>
&lt;p>Write decoder activates one register enable.&lt;/p>
&lt;h3 id="d-8">(d)&lt;/h3>
&lt;ul>
&lt;li>3-to-8 decoder&lt;/li>
&lt;li>Two 8-to-1 MUXes&lt;/li>
&lt;/ul>
&lt;h1 id="problem-6--barrel-shifter">Problem 6 — Barrel Shifter&lt;/h1>
&lt;p>Design a 4-bit rotate-left barrel shifter.&lt;/p>
&lt;h3 id="a-7">(a)&lt;/h3>
&lt;p>Show all possible rotations.&lt;/p>
&lt;h3 id="b-8">(b)&lt;/h3>
&lt;p>Draw multiplexer stages.&lt;/p>
&lt;h3 id="c-9">(c)&lt;/h3>
&lt;p>Determine number of multiplexers required.&lt;/p>
&lt;h3 id="d-9">(d)&lt;/h3>
&lt;p>Explain why barrel shifters are faster than iterative shifters.&lt;/p>
&lt;h2 id="solution-5">Solution&lt;/h2>
&lt;h3 id="a-8">(a)&lt;/h3>
&lt;p>Possible rotations:&lt;/p>
&lt;ul>
&lt;li>0&lt;/li>
&lt;li>1&lt;/li>
&lt;li>2&lt;/li>
&lt;li>3&lt;/li>
&lt;/ul>
&lt;h3 id="b-9">(b)&lt;/h3>
&lt;p>Two-stage MUX network:&lt;/p>
&lt;ul>
&lt;li>Shift by 1&lt;/li>
&lt;li>Shift by 2&lt;/li>
&lt;/ul>
&lt;h3 id="c-10">(c)&lt;/h3>
&lt;p>Requires:&lt;/p>
&lt;ul>
&lt;li>8 multiplexers total&lt;/li>
&lt;/ul>
&lt;h3 id="d-10">(d)&lt;/h3>
&lt;p>All shifts occur in parallel combinational hardware.&lt;/p>
&lt;h1 id="problem-7--five-stage-risc-pipeline">Problem 7 — Five-Stage RISC Pipeline&lt;/h1>
&lt;h3 id="a-9">(a)&lt;/h3>
&lt;p>Draw the 5 stages.&lt;/p>
&lt;h3 id="b-10">(b)&lt;/h3>
&lt;p>Describe purpose of each stage.&lt;/p>
&lt;h3 id="c-11">(c)&lt;/h3>
&lt;p>Indicate where hazards occur.&lt;/p>
&lt;h3 id="d-11">(d)&lt;/h3>
&lt;p>Explain why pipelining improves throughput.&lt;/p>
&lt;h2 id="solution-6">Solution&lt;/h2>
&lt;p>Pipeline:&lt;/p>
&lt;p>IF → ID → EX → MEM → WB&lt;/p>
&lt;h3 id="if">IF&lt;/h3>
&lt;p>Fetch instruction.&lt;/p>
&lt;h3 id="id">ID&lt;/h3>
&lt;p>Decode + register read.&lt;/p>
&lt;h3 id="ex">EX&lt;/h3>
&lt;p>ALU operation.&lt;/p>
&lt;h3 id="mem">MEM&lt;/h3>
&lt;p>Memory access.&lt;/p>
&lt;h3 id="wb">WB&lt;/h3>
&lt;p>Write register.&lt;/p>
&lt;p>Hazards:&lt;/p>
&lt;ul>
&lt;li>RAW in EX&lt;/li>
&lt;li>Control hazards after branch&lt;/li>
&lt;/ul>
&lt;p>Throughput improves by overlapping execution.&lt;/p>
&lt;h1 id="problem-8--branch-prediction">Problem 8 — Branch Prediction&lt;/h1>
&lt;h3 id="a-10">(a)&lt;/h3>
&lt;p>Explain static branch prediction.&lt;/p>
&lt;h3 id="b-11">(b)&lt;/h3>
&lt;p>Explain dynamic branch prediction.&lt;/p>
&lt;h3 id="c-12">(c)&lt;/h3>
&lt;p>Why do mispredictions hurt performance?&lt;/p>
&lt;h3 id="d-12">(d)&lt;/h3>
&lt;p>What hardware is commonly used in dynamic prediction?&lt;/p>
&lt;h2 id="solution-7">Solution&lt;/h2>
&lt;h3 id="static">Static&lt;/h3>
&lt;p>Fixed guess.&lt;/p>
&lt;h3 id="dynamic">Dynamic&lt;/h3>
&lt;p>Uses runtime history.&lt;/p>
&lt;h3 id="misprediction-penalty">Misprediction penalty&lt;/h3>
&lt;p>Pipeline flush required.&lt;/p>
&lt;h3 id="hardware">Hardware&lt;/h3>
&lt;ul>
&lt;li>Branch history table&lt;/li>
&lt;li>Saturating counters&lt;/li>
&lt;/ul>
&lt;h1 id="problem-9--out-of-order-processor">Problem 9 — Out-of-Order Processor&lt;/h1>
&lt;p>Explain:&lt;/p>
&lt;h3 id="a-11">(a)&lt;/h3>
&lt;p>Issue Queue&lt;/p>
&lt;h3 id="b-12">(b)&lt;/h3>
&lt;p>Reorder Buffer&lt;/p>
&lt;h3 id="c-13">(c)&lt;/h3>
&lt;p>Register Renaming&lt;/p>
&lt;h3 id="d-13">(d)&lt;/h3>
&lt;p>Why OoO processors achieve higher performance.&lt;/p>
&lt;h2 id="solution-8">Solution&lt;/h2>
&lt;h3 id="issue-queue">Issue Queue&lt;/h3>
&lt;p>Stores ready instructions.&lt;/p>
&lt;h3 id="rob">ROB&lt;/h3>
&lt;p>Commits instructions in-order.&lt;/p>
&lt;h3 id="register-renaming">Register Renaming&lt;/h3>
&lt;p>Removes false dependencies.&lt;/p>
&lt;h3 id="higher-performance">Higher performance&lt;/h3>
&lt;p>Allows independent instructions to execute earlier.&lt;/p>
&lt;h1 id="problem-10--iterative-multiplier">Problem 10 — Iterative Multiplier&lt;/h1>
&lt;p>Given:&lt;/p>
&lt;p>if (B[0] == 1)
P ← P + A&lt;/p>
&lt;p>A ← A &amp;laquo; 1
B ← B &amp;raquo; 1&lt;/p>
&lt;h3 id="a-12">(a)&lt;/h3>
&lt;p>Draw datapath.&lt;/p>
&lt;h3 id="b-13">(b)&lt;/h3>
&lt;p>Identify registers.&lt;/p>
&lt;h3 id="c-14">(c)&lt;/h3>
&lt;p>Draw FSM states.&lt;/p>
&lt;h3 id="d-14">(d)&lt;/h3>
&lt;p>Explain why multiplication requires multiple cycles.&lt;/p>
&lt;h2 id="solution-9">Solution&lt;/h2>
&lt;h3 id="a-13">(a)&lt;/h3>
&lt;p>Datapath:&lt;/p>
&lt;ul>
&lt;li>Adder&lt;/li>
&lt;li>Shift register A&lt;/li>
&lt;li>Shift register B&lt;/li>
&lt;li>Product register P&lt;/li>
&lt;/ul>
&lt;h3 id="b-14">(b)&lt;/h3>
&lt;p>Registers:&lt;/p>
&lt;ul>
&lt;li>A&lt;/li>
&lt;li>B&lt;/li>
&lt;li>P&lt;/li>
&lt;li>Counter&lt;/li>
&lt;/ul>
&lt;h3 id="c-15">(c)&lt;/h3>
&lt;p>FSM:&lt;/p>
&lt;ul>
&lt;li>IDLE&lt;/li>
&lt;li>CHECK&lt;/li>
&lt;li>ADD&lt;/li>
&lt;li>SHIFT&lt;/li>
&lt;li>DONE&lt;/li>
&lt;/ul>
&lt;h3 id="d-15">(d)&lt;/h3>
&lt;p>Each bit of multiplier processed sequentially.&lt;/p>
&lt;p>Complexity:&lt;/p>
&lt;ul>
&lt;li>N-bit multiplication requires N cycles.&lt;/li>
&lt;/ul></description></item></channel></rss>