Chapters & sections

CHAPTER 1 · HARDWARE

Central Processing Unit and Main Memory Unit

Original textbook · pp. 46–77

Follow instructions through the CPU, calculate addresses and bus rates, build logic circuits and compare performance techniques.

9 related published questions

This section connects the five-unit model to an instruction actually running. You will identify CPU registers, calculate memory addresses and bus throughput, build simple arithmetic from gates, and explain how caches and parallel execution improve performance. Keep the distinction between an address, an instruction and an operand in view throughout.

Configuration of CPU

Original textbook · pp. 46–49

The control unit coordinates transfers and execution. The ALU performs arithmetic, comparisons and logical operations. Registers provide small, fast working locations. The instruction decoder interprets an instruction’s operation code; the CPU’s clock provides timing events that organize these activities.

CPU registers ↗ · 2 questions have distinct roles. Similar names do not mean that two registers store the same kind of value.

Register What it holds Distinguishing question
Instruction register (IR) The fetched instruction being interpreted Which operation and operand fields were fetched?
Program counter (PC), instruction address register An instruction address Where is the next instruction to fetch?
General-purpose register Operands, addresses or results as permitted by the architecture What working value does this instruction need?
Accumulator An arithmetic operand or result Where is the running arithmetic result?
Base and index registers Values used to calculate effective addresses Where does a region or indexed element begin?
Flag/status register Conditions such as zero, negative, carry or overflow Which condition can a later branch test?
Stack pointer (SP) The current stack position Where do push and pop operate?
Program Status Word (PSW) Architecturally defined execution-state information What state must be saved or restored?

A stack is last-in, first-out storage. Push saves an item and pop retrieves the most recently saved item. The stack’s growth direction and whether SP points to an occupied or next-free location depend on the architecture; neither changes the register’s role.

Clock period is the reciprocal of clock frequency. A 100 MHz clock has a period of 1/(100×10⁶) s = 10 ns. An instruction may take more than one clock cycle, and different designs do different amounts of work per cycle. For a simplified instruction stream:

CPU time = instruction count × average cycles per instruction ÷ clock frequency

For 2 million instructions, average CPI 3 and a 200 MHz clock, time = (2×10⁶×3)/(200×10⁶) = 0.03 s. Comparing clock rates alone would ignore both instruction count and CPI.

An address bus identifies a location, a data bus transfers the value, and a control bus carries signals such as read/write and completion. Internal buses connect parts of a CPU; external/system, memory, I/O and expansion buses connect broader parts of a system. Serial links send bits sequentially; parallel buses transfer multiple bits at once. A physical data width need not equal the processor’s advertised word width.

Bus transfer rate ↗ · 1 question depends on useful transfers per second, not just the input clock:

bytes/s = (data bits per transfer ÷ 8) × (input clock cycles/s ÷ input cycles per transfer)

A 32-bit bus using a 50 MHz input clock and two input cycles per transfer carries 4 × 25×10⁶ = 100 MB/s in a decimal theoretical model. Waiting, arbitration and protocol overhead may reduce useful throughput. DDR-style signaling can use both clock edges, but apply that multiplier only when the transfer rules specify it. Historical PCI uses a shared parallel bus; PCI Express uses serial lanes. Their versions, lane counts and protocols matter more than the superficial “serial versus parallel” label.

Timing and three bus rolesTwo rising edges delimit one clock period. CPU sends addresses and read/write control to memory; a bidirectional data path carries values. A 100 MHz clock has a 10 nanosecond period.1 period100 MHz → 10 nsCPURAMAddressDataControl
Timing and three bus roles. Clock cycles provide timing. Address, data and control have different roles; one cycle need not equal one instruction or one useful bus transfer.Original textbook · p. 48

Main Memory Configuration

Original textbook · pp. 49–52

Memory Devices

Original textbook · pp. 49–51

Semiconductor memory stores state in electronic circuits. MOS/CMOS and bipolar technologies describe device construction; they do not by themselves tell us whether a finished memory is volatile. For the functional distinction, ask how it retains bits and whether power or refresh is needed.

Memory Retention and behavior Typical role
SRAM State-holding circuits; volatile, no periodic refresh while powered Fast caches and small working stores
DRAM Charge-based cells; volatile and periodically refreshed Dense, economical main memory
Mask ROM Contents set during manufacture; nonvolatile Fixed firmware or data
PROM User-programmable once under the specified technology Permanently programmed information
UV-EPROM Erased with ultraviolet light, then reprogrammed Historical reusable firmware storage
EEPROM Electrically erased/reprogrammed; finite endurance Small persistent settings
Flash memory Electrically erasable memory with block erase; nonvolatile Firmware, SSDs and removable storage

“Random access” describes reaching locations without sequentially passing through all earlier ones. It does not mean random contents. Volatile means ordinary stored state is lost when its sustaining power is removed. A flash-based SSD is semiconductor memory, yet is not volatile main DRAM. Cache does not replace the need to understand this distinction.

Two ways to retain a working bitA conceptual DRAM cell connects a data line through a selected transistor to a capacitor, whose charge must be refreshed. SRAM uses feedback to retain state while powered. Both are volatile.DRAM: chargeSelected access switchCapacitor → refresh neededSRAM: feedbackStateFeedbackPower sustains the stored bit
Two ways to retain a working bit. A capacitor stores charge in DRAM; feedback maintains a state in SRAM while power is supplied. These are conceptual models, not transistor-level manufacturing layouts.Original textbook · p. 50

Components of Main Memory

Original textbook · pp. 51–52

Main memory has storage cells, address-selection circuitry and read/write circuitry. A read sends an address, selects the corresponding location and returns its stored value. A write supplies both an address and the new value, with control signals identifying the operation. The address identifies a location; it is not the data stored there.

With a address bits, a simple address space has 2a addressable locations. Capacity also depends on the amount stored at each location. Sixteen address bits and one byte per location give 65,536 bytes, or 64 KiB. If each address selects a two-byte word, the same number of addresses covers 128 KiB. Check the addressing unit rather than assuming one address always means one byte.

An address selects a locationAddress 2 enters a decoder, which selects row 2 from a four-row memory. The selected stored value is hexadecimal A6; the address 2 and data A6 are different.Address bus: binary 10Address decoder0 : 001 : 3F2 : A6 ← selected3 : 18Data bus returns byte A6
An address selects a location. This four-location memory has two address bits and one byte per location: 2² × 8 = 32 bits total. The address is not the byte stored there.Original textbook · p. 51

Capacity Expansion of Main Memory

Original textbook · p. 52

Memory modules combine chips into an appropriate width and number of locations. Historical SIMM and DIMM names refer to module arrangements; adding a module requires matching the system’s supported technology and organization. A removable flash memory card increases storage capacity, not automatically the CPU’s directly usable main RAM.

Worked example. One chip organized as 1M × 8 stores 2²⁰ locations of eight bits, or 1 MiB. Four chips operating side by side can supply a 32-bit word at each location: 1M × 32 = 4 MiB. Two banks of that arrangement double the location count and require eight chips in total. Distinguish widening each access from adding more addresses.

Instruction and Addressing

Original textbook · pp. 52–61

Types and Configuration of Instructions

Original textbook · pp. 52–54

A machine instruction contains an opcode identifying the operation and fields identifying operands, registers or addressing information. Its binary layout is defined by the instruction-set architecture. An operand field might be a literal value, a register number or part of a memory address; interpreting every operand field as a final address is a mistake.

Data-transfer instructions load, store or move values. Arithmetic instructions add or subtract; logical instructions combine or shift bits; comparison and conditional-branch instructions select a path; call and return instructions manage procedure flow. A branch changes which instruction address is used next. An I/O instruction or memory-mapped device access controls an external device under the system’s rules.

The number of explicit operands varies. An accumulator machine can have an implicit operand; a register-register instruction may name two sources and a destination. “One instruction” is not necessarily “one memory access” or “one clock cycle.”

An instruction contains fieldsAn illustrative sixteen-bit instruction has a four-bit opcode, a four-bit register field and an eight-bit operand field. The format is a teaching example, not a particular ISA.Example 16-bit instructionOpcode · 4 bitsRegister · 4 bitsOperand field · 8 bits4 + 4 + 8 = 16 bits
An instruction contains fields. Instruction layout is defined by the ISA. An operand field can encode a literal, register or address information; it is not always a final memory address.Original textbook · p. 53

Execution Sequence of Instructions

Original textbook · pp. 54–57

  1. Fetch
    PC → memory → IR
  2. Decode
    Interpret opcode
  3. Obtain operands
    Registers or memory
  4. Execute and store
    ALU → destination
Original simplified instruction-cycle diagram. Control flow determines the next PC; real implementations may overlap these stages.

Suppose PC=200 and a two-byte instruction at that address means “add the value at address 900 to register R1.” Fetch puts the instruction word into IR and advances the sequential PC to 202 under this model. Decode identifies the addition and addressing mode. Operand fetching obtains memory[900]; the ALU adds it to R1; write-back stores the result. A taken branch would select a different next PC.

The PC and IR therefore contain different kinds of information even during the same instruction. The instruction decoder consumes instruction fields from IR, not the data value produced by an earlier arithmetic operation. Condition flags may change after execution and guide a later branch.

Trace an instruction through the CPUStep 1: PC sends an instruction address to memory. Step 2: memory returns the instruction to IR, which feeds the decoder. Step 3: the decoder directs registers and ALU. Step 4: an operand is read and the ALU result is written back. PC advances or branches separately.Main memoryCPUPCIRDecoderRegistersALUFetch → decode → execute
Trace an instruction through the CPU. PC holds an instruction address; IR holds the fetched instruction. The decoder directs an operation, while the ALU operates on data. Solid paths move addresses/data; the dashed path carries control.Original textbook · pp. 46, 55–57

Addressing Mode

Original textbook · pp. 57–59

The effective address (EA) is the address actually used to access an operand. Let A be an instruction’s address field, M[x] the value stored at memory address x, R an index register and B a base register. Register contents and address fields must use consistent units.

Mode How the operand is found Example with A=40, R=3, B=1,000
Immediate The field is the value itself Operand is 40; no operand-memory address is calculated
Register A named register holds the operand Read that register’s value
Direct EA=A Access M[40]
Indirect EA=M[A] If M[40]=700, access M[700]
Indexed EA=A+R Access M[43]
Base-relative EA=B+A Access M[1,040]
PC-relative EA=the specified PC reference+displacement If reference PC=204 and displacement=−8, EA=196

Indexed access supports repeated elements; base-relative access supports locating a program or data region; PC-relative access supports nearby branches or data references. The PC reference may be defined as the current or next instruction address, so use the problem’s convention. Likewise, an array index may need scaling by element size before it becomes a byte displacement.

Check the indirection. If A=40 and M[40]=700, the immediate operand is 40, a direct load returns 700, and an indirect load returns the value held at address 700. The same number appears in the instruction, but the results need not be equal.

Follow the dereferenceInstruction field A is 40. Immediate mode uses operand 40; direct mode reads M[40], which is 700; indirect mode follows 700 to M[700], which is 12. Indexed addressing with R equal to 3 selects address 43.Field A = 40Immediate → value 40M[40] = 700Direct → value 700M[700] = 12Indirect → value 12Indexed: EA = 40 + 3 = 43
Follow the dereference. Each arrow through a memory box is a dereference. Immediate 40, direct 700 and indirect 12 are three different operands from the same instruction field.Original textbook · pp. 57–59

Interrupt

Original textbook · pp. 59–61

An interrupt or exception causes the processor to suspend its current sequence and run a handler. An external device completion or timer can generate an external interrupt. A running instruction can cause a synchronous exception such as an invalid operation. Names and exact classifications vary by architecture; the essential point is that the processor needs a controlled way to enter a handler and resume safely.

The system saves the necessary PC and status, selects a handler and enters an appropriate privileged execution context. The handler services the event, acknowledges it as required, restores state and returns. An interrupt does not mean that the suspended program starts again at its first instruction.

Interrupt priority ↗ · 1 question determines which eligible handler can run when several events compete. With nested interrupts permitted, a higher-priority handler can preempt a lower-priority one. The lower-priority handler then continues its unfinished work; it does not run its entire original duration again. Masked events may wait until enabled.

Timeline example. A low-priority handler starts at time 0 and needs 3 ms. A high-priority event arrives at 1 ms and needs 0.5 ms. The low-priority handler has completed 1 ms, so 2 ms remain. It resumes at 1.5 and finishes at 3.5 ms. Total handler CPU time is still 3.5 ms if switching overhead is ignored. Mark exact time boundaries before counting how much time the main program receives.

Circuit Configuration of ALU

Original textbook · pp. 61–70

Logic Circuit

Original textbook · pp. 61–66

Boolean logic works with two states. AND is true when both inputs are true; inclusive OR is true when at least one is true; NOT inverts a state. XOR is true when two inputs differ. NAND negates AND, and NOR negates OR. A bubble on a circuit symbol means inversion at that connection.

Logic gates and equivalent circuits ↗ · 5 questions can be compared by evaluating every input combination, rather than judging a drawing’s appearance.

A B A AND B A OR B A XOR B A NAND B A NOR B
0 0 0 0 0 1 1
0 1 0 1 1 1 0
1 0 0 1 1 1 0
1 1 1 1 0 0 0

Useful identities include A AND 1=A, A OR 0=A, A AND 0=0, A OR 1=1, and A XOR A=0. De Morgan’s laws move a negation across an entire group: NOT(A AND B)=(NOT A) OR (NOT B), and NOT(A OR B)=(NOT A) AND (NOT B). Change both the operation and the inputs’ negations; changing only one produces a different function.

Law AND form OR form
Commutative A AND B = B AND A A OR B = B OR A
Associative (A AND B) AND C = A AND (B AND C) (A OR B) OR C = A OR (B OR C)
Distributive A AND (B OR C) = (A AND B) OR (A AND C) A OR (B AND C) = (A OR B) AND (A OR C)
Absorption A AND (A OR B) = A A OR (A AND B) = A

These are alternative circuit descriptions with the same truth values. Parentheses identify the group that an operation or negation applies to.

A two-input multiplexer (MUX) selects one data input. With select S, output Y=(NOT S AND I₀) OR (S AND I₁). If I₀=A and I₁=NOT A, the output is A when S=0 and inverted A when S=1: exactly A XOR S. This is a function derived from the connections, not a rule that every MUX is an XOR gate.

To derive a circuit from a truth table, write one AND term for each row where output=1, using an input or its negation to match that row; OR the terms together. Then simplify with identities and verify the resulting truth table. Naming intermediate outputs makes complemented connections easier to follow.

Read the gate symbolAND has a flat input side, OR a curved input side and XOR an extra curved line. NOT is a triangle with an output bubble. NAND is AND with a bubble; NOR is OR with a bubble. A bubble means inversion.ANDORXORNOTNANDNOR
Read the gate symbol. Gate shape identifies the operation. A small output bubble negates it. Compare the connections with the truth table above; the extra input-side curve distinguishes XOR from OR.Original textbook · pp. 62–64
Construct XOR from two casesInput A and inverted B feed the upper AND gate. Inverted A and B feed the lower AND gate. The two AND outputs feed OR, so Y equals A AND NOT B OR NOT A AND B.ANOT BNOT ABYY = (A AND ¬B) OR (¬A AND B)
Construct XOR from two cases. XOR is true in exactly the two unequal-input cases. The labeled negations are part of the wiring; omitting either changes the function.Original textbook · p. 66

Arithmetic Operation Circuit

Original textbook · pp. 66–70

A half adder adds two one-bit inputs. Its sum is A XOR B, and its carry is A AND B. For 1+1, the result is binary 10: sum 0 and carry 1. A full adder also accepts an incoming carry Cin:

sum = A XOR B XOR Cin
carry = (A AND B) OR (Cin AND (A XOR B))

For A=1, B=0 and Cin=1, sum=0 and carry=1. Connecting stages produces a multi-bit adder; in a simple ripple-carry arrangement a later stage waits for an earlier carry. A flip-flop stores a bit of state, unlike a purely combinational gate whose output depends only on its present inputs. Registers combine state-holding elements.

Full adder: every input combination
ABCarry inSumCarry out
00000
00110
01010
01101
10010
10101
11001
11111

Two’s-complement subtraction reuses addition: A−B=A+(NOT B)+1 within a chosen width. An ALU can select normal or complemented operand bits and use the carry-in for the added one. Separate logic detects conditions such as zero and signed overflow. An adder’s final carry is not automatically the signed-overflow flag.

Feedback stores a stateTwo cross-coupled NAND gates form an active-low SR latch. S_n enters the upper gate and R_n the lower. Q feeds the lower feedback input; Q-bar feeds the upper feedback input. S_n=0 R_n=1 sets Q; S_n=1 R_n=0 resets Q; both one hold; both zero is forbidden.S_nR_nQQ̅S_n R_n: 11 hold · 01 set10 reset · 00 forbidden
Feedback stores a state. Active-low NAND SR latch, matching the source’s NAND convention. The suffix _n marks a low-active input. S_n=R_n=1 holds; 01 sets; 10 resets; 00 forces both outputs high and is forbidden.Original textbook · p. 62
A full adder from two half addersHalf adder 1 takes A and B and gives intermediate sum s1 and carry c1. Half adder 2 takes s1 and carry-in, and gives sum and carry c2. OR combines c1 and c2 into carry-out.A, BHalf adder 1s1c1Carry-inHalf adder 2Sumc2ORCarry-out
A full adder from two half adders. Each half adder computes XOR for its sum and AND for its carry. OR combines the two carry paths: carry-out = AB OR (carry-in AND (A XOR B)).Original textbook · pp. 67–69

High Speed Technologies

Original textbook · pp. 70–77

High Speed Memory Access

Original textbook · pp. 70–74

Registers, cache, main memory and auxiliary storage form a hierarchy balancing speed, capacity and cost. Temporal locality favors recently reused data; spatial locality favors nearby addresses. A cache keeps copies of memory blocks so many accesses can avoid a slower level. A miss continues to the next level; it is not a failure to retain the original file.

For hit probability h and complete hit/miss path times, average access time = h×Thit+(1−h)×Tmiss. If the given miss time is an additional penalty, instead add it to the lookup time with its miss probability. The existing Memory hierarchy & cache focus lesson develops both timing models and preserves its three reviewed questions.

Write-through updates the next level when the cache is written; it simplifies keeping that level current but creates write traffic. Write-back marks a cache block dirty and writes it to the next level when required, often on eviction. A dirty block is modified, not defective. Buffers and coherence mechanisms are important in actual systems, so do not assume every cache uses the same write policy.

Memory interleaving places successive locations in different banks so operations can overlap. If a bank needs several cycles before accepting another access, alternating independent banks can improve the sustained transfer rate. Four banks do not necessarily make every single access four times faster: latency, access patterns, conflicts and bus capacity still matter.

Buffering at different levelsCPU registers connect through primary and secondary cache to main memory, and then through a disk-cache role to storage. A miss continues down the hierarchy; a hit returns earlier. A disk cache may use part of main RAM.RegistersL1 / L2 cacheMain memoryDisk-cache roleStorage device
Buffering at different levels. Each buffer bridges levels with different access costs. A disk cache may occupy main RAM rather than being a separate physical chip. Arrows show a read lookup sequence, not all coherence traffic.Original textbook · pp. 70, 72
Distribute successive addressesFour memory banks contain addresses 0,4,8; 1,5,9; 2,6,10; and 3,7,11. A controller can overlap operations across banks. The bank number is address modulo four in this simplified word-addressed model.Memory controllerBank 0048Bank 1159Bank 22610Bank 33711
Distribute successive addresses. Successive word addresses go to different banks in this simplified mapping. Interleaving can improve sustained throughput; it does not divide every access latency by four.Original textbook · p. 73

Speeding-up of Processor

Original textbook · pp. 74–77

A pipeline overlaps stages of different instructions. It improves throughput when the stages can proceed smoothly; it need not shorten the latency of one instruction. With three one-cycle stages—fetch F, decode D and execute E—four independent instructions take six cycles instead of twelve in an ideal non-overlapped model:

Instruction Cycle 1 2 3 4 5 6
I₁ F D E
I₂ F D E
I₃ F D E
I₄ F D E

This original timing diagram shows filling and draining the pipeline. A data dependency, shared hardware resource or branch can insert stalls or flush work. A super-pipeline splits work into more stages; it can reduce the work per stage but increases the number of stages affected by a disruption.

RISC emphasizes a relatively regular instruction organization, often with simpler load/store operations and fixed-length formats. CISC includes more complex instruction forms and often variable-length encodings. Hard-wired control implements control decisions with circuits; microprogrammed control sequences smaller internal control operations. These are design approaches, not a guarantee that one named family always finishes a program faster. Real implementations can combine techniques.

Superscalar hardware finds opportunities to issue multiple instructions in parallel; VLIW makes parallel-operation groupings more explicit in compiler-generated long instruction words. Out-of-order execution can perform ready operations ahead of blocked ones while preserving the program’s required architectural behavior.

Multicore places multiple processing cores on a chip. Independent tasks can run concurrently, but shared memory, coordination and serial parts of a program limit speedup. If 25% of execution is inherently serial and 75% can be divided perfectly across four cores, the ideal total time relative to one core is 0.25+0.75/4=0.4375, giving speedup about 2.29—not four.

Instruction/data streams Classification Model
One instruction, one data stream SISD A scalar sequential-processing model
One instruction, multiple data streams SIMD Apply the same operation to several vector elements
Multiple instructions, one data stream MISD A less common theoretical classification
Multiple instructions, multiple data streams MIMD Independent processors or cores execute different instruction streams

Use the technique that addresses the actual bottleneck. A deeper pipeline does not increase disk rotation speed, and more cores do not remove a dependency that requires one calculation’s result before another can begin.

A stall delays following workA three-stage pipeline takes a bubble when instruction I2 cannot execute. In cycles 1 through 6, I1 runs F D E; I2 runs F D wait E; I3 runs F wait D E. A deeper pipeline splits stages but still must handle dependencies.Cycles → 1 2 3 4 5 6I1: F D E · · ·I2: · F D wait E ·I3: · · F wait D EDeeper pipeline: smaller stagesF → D1 → D2 → E1 → E2
A stall delays following work. F = fetch, D = decode, E = execute; “wait” is a bubble. Throughput falls when a stage cannot advance. Splitting stages in a super-pipeline does not remove dependencies.Original textbook · pp. 75–76

KEEP LEARNING

Ready to test the idea?

Try 9 related published questions. You can return to this exact place.

Your reading and practice progress stay on this device.

Original explanations, worked examples and diagrams. Topic order and printed-page references follow New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015. Exam images retain original source attribution.