Salta al contenuto
Note per Studenti Hardwired and Microprogrammed Control Report

Hardwired and Microprogrammed Control

In questa pagina 5
In questa pagina 3

The control unit reads the opcode (and other fields) of the instruction and generates the control signals that drive the datapath (Fetch-Execute Cycle and DatapathThe registers PC, IR, MAR and MBR, the fetch and execute phases and the four kinds of action, the full instruction-cycle state diagram with interrupt check, a worked accumulator-machine example, and the datapath of a simple RISC core with single-cycle and multicycle timing.Fetch-Execute Cycle and Datapath →): which registers to read and write, which operation the ALU performs, whether memory reads or writes, which inputs the multiplexers select, how the PC is updated. Each phase of the instruction cycle is a sequence of micro-operations (register transfers in one clock cycle).

Control signals of a single-cycle datapath

Definition (control signals, single-cycle datapath).

Instruction RegDst ALUSrc MemtoReg RegWrite MemRead MemWrite Branch ALUOp
arithmetic (R) 1 0 0 1 0 0 0 from funct field
load 0 1 1 1 1 0 0 add
store X 1 X 0 0 1 0 add
branch X 0 X 0 0 0 1 subtract

X = don't care (the value does not matter because the result is not used: a store writes no register). Each column is a Boolean function of the opcode bits: a combinational network.

Example. For a store, RegWrite =0=0 and MemWrite =1=1: no register is written, data memory is. RegWrite is 11 for arithmetic and load, 00 for store and branch.

Hardwired control

Property (hardwired control). The signals are produced by logic circuits:

  • combinational, in the single-cycle datapath (table above);
  • finite-state machine, in the multicycle datapath: the state is the current step (fetch, decode, ...), the outputs are the signals of that step, and the next-state function depends on the opcode.

Fast, but hard to design and to modify when instructions are many and complex. Used in RISC processors.

Microprogrammed control

Definition (microprogrammed control). Idea (Wilkes, 1951): the signals of each step form a bit word, the microinstruction, stored in a control memory (ROM). Each machine instruction corresponds to a microprogram.

Operation: a microsequencer with a control-address register reads a microinstruction, sends its bits as signals to the datapath and computes the address of the next one (sequential, conditional jump, or jump to the start of the microprogram indicated by the opcode).

Format Characteristics
horizontal one bit per signal: many bits (even hundreds), maximum parallelism, no decoding
vertical signals encoded in fields (e.g. 4 bits choose one of 16 ALU operations): short microinstructions, decoding needed, less parallelism

Example. To choose among 1616 ALU operations a vertical microinstruction uses log⁡216=4\log_216=4 bits, a horizontal one 1616 bits (one per operation).

Comparison

Hardwired Microprogrammed
speed higher lower (one control-memory access per step)
design and debugging difficult simple: rewrite the microcode
complex instructions awkward natural
typical use RISC (ARM, MIPS) historic CISC; x86 for the most complex instructions

Common mistakes

  • Thinking the microcode is written by the programmer: it is part of the processor and invisible to the ISA.
  • Treating the signal table as a sequential network: in the single-cycle case it is purely combinational.

Versione ripasso

The control unit turns the opcode into datapath signals (Fetch-Execute Cycle and DatapathThe registers PC, IR, MAR and MBR, the fetch and execute phases and the four kinds of action, the full instruction-cycle state diagram with interrupt check, a worked accumulator-machine example, and the datapath of a simple RISC core with single-cycle and multicycle timing.Fetch-Execute Cycle and Datapath →): registers read/written, ALU operation, memory read/write, multiplexer selects, PC update.

Single-cycle signals

Instr. RegDst ALUSrc MemtoReg RegWrite MemRead MemWrite Branch
arithmetic 1 0 0 1 0 0 0
load 0 1 1 1 1 0 0
store X 1 X 0 0 1 0
branch X 0 X 0 0 0 1

ALUOp: funct field, add, add, subtract. X = don't care. Each column is a Boolean function of the opcode: combinational.

Hardwired

Logic circuits: combinational (single cycle) or finite-state machine (multicycle: state = step, next state depends on opcode). Fast, hard to modify; used in RISC.

Microprogrammed

Microinstruction (signal word) stored in a control memory (ROM); each machine instruction = a microprogram; a microsequencer (control-address register) reads a microinstruction, drives the datapath and computes the next address (sequential, conditional jump, or start of the microprogram of the opcode).

  • Horizontal: one bit per signal, wide, parallel, no decoding.
  • Vertical: encoded fields (16 ALU operations: 4 bits instead of 16), short, needs decoding.
Hardwired Microprogrammed
speed higher lower
design/fixes hard rewrite microcode
complex instructions awkward natural
use RISC historic CISC, complex x86 instructions

Common mistakes: microcode is not written by the programmer (invisible to the ISA); the single-cycle signal table is combinational, not sequential.

Teoria collegata