Skip to the content.

Week 12: Registers and memory elements

🏠 Home · Prev: Week 11 · Next: Week 13

Goal. Group flip-flops into registers, the small fast storage the MCU uses for its working values. The MCU’s RA and RB are registers built exactly this way.

A flip-flop is a 1-bit register

One D flip-flop stores one bit: load it on the clock edge, and it holds that bit until the next edge.

1-bit register

▶ Open in LogicLab

An n-bit register

Put n D flip-flops side by side, all sharing one clock, and you store an n-bit word in one tick. Add a load/enable line (gate the clock or multiplex the input with the current value) so the register only updates when you ask it to. The MCU’s registers A and B are 4-bit registers with exactly this enable.

Shift registers

Chain the flip-flops instead, feeding each output into the next one’s input. On every clock the data shifts one position along the chain.

4-bit shift register

▶ Open in LogicLab

Serial in, serial out turns one wire into many over several clocks (and back), which is how a few pins drive many outputs. Parallel-load and parallel-out variants exist too.

Mealy and Moore machines

A sequential machine’s outputs can be defined two ways, and these are the two categories you should recognise:

We do not design with formal state-machine diagrams beyond the truth-table method of Week 10; knowing the two categories is enough.

Try it yourself (optional)

Build a 4-bit shift register from D flip-flops, clock it from the Arduino, and watch a single 1 walk along the outputs on the logic analyser. See the Lab Annex.

Check yourself