Master the fundamental concepts of digital logic & boolean algebra through this focused micro-challenge.
A 4-bit register is four D flip-flops sharing one clock and one write-enable. On each rising edge, when EN=1, all four D inputs copy into Q outputs simultaneously. When EN=0, the register holds its value.
cLoading…
Registers are the fastest storage a CPU touches: reading R3 in your toy emulator should be a single-cycle operation, unlike RAM.
Four bits can hold values 0 through 15. That is enough for a nibble of BCD, a counter in an embedded timer, or the program counter in a minimal teaching CPU.
For this exercise, you will stitch four D flip-flops into one loadable register and verify parallel writes. This task asks you to treat the register as the bridge between combinational logic (adders, MUXes) and sequential state machines in the hardware simulator ahead.
Keep the relevant datasheet, ISA manual, or architecture textbook chapter open while you implement. When your output disagrees with the reference trace on the same program, the bug is usually a mis-decoded opcode, a stale register read, or a flag bit left unchanged after arithmetic.
For this exercise, you will use those habits while implementing the requirement in the starter code. Microarchitectural product names change across CPU generations, but the control ideas (fetch, bypass, cache lines, vector lanes) stay stable enough to debug from first principles.
Build a 4-bit register using D flip-flops.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github