The University of Hong Kong · FACULTY OF ENGINEERING

ENGG1000 Chap.4 Computer Architecture, Memory and Logic

- one subject, every graph, every model, every mark
7 Chapters4-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 4 of 10 · ENGG1000

Computer Architecture, Memory and Logic

The stored-program cycle

Instructions and data occupy addressable memory. The processor fetches an instruction, the control unit decodes it, the arithmetic and logic unit performs the requested transformation, and registers or memory receive the result.

Separating direction from calculation makes component roles easier to test.

Why memory is layered

Registers, cache, main memory and auxiliary storage trade speed against capacity and cost. Cache exploits temporal and spatial locality to keep frequently needed values close to the processor.

A small miss rate can still dominate average time because the slow path is much longer.

Trace control and data as separate paths

For an instruction trace, begin with the program counter and follow the instruction into decoding. Then follow operand addresses through cache and memory into registers, identify the arithmetic or logical transformation, and state where the result is stored.

Control signals decide which transfers occur; data paths carry the bit patterns being transformed. Naming both paths avoids treating the processor as an unexplained box and reveals where a dependency or memory delay can stall progress.

Interpret bits through their operation

A bit pattern has no single human meaning by itself.

The same sequence may be read as an unsigned value, a signed value, part of an instruction or an address, depending on its type and the operation applied. Logic gates act on binary states without recognising that interpretation.

When converting or tracing data, record the representation, word width and sign convention before assigning a decimal meaning or predicting overflow.

Quantify the memory trade-off

Average access time combines the frequent fast path with the rarer slow path.

Multiply hit time by its probability and add miss service time weighted by miss probability, taking care whether the stated penalty already includes the initial lookup. This calculation explains why a seemingly small miss rate matters when main memory is far slower than cache.

Capacity, latency, price and persistence are separate axes, so no memory technology is simply best.

Evaluate performance claims at the bottleneck

Clock rate counts cycles per second but does not state how many cycles a task needs. More cores provide potential throughput only when work can run concurrently, while serial dependencies and communication limit the gain.

A faster arithmetic unit cannot eliminate a memory stall. A defensible comparison identifies the workload, traces its limiting resource, and distinguishes latency for one task from throughput across many tasks.

In this chapter

What this chapter covers

  • 01

    Stored-program architecture

  • 02

    Fetch-decode-execute cycle

  • 03

    Control-unit signals

  • 04

    ALU operations

  • 05

    Registers and cache

  • 06

    Main and auxiliary memory

  • 07

    Boolean gates and expressions

Worked example · free

Compute average memory access time

Q [6 marks]. AskSia-authored practice. Cache access is 4 ns, hit rate is 90%, and a miss adds 60 ns. Find the average. The marks shown are an AskSia study allocation, not the University's marking scheme.
The arrows separate control from calculation.The arrows separate control from calculation. Main memory supplies instructions and data, the control unit directs the cycle, the ALU transforms operands, and registers hold the fastest working values.Memory holds both instructions and dataMain memorydata + instructionsControl unitALURegistersfast operandsfetch → decode → execute → store
The arrows separate control from calculation. Main memory supplies instructions and data, the control unit directs the cycle, the ALU transforms operands, and registers hold the fastest working values.
  • 2Identify hit and miss paths.
  • 2Weight each path by probability.
  • 2Check the range.
Every access pays 4 ns, and ten per cent also pay 60 ns. Average time is 4 + 0.10 times 60 = 10 ns. Equivalently, 0.90 times 4 plus 0.10 times 64 also gives 10 ns. The result lies between 4 and 64 ns.
Sia tip — Clarify whether a quoted miss penalty includes the cache lookup before taking a weighted average.
Glossary

Key terms

Stored Program
An architecture in which instructions and data are held in memory.
Control Unit
The processor component coordinating operations and data movement.
Arithmetic Logic Unit
The component performing arithmetic, comparisons and bit operations.
Register
Very fast processor storage for active values.
Cache
Fast memory retaining recently or nearby used data.
Boolean Logic
Binary algebra implemented by switching gates.
FAQ

Computer Architecture, Memory and Logic FAQ

Does the ALU load data from memory?

The ALU transforms operands through arithmetic, comparison and bitwise operations. The control unit directs memory reads and writes and routes values into registers, after which the ALU can operate on them. Loading is therefore a data-movement operation, not the ALU's defining role.

Why does cache improve performance?

Programs often reuse recent data and access nearby addresses. Cache keeps a small working set close to the processor, so many requests avoid slower main memory. Its benefit depends on locality and the size of the miss penalty.

How do I check a Boolean expression?

Construct a truth table covering every input combination or evaluate the gate sequence one stage at a time. Keep intermediate outputs labelled. This prevents precedence assumptions from changing the logic when several NOT, AND and OR operations appear together.

Study strategy

Exam move

Redraw the datapath with memory, control unit, ALU and registers, then narrate one instruction through fetch, decode, execute and store. Build a separate memory ladder ordered by latency and capacity. For logic, convert expressions into gate sequences and truth tables rather than relying on verbal intuition about the result.

Annotate the instruction trace twice, once with control decisions and once with data locations, so a missing transfer becomes visible. Create short average-access-time drills in which the miss penalty is stated in different ways and explain which terms are already included. When evaluating a performance claim, write workload, latency, throughput and bottleneck as four separate headings.

For binary questions, state width and interpretation before converting, then verify the result through the inverse conversion or a truth table.

A+Everything unlocked
Unlocks this Bible + all 52 of your subjects at The University of Hong Kong, plus 1,000+ more Bibles across the AskSia library.
Sia - your ENGG1000 tutor, unlimited, worked the way the exam marks it
The full 4-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works