NivaarExam PrepOfficial exam papers ↗

22-Elec-A4 Digital Systems and Computers · May 2016

Question 5 of 6: Computer system components, microcontrollers and CPU registers

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Paper format. National Exams, May 2016 — 07-Elec-A4 Digital Systems & Computers. Three hours, closed book, one approved Casio or Sharp calculator. Six questions, each worth 12 points; five questions constitute a complete exam. A flip-flop excitation table and a list of Boolean identities are printed on the last page. Every one of the six questions is solved below, because the set is intended as a study resource rather than an exam script.

Reference texts. M. Morris Mano & M. D. Ciletti, Digital Design (6th ed.), ch. 3 (map simplification, prime implicants, hazards), ch. 5–6 (sequential logic, counters); J. F. Wakerly, Digital Design: Principles and Practices (5th ed.), §3.7 (three-state outputs), §4.4 (timing hazards and consensus terms), ch. 8 (counters); C. Hamacher, Z. Vranesic, S. Zaky & N. Manjikian, Computer Organization and Embedded Systems (6th ed.), ch. 1–2 (processor structure, registers), ch. 3 (memory-mapped I/O).

Check: segment-to-pin assignment in Question 6. Figure 6.1 shows the buffer chip driving the eight segment lines a…h from Port B pins PB7–PB0, but does not print which pin drives which segment. Throughout Question 6 the conventional weighting a = PB0, b = PB1, …, g = PB6, h = PB7 (decimal point) is assumed and stated explicitly, exactly as the paper's own rubric invites ("the candidate is urged to submit…a clear statement of any assumptions made"). Every bit pattern below is derived from that one assumption; a different pin order permutes the bits but changes no part of the method.

Question 5: Computer system components, microcontrollers and CPU registers (12 points)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. The question starts from a list of nine candidate items, of which exactly four are the essential components of any stored-program computer, and asks separately about the microprocessor/microcontroller distinction and about four standard CPU register roles.

Find. The four essential components marked from the list; the substantive architectural differences between a general-purpose microprocessor and a microcontroller; and the register associated with each of four described functions.

Approach. Part (a) is settled by asking of each item whether a machine could execute a stored program without it. Parts (b) and (c) are recall questions answered from the standard von Neumann model of processor organisation.

  1. Part (a): mark the four essential components. The test is not whether an item is useful but whether the fetch–decode–execute cycle can proceed without it. A stored-program machine must be able to hold instructions and data, to fetch and execute them, to move information between those two, and to reach the outside world — giving exactly four:
    Essential components of a computer system
    Item from the listEssential?Reason
    Processor (CPU)Xfetches, decodes and executes instructions; contains the ALU and the registers
    MemoryXholds the program and its data — the defining feature of a stored-program machine
    Busses (address, data, control)Xthe interconnect that carries addresses, data and timing/control between the other blocks
    I/O portsXthe interface through which the machine communicates with the outside world
    Mouse—an input peripheral attached through an I/O port
    Keyboard—an input peripheral attached through an I/O port
    Printer—an output peripheral
    Display monitor—an output peripheral
    Hard drive—secondary storage — a block-addressed peripheral, not main memory
    $$\boxed{\text{CPU},\ \text{Memory},\ \text{Busses},\ \text{I/O ports}}$$ The hard drive is the item most often mismarked. It stores information, but the processor cannot execute from it directly; its contents must first be transferred into main memory, and it is reached through an I/O interface exactly like any other peripheral.
  2. Part (b): microprocessor versus microcontroller. The distinction is one of integration and of intended application rather than of instruction-set capability.
    General-purpose microprocessor compared with a microcontroller
    AspectGeneral-purpose microprocessorMicrocontroller
    IntegrationCPU only; memory, I/O and timers are separate external chipsCPU, RAM, ROM/Flash, I/O ports, timers and often ADCs on a single die — a “computer on a chip”
    Busesaddress and data buses brought out to pins for external expansionbuses largely internal; pins are devoted to I/O rather than to memory expansion
    Memory sizelarge external memory, gigabytes, with cache and virtual memory supportsmall on-chip memory, typically kilobytes, with no MMU
    Typical peripheralsnone on-chip; provided by a chipsettimers, PWM, ADC, UART, SPI, I²C and interrupt controller on-chip
    Design objectivemaximum throughput and generality; runs an operating systemreal-time control, low cost, low power, deterministic response; often bare-metal
    Bit handlingword-oriented instruction setbit-level set/clear/test instructions on port pins
    Applicationdesktop, server, general computingembedded control — appliances, instrumentation, automotive, the display driver of Question 6
    In one sentence: a microprocessor is a processor that needs a system built around it, whereas a microcontroller is the system, optimised for controlling something rather than for computing quickly.
  3. Part (c): identify the registers. Each description names a standard architectural register:
    CPU registers and their roles
    Description in the questionRegisterFunction
    the address of the next instruction to be executedProgram Counter (PC), also called the instruction pointerincremented automatically after each fetch; loaded directly by jumps, branches and subroutine calls
    the next available location at the top of the stackStack Pointer (SP)adjusted by PUSH/POP and by subroutine call and return, which save and restore the return address
    pointing to an array or list of data values in memoryIndex register (X or Y on a 68HC-family part; a general-purpose pointer register elsewhere)supports indexed addressing, so a single instruction can be re-used to walk successive elements
    information used at decision-making points (conditional branches)Condition Code Register (CCR), also called the status or flags registerholds the N, Z, V and C flags set by the ALU; conditional branch instructions test these bits
    $$\boxed{\text{PC},\quad \text{SP},\quad \text{Index register (X/Y)},\quad \text{Condition Code / status register}}$$ Note that the accumulator, though the most-used register of all, answers none of these four descriptions — it holds operands and results, not addresses or status.

The three parts are more closely linked than they first appear. The four essential components of part (a) are precisely what a microcontroller integrates onto one die in part (b), and the registers of part (c) are the internal state that lets the CPU of part (a) sequence a program at all: the PC drives the fetch, the index register drives data access, the CCR drives control flow, and the SP makes subroutines possible.

Question 5 — final results
QuantityResult
(a) essential componentsProcessor (CPU), Memory, Busses (address/data/control), I/O ports
(a) not essentialMouse, Keyboard, Printer, Display monitor, Hard drive (all peripherals)
(b) key differenceMicroprocessor = CPU alone needing external memory and I/O; microcontroller = CPU + memory + I/O + timers on one chip, for embedded real-time control
(c) next instruction addressProgram Counter (PC)
(c) top of stackStack Pointer (SP)
(c) pointer to an array/listIndex register (X or Y)
(c) conditional-branch informationCondition Code Register (status/flags: N, Z, V, C)