Fundamentals 12 min read

From Light‑Bulb Signals to a Full ALU: Step‑by‑Step Construction of Digital Logic Circuits

This article narrates how two friends transform secret light‑bulb blink codes into binary representations, then progressively design logic gates, adders, a full‑adder, RAM, an ALU and a programmable control unit, illustrating the fundamentals of digital circuit design and automation.

Refining Core Development Skills
Refining Core Development Skills
Refining Core Development Skills
From Light‑Bulb Signals to a Full ALU: Step‑by‑Step Construction of Digital Logic Circuits

1. Encoding and Circuit – Signal Conversion

When their parents confiscated their phones, the two friends invented a secret communication method by representing Chinese characters with the on/off states of a light bulb, reading the pattern once per second.

They used this simple encoding to continue chatting without sound.

2. Gate Circuits – Signal Association

By adding two switches that must both be closed for the bulb to light, they introduced logical relationships, defining input (switches) and output (bulb) as binary 1 (connected) or 0 (disconnected). They abstracted this as a gate circuit , specifically an AND gate , and represented connections with binary 1 and 0.

The truth table for the AND gate is shown in the following table:

Input A

Input B

Output

0

0

0

0

1

0

1

0

0

1

1

1

They later created an OR gate and discovered that any logical relationship they could imagine could be built from such gates.

3. Adders – Signal Computation

They explored binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10, and built a truth table for a one‑bit adder.

Combining an XOR gate and an AND gate yielded a half‑adder , which computes the sum and carry for a single bit.

By adding another half‑adder and an OR gate , they constructed a full‑adder capable of handling the carry from the previous bit.

Connecting multiple full‑adders created an eight‑bit adder, which can perform any arithmetic operation when combined with other components.

4. Clock – Signal Oscillation

They built a self‑feedback circuit where one switch’s closure causes the other to toggle repeatedly, producing a continuous oscillation that they called a clock or oscillator , generating a regular clock signal.

5. RAM – Signal Storage

To store binary values, they designed a one‑bit latch that holds the output after a control pulse, then combined several latches with decoders and selectors to form an 8‑bit RAM module, capable of random read/write.

By scaling the design, they created larger RAM arrays such as a 1024 × 8 memory (1 KB).

They also built a manual control panel with switches for address, data, and write signals, allowing direct interaction with the memory.

6. Program – Automation

Integrating a 10‑bit counter (clock‑driven) as an address generator, the ALU, and RAM, they implemented an automatic accumulator that sums a sequence of numbers stored in RAM.

The process runs without human intervention: the counter steps through addresses, the ALU adds the current value to the accumulated result, and the latch stores the intermediate sum.

7. Program Instructions

To gain finer control, they introduced an instruction RAM containing commands such as add , nop , and halt . A control unit reads these instructions and enables or disables the latch write, ALU addition, or counter increment accordingly.

This allows selective accumulation, conditional execution, and graceful termination of the computation.

Finally, they note that by defining a richer instruction set and corresponding control logic, any computational task can be automated, completing the journey from simple light‑bulb signaling to a fully programmable computing machine.

RAMadderALUbinarydigital logicgate circuits
Refining Core Development Skills
Written by

Refining Core Development Skills

Fei has over 10 years of development experience at Tencent and Sogou. Through this account, he shares his deep insights on performance.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.