Course Hub
This is the main entry point for the course.
Use it to jump to lectures, labs, exercises, assignments, concepts, and exam preparation.
Where to find concepts
Concept folders follow the lecture titles. Shared concepts stay in their primary lecture folder and remain linked from other lessons. Computer Architectures also has two lab folders for concepts introduced in the labs.
Lab 01 - gem5 and ASE Studio/— Lab 01 - gem5 and ASE Studio (1 concept)Lab 02 - Neural Computation and Amdahl Law/— Lab 02 - Neural Computation and Amdahl Law (1 concept)Lecture 01 - RISC-V Basics/— Lecture 01 - RISC-V Basics (2 concepts)Lecture 02 - Memory, Stack and Function Calls/— Lecture 02 - Memory, Stack and Function Calls (3 concepts)ARM Stack and Multiple-Register Transfers/— ARM Stack and Multiple-Register Transfers (2 concepts)Lecture 03 - Branches and Control Flow/— Lecture 03 - Branches and Control Flow (1 concept)Lecture 04 - Pipelining/— Lecture 04 - Pipelining (1 concept)Lecture 05 - Multicycle Operations/— Lecture 05 - Multicycle Operations (9 concepts)Lecture 06 - Exceptions and Interrupts/— Lecture 06 - Exceptions and Interrupts (2 concepts)Lecture 07 - Instruction-Level Parallelism/— Lecture 07 - Instruction-Level Parallelism (5 concepts)Lecture 08 - Cache Memories/— Lecture 08 - Cache Memories (1 concept)Lecture 09 - Branch Prediction/— Lecture 09 - Branch Prediction (1 concept)Lecture 10 - Dynamic Scheduling/— Lecture 10 - Dynamic Scheduling (2 concepts)Lecture 11 - Hardware Speculation/— Lecture 11 - Hardware Speculation (1 concept)Lecture 12 - Multiple Issue/— Lecture 12 - Multiple Issue (1 concept)NXP LPC1768 LED and GPIO/— NXP LPC1768 LED and GPIO (2 concepts)
Connected course summary
Follow the explanations below to see how the ideas build on each other. Each concept is introduced before its link. Open Computer Architectures - Connected Reading Guide to read the summary on its own.
Computer Architectures - Connected Reading Guide
Read each explanation as one step in the course’s reasoning. The concept link follows its introduction; open it for detail or continue to the next paragraph. The summaries connect the supplied material, while source references and qualifications remain in the lecture and concept notes.
RISC-V Basics
Begin with the operations a processor exposes to software, then follow how instructions represent operands and choose the next instruction.
Start with the interface between software and the processor. An instruction set defines the operations a program can request and the state those operations can access. RISC-V provides the vocabulary used in these notes; it does not prescribe one particular pipeline implementation. RISC-V
Instructions need operands. Registers hold values the processor can use directly, while immediates encode constants inside instructions. The width and signed interpretation of an immediate constrain which constants fit in one instruction, explaining why larger values sometimes require a sequence. Registers and Immediates
Functions explain one form of control transfer, but conditions and loops also need to choose what executes next. A branch changes the program counter when its condition is true; otherwise execution continues sequentially. A jump transfers control without that conditional test. Branches
The full lecture develops these ideas with its own examples. Lecture 01 - RISC-V Basics
Memory, Stack and Function Calls
Registers provide working storage, but real programs need larger data structures and reusable routines. Follow how addresses, calls and saved state fit together.
Registers cannot hold all program data, so instructions also need access to memory. An address identifies a location; the value stored there is a different thing. Loads and stores use a base register plus an offset, connecting individual accesses to arrays and other layouts. Memory Addressing
As programs grow, reusable functions need a way to transfer control and then return. A call saves a return address before jumping; a return uses that address. Nested calls make saving the caller’s return address essential because a later call can overwrite the return-address register. Function Calls
Those saved addresses and temporary values need organized storage. The stack reserves a separate frame for each active call and releases frames in reverse order as calls return. This last-in, first-out arrangement follows the nesting of function execution. Stack
The full lecture develops these ideas with its own examples. Lecture 02 - Memory, Stack and Function Calls
Branches and Control Flow
Once instructions can compute values, the program must decide which computation comes next. That decision connects source-level conditions and loops to the instruction-fetch problem.
Knowing what instructions do lets us ask how to execute more of them in a given time. Pipelining overlaps stages from different instructions to improve throughput. Shared resources, unavailable operands and unresolved branches can interrupt that overlap, so the ideal completion rate is not always achieved. Pipelining
The full lecture develops these ideas with its own examples. Lecture 03 - Branches and Control Flow
Pipelining
Now move from what instructions mean to how their execution can overlap. Begin with throughput, then consider why branch decisions can interrupt that overlap.
This lecture applies the earlier control-flow and execution ideas together: the branch chooses the next instruction, while the pipeline may already be fetching work before that choice is resolved.
The full lecture develops these ideas with its own examples. Lecture 04 - Pipelining
Multicycle Operations
Complex operations break the assumption that every instruction uses the same short execution path. Follow the timing consequences from one functional unit to the performance of the whole pipeline.
A simple pipeline assumes a short execution stage, but complex operations may need several cycles. Separate execution paths let such operations take longer without forcing every instruction to use a slower clock. Different completion times then create additional scheduling problems. Multicycle Operations
To schedule those paths, distinguish when a result becomes usable from when the same unit can accept another operation. Latency concerns a dependent consumer; initiation interval concerns repeated use of a unit. A pipelined unit can accept new independent work before its earlier result is ready. Latency and Initiation Interval
Even independent instructions can conflict when hardware cannot serve them at the required time. An occupied divider or several simultaneous requests for one write port create structural hazards. The scheduling decision must consider when resources will be needed, not only whether they are free now. Structural Hazards in Multicycle Pipelines
Resource availability is only part of correctness. A reader must receive the intended earlier result, and multiple writers must leave the correct final value. RAW hazards concern reading before a result is ready; WAW hazards concern writes completing in an incorrect order. RAW and WAW Hazards
These constraints must be checked before an instruction is allowed to proceed. In the lecture’s model, decode checks resources, source values and destination conflicts, stalling when issuing would be unsafe. This connects the abstract hazard categories to a concrete control decision. Hazard Detection in ID
The lecture then makes timing concrete through the R4000 example. Its eight-stage integer pipeline divides work more finely, including memory access, to support a higher clock frequency. More stages also change when results and branch decisions become available. MIPS R4000 Pipeline
That deeper pipeline explains why younger instructions may enter before a load result or branch decision is ready. The lecture’s load and branch delay examples show the scheduling consequences of those timing gaps. Their stated delays belong to the illustrated R4000 model. Load and Branch Delay Slots
Floating-point execution adds another timing complication: different operations use different sequences of internal stages. Even operations with different names can compete for a shared stage. Correct scheduling therefore needs the functional-unit stage pattern as well as an overall operation duration. MIPS R4000 FP Pipeline
The timing diagrams become useful when translated into performance. CPI measures average cycles per completed instruction, including delays from hazards. Different workloads accumulate different stall costs, so identifying the dominant contribution tells us which improvement might matter. Pipeline CPI and Stall Costs
The full lecture develops these ideas with its own examples. Lecture 05 - Multicycle Operations
Exceptions and Interrupts
The pipeline must remain correct when normal execution is redirected. Begin with the event, then determine which instruction effects the handler is allowed to observe.
Overlapping execution must also cope with events that redirect control to a handler. An instruction may fault, or an external device may request attention. The processor must decide what work can finish and what state to preserve so execution can resume or terminate correctly. Exceptions and Interrupts
A handler needs a coherent view of the interrupted program. Precise exceptions present state consistent with a defined instruction boundary: required older effects are complete and younger effects have not become visible. Internal execution order can vary only if that architectural view is preserved. Precise Exceptions
The full lecture develops these ideas with its own examples. Lecture 06 - Exceptions and Interrupts
Instruction-Level Parallelism
With execution and recovery established, ask how much additional independent work can be exposed. Every transformation must keep the original program’s required results and observable behavior.
Once correctness under overlap is clear, the next goal is to expose more independent work. Instruction-level parallelism is the opportunity to overlap instructions without changing program behavior. Compilers and hardware can both find opportunities, but dependencies and resource limits bound the benefit. Instruction-Level Parallelism
Before rearranging instructions, identify which relationships must remain intact. True data dependencies connect a produced value to its consumers; name dependencies arise when distinct values reuse a register name. A dependence is a program constraint, while a hazard depends on how the pipeline executes it. Instruction Dependencies
When a shared register name is the only obstacle, give distinct values different storage names. Renaming removes WAR and WAW name dependencies while preserving true RAW data flow. It creates scheduling freedom without making a consumer independent of the value it actually needs. Register Renaming
Loops often supply independent work beyond one short instruction block. Unrolling exposes several iterations for scheduling; SIMD applies an operation across multiple data lanes. Both depend on whether iterations can safely run together, so aliasing and loop-carried dependencies must be checked. Loop Unrolling and SIMD
Branches create another limit: work may only be required on one execution path. Speculation begins work before the outcome is known, but must preserve data flow, exception behavior and observable effects. Recovery connects this performance technique back to precise architectural state. Control Dependencies and Speculation
The full lecture develops these ideas with its own examples. Lecture 07 - Instruction-Level Parallelism
Cache Memories
Pipelining and instruction-level parallelism only help while instructions can obtain their operands. A cache reduces waiting by keeping copies of recently useful memory data close to the processor. Temporal locality makes repeated accesses useful; spatial locality makes nearby accesses useful. Fetching a block containing several consecutive array elements can therefore turn one miss into several later hits. Why caches work
Before studying addresses, separate the data from its storage. A block is a chunk of memory bytes; a line is a slot holding one block; a set groups the lines that a block may use; a way is one line position in a set. A four-way cache with 128 lines has 32 sets, each containing four lines. A full set can require replacement while other sets still have empty slots. Blocks, lines, sets and ways
The address selects data in stages: the index chooses the set, the tag is compared with the valid lines in that set, and the offset chooses the byte inside the matching block. No separate address field chooses the way: the cache discovers it through tag comparison. With 4 KiB of data, 32-byte blocks, four ways and 32-bit byte addresses, the fields are 22 tag bits, 5 index bits and 5 offset bits. Count lines and sets before assigning address bits. Lookup · Sizing recipe and worked comparison
A miss raises a second question: where can the incoming block go? Mapping identifies its permitted set; replacement chooses a victim within it. LRU tracks recent accesses, FIFO tracks insertion order, and tree pseudo-LRU approximates recency with direction bits. Revisit the
A → B → A → Ctrace before memorizing the policy names. Replacement tracesIf a cached block changes, write-through sends the update to a lower level while write-back can defer it. A dirty write-back victim must be saved before eviction; a clean one need not be. Separately, other cores may hold stale copies, so even write-through requires coherence. L1/L2/L3 then extend the same caching idea across several capacity and latency levels. Writes and coherence · Hierarchy and average access time
Use the lecture for source attribution, the PDF page map, and both source sizing exercises; use the concept note for the full learning sequence and answered review questions. Lecture 08 - Cache Memories
Branch Prediction
Caches help when the processor knows which data to request. Branches create another obstacle: the fetch stage may need the next instruction address before an earlier branch’s condition is resolved. Prediction lets it begin useful work sooner, while recovery discards the wrong path if the guess fails. This applies the earlier rules for control dependencies and safe speculation. Control Dependencies and Speculation · Why predict a branch?
Begin with direction: taken jumps to the target, while not taken continues sequentially. A static rule can predict a backward loop branch as taken. Dynamic prediction learns from observed outcomes: a one-bit entry remembers the last result, but an unusual loop exit can cause a second mistake when the loop starts again. A two-bit counter adds weak and strong states, resisting one opposite result from a strong state. Trace the state changes one step at a time. One-bit loop trace · Two-bit state transitions
These counters live in a branch history table (BHT). A branch address selects an entry, but different branches may alias into the same counter and affect one another. Predicting taken still leaves the question of where to fetch: a branch-target buffer (BTB) supplies a predicted destination. A tagged BTB can distinguish entries belonging to different branches, similar to cache tag checks from Lecture 08. BHT lookup and aliasing · Direction versus target
Correlating predictors add context: recent branch outcomes help select which counter predicts the current branch. History bits select; counter bits describe a prediction state. A
(3,2)predictor uses three history bits, which have eight possible combinations, and two-bit counters, each with four states. The actual direction still has only two outcomes. gselect concatenates selected address and history bits; gshare combines them with XOR. History and counters · Index selectionFinally translate mistakes into time. Under the fixed-penalty model, branch frequency × misprediction rate × penalty gives extra CPI across all instructions. Cycles per branch has a different denominator. The lecture preserves the source BTB calculation and explains its inconsistent percentage assumptions so that its arithmetic is not mistaken for a universal model. Worked CPI example · Lecture 09 - Branch Prediction
Dynamic Scheduling
The earlier ILP material identified dependencies and renaming opportunities; branch prediction then showed how fetch can continue beyond an unresolved branch. Dynamic scheduling determines which of the pending instructions can actually execute. A slow division can hold up a dependent addition while an independent subtraction proceeds. The lecture’s model issues in order but allows operand waiting, execution and completion to overlap out of order. Motivation and instruction flow
A reservation station saves ready input values or tags identifying the producers of missing values. A CDB broadcast carries a tag and a result, allowing every matching consumer to capture its required value. That satisfies RAW dependencies. A station’s saved Qj/Qk input tags remain attached to its producers even when a later writer changes a register’s Qi mapping. The four-instruction trace shows two f6 versions coexisting without confusing their consumers. Trace register mappings and operand tags
The same tracking separates pending loop iterations that reuse the same register names. Prediction can expose a later iteration; renaming keeps its values distinct; resources and true dependencies still constrain progress. Basic result broadcast does not itself guarantee precise recovery, so distinguish value tracking from in-order commitment. Exceptions and recovery · Loop overlap
Memory requires a further test: differently named registers can hold the same effective address, and multi-byte accesses can overlap. Loads and stores must preserve the values implied by program order. The lecture’s conservative disambiguation checks pending operations rather than treating register independence as proof of memory independence. Memory Disambiguation in Dynamic Scheduling
The lecture retains the source page map, six-instruction snapshot, loop snapshot and source-specific qualifications. Lecture 10 - Dynamic Scheduling
Hardware Speculation
Dynamic scheduling can keep independent work moving, but it also raises the earlier rollback question: what if a younger instruction finishes before an older fault or mispredicted branch is discovered? Hardware speculation separates calculation and result forwarding from permanent architectural updates. An addition can produce 7 and a dependent multiplication can use it before either commits. Provisional execution
The reorder buffer retains every issued instruction in this architecture until commitment, in program order. A ready younger result waits behind the oldest unfinished entry. Commitment is not determined by the fetch stage’s position: fetch already passed the instruction before issue. The station tracks inputs, the execution unit calculates, the CDB broadcasts a ROB-tagged result and the ROB keeps it until safe commitment. Four steps and structures
A wrong prediction discards younger provisional results while preserving the earlier committed prefix. Stores likewise retain addresses and data until commitment; the lecture’s conservative same-location load waits for the older store, even when a branch prediction was correct. This is distinct from store-to-load forwarding supported by other designs. Recovery · Memory effects
Fault detection also becomes provisional: record the fault in the ROB, discard it if its instruction is squashed, or handle it at the head if it belongs to the surviving path. That creates the precise instruction boundary introduced in the exception lecture. Architectural recovery does not necessarily undo internal effects such as speculative cache fills. Fault handling
The lecture’s familiar six-instruction snapshot shows a final add finished but still unable to commit ahead of a long division. Use it to review both renamed values and commitment order. Lecture 11 - Hardware Speculation
Multiple Issue
The preceding lectures established which instructions may execute and when their effects may commit. Multiple issue adds width: accept more than one instruction per cycle. A slow operation’s latency need not prevent average CPI below one when independent work overlaps it. Decode identifies an instruction; issue accepts it after the required checks, so decoding two does not guarantee two accepted instructions. Throughput and latency · Decode versus issue
The static example pairs an integer/memory/branch operation with FP arithmetic. An FP load uses the memory slot, because it transfers data rather than performs FP arithmetic. Even an independent pair can be limited by fetch supply, register-file ports or unit capacity. A dependent FP operation must wait for a loaded value. Packet categories and constraints
Timing must be read in the right units. The illustrated load takes IF1, ID2, EX3, MEM4 and WB5; its value can feed a consumer’s EX5. In a two-wide stream, the companion instruction and the next packet’s two positions arrive too early to use it. Three affected positions are not three extra cycles, nor architectural RISC-V delay slots. Load timing trace
The dynamic version can allocate several ROB/station entries in program order, then execute ready work out of order. More results also need broadcast capacity, and commitment remains ordered. In the final loop example both cases issue later iterations early, but speculation permits earlier execution across unresolved branches. The first three iterations take 19 cycles without speculation and 14 with correct predictions. Dynamic width · Source schedules and comparison
ARMv7-M architecture, directives and memory
The supplied ARM decks apply the same core ideas to a different instruction-set syntax. Begin by separating a 32-bit register from the memory address or value it contains. ARMv7-M uses Thumb and Thumb-2 instructions, status flags and exception modes; its
CMP/conditional-branch pattern relies on flags, unlike RISC-V’s direct register comparisons. ARM Registers, Data Sizes and StatusLoads and stores then connect registers to memory.
LDR,LDRBandLDRHtransfer different widths; little-endian ordering determines how bytes form a word; offsets and writeback update addresses. Arrays useindex × element size, so word lookups shift the index left by two. ARM Memory Access and AddressingAssembler directives describe sections and data layout rather than running on the processor.
DCB,DCW,DCD, alignment, reserved space and literal pools make the data used by those loads explicit. The source’s byte and factorial tables show the complete path from a directive to an indexed load. ARM Assembly Directives and TablesThe source-specific synthesis and page map are in ARM v7-M Architecture, Directives and Memory.
After constants and memory access, the ALU deck explains how ARM computes results and records their consequences. Learn the N, Z, C and V flags first, then use CMP, TST and TEQ to make decisions without writing a normal result. ADC and SBC extend arithmetic across two registers, while the barrel shifter combines with arithmetic and carries bits between words in 64-bit shifts. ARM ALU Operations and Flags
The next ARM deck explains why a 32-bit constant may need more than one instruction. Compare
MOV,MVN,MOVWandMOVT, then follow howLDR =constantbecomes a PC-relative literal-pool load.LTORGchanges where the pool is placed;ADRcomputes a nearby address without a pool, whileLDR =labelcan load an address through one. ARM Constant Encoding and Literal PoolsARM stacks and multiple-register transfers
The general Stack idea becomes explicit in ARM when a function saves several registers at once. ARM Stack Conventions and PUSH POP separates the two independent choices: whether
SPpoints to a full entry or an empty slot, and whether addresses ascend or descend. The standard full descending convention explains whyPUSHisSTMDB SP!andPOPisLDMIA SP!. ARM LDM and STM Addressing Modes then tracesIA,DB, register ordering and the!write-back marker. The source-specific page map is in ARM Stack and Multiple-Register Transfers.ARM branches and control flow
After the ARM architecture, directives and memory notes, follow the control-flow deck. ARM branches use the flags set by
CMPor anS-suffixed arithmetic instruction. Start with ARM Branch Fundamentals to separate direct jumps, register-held destinations, subroutine calls and the Thumb-state address bit. Then use ARM Conditional Branches and Flags to distinguishBLO(unsigned) fromBLT(signed), understandCMPversusSUBS, and apply the short-rangeCBZ/CBNZinstructions. Finish with ARM Loops and Conditional Execution forwhile,foranddo-whiletranslations, the pipeline penalty andITblocks. Compare the flag-based ARM rules with the RISC-V register comparisons in Branches.The source page map and qualifications remain in ARM Branches and Control Flow.
ARM toolchain and runtime memory
Once the ARM source-level mechanisms are familiar, follow ARM Toolchain to see how C/C++ and assembly become an executable image. ARM Toolchain and Memory Images separates compilation, linking and image conversion, then traces why initialized writable data has a Flash load address and a RAM execution address. Startup code performs that copy and clears zero-initialized data before
main()runs. Use the map file to inspect the final addresses and section sizes, and keep compiler optimization separate from link-time removal of unused sections.ARM toolchain and runtime memory
Once the ARM source-level mechanisms are familiar, follow ARM Toolchain to see how C/C++ and assembly become an executable image. ARM Toolchain and Memory Images separates compilation, linking and image conversion, then traces why initialized writable data has a Flash load address and a RAM execution address. Startup code performs that copy and clears zero-initialized data before
main()runs. Use the map file to inspect the final addresses and section sizes, and keep compiler optimization separate from link-time removal of unused sections.LPC1768 memory-mapped I/O and GPIO (LEDs)
Once the toolchain builds an executable and startup code enters
main(), bare-metal C controls peripherals directly through memory-mapped registers. NXP LPC1768 LED and GPIO connects the NXPUM10360user manual, theLPC17xx.hheader and the LandTiger board schematic. LPC1768 Memory-Mapped Registers and LPC17xx.h traces how base constants, offsets, 4-bytestructfields (with reserved spacing) and pointer macros translateLPC_PINCON->PINSEL4into a real hardware address, and why only the schematic maps LEDsLD11–LD4onto active-high pinsP2.0–P2.7. LPC1768 GPIO Configuration and Bitwise Control then separates selecting the pin function (PINSEL4, 2 bits per pin), choosing direction (FIODIR, 1 bit per pin), and driving pins withFIOSET/FIOCLRusing both hexadecimal masks and<<bit shifts.Connecting the labs to performance
The labs turn the execution model into measured comparisons. First establish the workload’s time, then evaluate how much an improvement can change it.
Lab measurements must also reflect the workload being evaluated. Weighted execution time combines each program’s execution time with its frequency of occurrence. A frequently run program can dominate the average even when another program takes longer on an individual run. Weighted Execution Time
Finally, improving one component only helps the execution time that component actually accounts for. Amdahl’s law combines the improved time fraction with the unchanged remainder. In a pipeline, summed operation latencies and elapsed execution cycles are different quantities, so the baseline must match the claimed speedup. Amdahl Law and Pipeline Speedup
Apply these distinctions to the supplied experiments. Lab 01 - gem5 and ASE Studio and Lab 02 - Neural Computation and Amdahl Law
Scheduling and superscalar lab results
Lab 03 compares the same normalization calculation before and after rescheduling and unrolling. Elapsed cycles fall from 408 to 385 to 322. The unrolled program’s CPI is slightly higher than the rescheduled program’s, but its lower instruction count produces a shorter runtime. Compare elapsed time for the same workload before judging CPI alone. Lab 03 - Normalization Scheduling and Unrolling
Lab 04 extends the comparison to a simplified AdaGrad update and factor-four unrolling: initial elapsed cycles fall from 479 to 323. Independent FP latency experiments show that a unit’s latency reduction does not translate equally into elapsed savings for every schedule. Its hand-only branch-delay calculation has different assumptions from the measured RISC-V runs. Lab 04 - AdaGrad Scheduling and Unrolling
Lab 05 moves from program transformations to configuration comparisons. The same 1,409-instruction workload takes 3,134 in-order cycles and 925 superscalar teaching cycles. A second LSU removes much local contention but leaves elapsed time at 925 cycles, illustrating why removing one local delay need not shorten the limiting execution path. The configurations also change latencies and prediction assumptions, so the speedup does not isolate issue width. Lab 05 - Superscalar Execution and Load Store Units
Link to original
Review lessons 08 and 09
Build on the pipeline and speculation material: first explain how the processor finds data, then how it chooses which instruction to fetch. The connected summary above develops the reasoning; these routes lead to the detailed examples.
| Review goal | Read and practise |
|---|---|
| Understand cache organization | [[Cache Memory Fundamentals#2. Blocks, lines, sets and ways |
| Calculate a cache configuration | [[Cache Memory Fundamentals#5. Address-sizing recipe |
| Explain replacement and modified data | [[Cache Memory Fundamentals#6. Replacing a block |
| Trace a branch predictor | [[Branch Prediction Fundamentals#3. One-bit predictor: remember the last outcome |
| Distinguish prediction mechanisms | [[Branch Prediction Fundamentals#5. Where are the counters? The BHT |
| Calculate performance costs | [[Branch Prediction Fundamentals#9. Translate mistakes into performance |
Finish with the answered review questions at the end of each concept note. Try the questions before reading the answers; the checklists below are revision targets, not claims of mastery.
Review lesson 10
Move from the earlier renaming theory to hardware that tracks ready values and missing producers. Start with Lecture 10 - Dynamic Scheduling, then follow these review paths:
- Four-instruction producer trace — separate latest register writers from consumers’ saved input tags.
- Recovery — distinguish operand correctness from precise architectural commitment.
- Two iterations — connect renaming and branch prediction without assuming unlimited parallelism.
- Memory checks — compare effective addresses and overlapping byte ranges, not register names.
Review lesson 11
Lecture 11 - Hardware Speculation completes the recovery story introduced in dynamic scheduling. Use the following paths after reviewing producer tags:
- Issue, execute, write result, commit — separate station, execution unit, CDB and ROB responsibilities.
- Wrong-path recovery — retain older committed effects and discard younger provisional ones.
- Store/load ordering — distinguish memory-read waiting from issuing a ROB entry and from optional store-to-load forwarding.
- Precise faults — record a fault before deciding whether it should reach a handler.
Review lesson 12
Lecture 12 - Multiple Issue widens the instruction stream after lessons 10–11 established scheduling and commitment. Review in this order:
- Width versus latency and CPI — overlap does not shorten each instruction to a fraction of a cycle.
- Decode and issue and slot categories — classify an FP load by its memory operation.
- Load timing — distinguish five pipeline stages, a load-use gap and three instruction positions.
- Loop speculation comparison — locate the earlier execution behind the source’s 19-to-14-cycle improvement.
🚀 Current Focus
- Review Pipelining
- Review Branches
- Finish Lab 01 - gem5 and ASE Studio
- Submit Lab 02 - Neural Computation and Amdahl Law — report and ZIP ready; due 13 October 2026
- Complete current exercise set
Tip
Keep only the things you are actively working on here.
Move completed items into their proper lecture, lab, or exercise note.
📚 Lectures
- Lecture 01 - RISC-V Basics
- Lecture 02 - Memory, Stack and Function Calls
- Lecture 03 - Branches and Control Flow
- Lecture 04 - Pipelining
- Lecture 05 - Multicycle Operations
- Lecture 06 - Exceptions and Interrupts
- Lecture 07 - Instruction-Level Parallelism
- Lecture 08 - Cache Memories
- Lecture 09 - Branch Prediction
- Lecture 10 - Dynamic Scheduling
- Lecture 11 - Hardware Speculation
- Lecture 12 - Multiple Issue
- ARM v7-M Architecture, Directives and Memory — source-specific ARMv7-M, assembler and memory notes
- ARM Stack and Multiple-Register Transfers — ARM stack conventions,
LDM/STM, andPUSH/POP - ARM Constant Encoding and Literal Pools
- ARM ALU Instructions and Flags — ARM arithmetic, logic, shifts and flags — ARM constant construction and PC-relative address loading
- ARM Toolchain - cross-compilation, linking, image formats and Flash/RAM placement
- ARM Toolchain — cross-compilation, linking, image formats and Flash/RAM placement
- NXP LPC1768 LED and GPIO — LPC1768 memory-mapped registers, LandTiger LED wiring,
PINSEL4,FIODIR,FIOSET/FIOCLRand bitwise C control
Next lecture
- Create next lecture note from Lecture Template
🧪 Labs
Note
Put lab files inside:
50 Labs/Computer Architectures/
Active
Completed
- Lab 02 - Neural Computation and Amdahl Law — program, experiments and report complete; university upload pending
- Lab 02 - Program Sources
- Lab 02 - Comparison with Alternate Implementation
- Lab 03 - Normalization Scheduling and Unrolling — experiments and report completed; university upload not established
- Lab 04 - AdaGrad Scheduling and Unrolling — experiments and report completed; university upload not established
- Lab 05 - Superscalar Execution and Load Store Units — experiments and report completed; university upload not established
- Labs 03–05 measurement table
✏️ Exercises
Note
Exercises should link back to the concepts they test.
Active
- Exercise Set 01 (note not created yet)
Important mistakes to revisit
Completed
📦 Assignments
To do
- [ ]
Submitted
🧠 Concepts
RISC-V fundamentals
ARMv7-M and assembly
- ARM Registers, Data Sizes and Status
- ARM Memory Access and Addressing
- ARM Assembly Directives and Tables
- ARM Constant Encoding and Literal Pools
- ARM ALU Instructions and Flags — ARM arithmetic, logic, shifts and flags
- ARM Branches and Control Flow - ARM branches, conditions, loops and IT blocks
- ARM Constant Encoding and Literal Pools
- ARM Toolchain and Memory Images
- ARM Toolchain and Memory Images
LPC1768 peripherals and GPIO
Memory hierarchy
Control flow
- Branches
- ARM Branch Fundamentals
- ARM Conditional Branches and Flags
- ARM Loops and Conditional Execution
- Function Calls
- Stack
Branch prediction
Processor performance
Instruction-level parallelism
- Instruction-Level Parallelism
- Loop Unrolling and SIMD
- Instruction Dependencies
- Register Renaming
- Control Dependencies and Speculation
Dynamic scheduling
- Tomasulo Dynamic Scheduling
- Memory Disambiguation in Dynamic Scheduling
- Hardware Speculation and the Reorder Buffer
- Multiple Issue and Superscalar Throughput
Exceptions and recovery
Related pipeline topics
These can become their own concept notes when they start appearing in several lectures, labs, or exercises:
- Structural Hazards
- Data Hazards
- Forwarding
- Load-Use Hazard
- Control Hazards
- Branch prediction — developed in Lecture 09 - Branch Prediction
Important
Do not create a separate concept note just because a term exists.
Split it out when you have enough material, exercises, or links that it deserves its own page.
❓ Questions / Things I Don’t Understand Yet
- [ ]
Examples:
- Why does this instruction need a stall?
- Why can forwarding solve one dependency but not another?
- Why is this branch taken?
- What exactly is stored in this register at this point?
Once answered, move the explanation into the relevant concept note.
🔗 Quick Navigation
Course work
Most-used concepts
📖 Resources
Slides / PDFs
- Pipelining lecture slides
- Exceptions and interrupts lecture slides
- Instruction-level parallelism lecture slides
- Cache memories — source page map and local PDF reference
- Branch prediction — source page map and local PDF reference
- Dynamic scheduling — source page map and local PDF reference
- Hardware speculation — source page map and local PDF reference
- Multiple issue — source page map and local PDF reference
- NXP LPC1768: led — source page map and study notes
Useful references
🎯 Exam Preparation
Topics checklist
RISC-V
- Registers and ABI names
- Immediate values
-
addi -
lui -
li - Shifts
- Signed vs unsigned comparisons
Memory
- Address vs value
-
la -
lw -
sw -
offset(base)addressing - Arrays and pointer increments
Functions and stack
-
jal -
jalr -
call -
ret -
ra -
sp - Saving return addresses
- LIFO stack behavior
Branches
- Conditional branches
- Taken vs not taken
- Signed vs unsigned branches
- ARM
CMPand APSR flags - ARM
BLOversusBLT - ARM
CBZandCBNZrestrictions - ARM
ITblocks - Loops
Pipelining
- IF / ID / EX / MEM / WB
- Throughput vs latency
- CPI
- Pipeline registers
- Structural hazards
- Data hazards
- Forwarding
- Load-use stalls
- Bubbles
- Control hazards
- Flush
- Predict taken
- Predict untaken
- Delayed branch
Cache memories
- Explain locality and trace block hits and misses
- Distinguish block, line, set and way
- Trace tag/index/offset lookup without adding way bits to the address
- Calculate line count, set count, address fields and metadata
- Compare LRU, FIFO and tree pseudo-LRU
- Distinguish valid from dirty; explain clean and dirty eviction
- Explain write-through, write-back and coherence
- Explain cache levels and average access time
Branch prediction
- Explain taken/not taken, speculative fetch and recovery
- Trace one-bit and two-bit predictors across loop boundaries
- Explain BHT aliasing and BTB target/tag lookup
- Distinguish history bits, counter bits, states and actual outcomes
- Interpret (m,n) and calculate gselect/gshare indices
- Calculate extra CPI and distinguish cycles per branch
Dynamic scheduling
- Distinguish in-order issue from out-of-order execution and completion
- Trace operand values, Qj/Qk tags and register Qi mappings
- Explain RAW waiting and removal of register WAR/WAW conflicts
- Trace CDB broadcasts and structural/bandwidth limits
- Separate basic Tomasulo from precise recovery and speculative commit
- Explain overlapping loop iterations and address disambiguation
Hardware speculation
- Separate provisional result use from architectural commitment
- Trace ROB allocation, readiness, head order and circular-slot reuse
- Distinguish ROB tags from reservation-station identifiers
- Explain CDB broadcasting and release of stations before commit
- Trace a wrong prediction, a pending store/load and a recorded fault
- Explain why IF position and correct prediction alone do not authorize commit
- Separate precise architectural recovery from internal speculative effects
Multiple issue
- Distinguish issue width, decode, operation latency and average CPI
- Classify static issue-packet slots and explain FP loads
- Check fetch, register-port, unit and data constraints
- Trace load stages and count affected instruction positions separately
- Explain in-order multiple allocation and commit with out-of-order execution
- Identify CDB bandwidth limits and speculation’s extra benefit
- Trace the source’s 19-cycle versus 14-cycle loop comparison
Exceptions and interrupts
- Exception classifications
- Handler entry and restart PC
- Precise versus imprecise exceptions
- Completion versus commit
- Simultaneous faults and program-order priority
- Younger fault detected before an older fault
- Suppressing writes and recovering early side effects
Instruction-level parallelism
- Static versus dynamic scheduling
- Basic blocks and load-use scheduling
- Loop unrolling, tail handling, and SIMD
- Dependence versus hazard versus stall
- RAW, WAR, WAW, and memory aliasing
- Register renaming and true data flow
- Control dependence, exception behavior, and safe speculation
LPC1768 GPIO and LEDs
- Explain why the User Manual, board schematic, and sample project are all needed
- Trace the 4-step
LPC17xx.hmemory-mapped register path (BASE, offset,struct+RESERVED0, pointer cast) - Trace LandTiger LED polarity and reverse mapping (
LD11–LD4toP2.0–P2.7) - Configure
PINSEL4(2 bits/pin) andFIODIR(1 bit/pin) using hex masks and<<shifts - Drive and inspect Port 2 pins with
FIOSET,FIOCLR,FIOPIN, andFIOMASK
🔥 Weak Areas
Use this section shortly before the exam.
| Topic | Confidence | What to do |
|---|---|---|
| Pipelining | ⭐⭐⭐ | Solve more timing diagrams |
| Memory addressing | ⭐⭐⭐⭐ | Quick review |
| Stack | ⭐⭐⭐⭐ | Practice nested calls |
| Branch hazards | ⭐⭐⭐ | Review taken/not-taken examples |
Change these ratings yourself as you study.
📝 Practice / Mock Exam
- Do one exercise without notes
- Explain pipeline hazards from memory
- Draw the 5-stage pipeline from memory
- Trace a nested function call and stack
- Trace an array loop using addresses
- Explain a load-use stall
- Explain what happens after a wrong branch prediction
🗂 Course Structure
Current files for this course:
10 Courses/
├── Computer Architectures.md ← YOU ARE HERE
└── Computer Architectures/
└── Lectures/
20 Concepts/
└── Computer Architectures/
├── RISC-V.md
├── Registers and Immediates.md
├── Memory Addressing.md
├── Stack.md
├── Function Calls.md
├── Branches.md
└── Pipelining.md
50 Labs/
└── Computer Architectures/
├── Lab 01 - gem5 and ASE Studio.md
├── lab_01 1.docx
├── Lab 02 - Neural Computation and Amdahl Law.md
├── Lab 02 - Program Sources.md
├── Lab 02 - Comparison with Alternate Implementation.md
└── Lab 02 Programs/Lecture notes preserve course context; concept notes hold reusable knowledge; lab notes track practical work and results.
Create exercise, assignment, and resource folders under 10 Courses/Computer Architectures/ when needed.
✅ End-of-week reset
Once a week:
- Clear finished items from Current Focus
- Make sure every lecture has useful concept links
- File loose notes from
00 Inbox - Record mistakes from exercises
- Update Weak Areas
- Pick the next topics to review