Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

Hardwired control unit: fetch and execute, live

A hardwired control unit produces a CPU's control signals with fixed logic: a step counter says where the processor is in the instruction cycle, and gates combine the step with the opcode to raise the right signals. In this one, step T = 0 is fetch (IR_LD and PC_INC) and step T = 1 is execute, where the opcode OP1 OP0 picks exactly one of ACC_LD, ACC_ADD, MEM_WR or PC_LD.

Every control signal in a CPU is a yes-or-no question: load the instruction register now? Write memory now? In a hardwired design each answer is a logic expression of the current step and the instruction. Here the step is one flip-flop that toggles every clock, so the machine alternates fetch and execute; RST forces fetch. During fetch the instruction register loads the instruction at the program counter's address and the PC moves on. During execute a 2-to-4 decoder on the opcode, ANDed with T, raises one signal: LOAD (00) loads the accumulator from memory, ADD (01) adds into it, STORE (10) writes it to memory, and JMP (11) loads the PC. A microprogrammed control unit gets the same signals differently: it stores them as words in a small control memory and steps through them, which is slower but easier to change, while hardwired logic is faster and is what most simple and RISC processors use. Real machines need more steps (digiwleea's course CPU uses several per instruction), but each extra step is just another state and more gates of the same kind.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

Embed or cite this circuit

Free to embed on a course page, blog or worksheet: paste this code. The circuit stays live, and the small digiwleea badge links back here.

To cite it: digiwleea, “Hardwired control unit”, https://digiwleea.wleeaf.dev/tools/build/hardwired-control-unit/

What you need

Step by step

  1. Place a clock CLK, inputs RST, OP1 and OP0, one D flip-flop for the step, and probes for T and the six control signals.
  2. Step counter: feed NOT T AND NOT RST back into the flip-flop's D, so T alternates 0, 1, 0, 1 and returns to 0 on reset.
  3. Fetch signals: IR_LD and PC_INC are simply NOT T, active in step 0.
  4. Execute signals: decode OP1 OP0 with four ANDs (one per opcode) and AND each with T. Turn RST off and watch the signals take turns as T toggles; change the opcode to pick a different execute signal.

Fetch and execute, step by step

Clock edgeRSTOpcodeTStepActive signals
1100 (LOAD)0fetchIR_LD, PC_INC
2000 (LOAD)1executeACC_LD
3000 (LOAD)0fetchIR_LD, PC_INC
4001 (ADD)1executeACC_ADD
5001 (ADD)0fetchIR_LD, PC_INC
6010 (STORE)1executeMEM_WR
7010 (STORE)0fetchIR_LD, PC_INC
8011 (JMP)1executePC_LD
9011 (JMP)0fetchIR_LD, PC_INC
10001 (ADD)1executeACC_ADD
11101 (ADD)0fetchIR_LD, PC_INC
12010 (STORE)1executeMEM_WR
13010 (STORE)0fetchIR_LD, PC_INC

This is the exact run checked before the page is built, on T and all six control signals after each of the 13 clocks: each instruction gets a fetch and an execute step, and a reset during execute (edge 11) sends the unit straight back to fetch. The live circuit opens held in reset, because the step flip-flop starts in an unknown state. Hardwired control is traditionally the RISC choice and microcode the CISC one; see RISC vs CISC.

You can also read the full theory in the lesson on the control unit. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

More builds: Registers and counters

All 246 build guides, by topic

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the Hardwired control unit in the lab →

Frequently asked

What is a hardwired control unit?

A control unit whose control signals come from fixed logic gates: a step counter tracks the stage of the instruction cycle, and combinational logic combines the step with the opcode to produce each signal.

What is the difference between hardwired and microprogrammed control units?

A hardwired unit computes the control signals with gates, which is fast but fixed. A microprogrammed unit stores them as microinstructions in a control memory and steps through them, which is slower but easier to change or extend.

What does the control unit do in a CPU?

It reads the current instruction and the step of the instruction cycle and raises the signals that make the rest of the processor act: load a register, add, write memory, change the program counter.

Why does the control unit need a step counter?

Most instructions take several clock cycles, such as fetch, then decode and execute, and different signals are needed in each. The step counter (or a state machine) says which cycle it is.