Elements of Computing Systems - Sequential Logic and Memory Systems
System Hierarchy and Course Roadmap
- Hardware Platform Hierarchy:
- Elementary Logic Gates (Level 1): Built directly from primitive
Nandgates. - Combinational Chips (Level 2): Intermediate arithmetic and logical units including Adders, Multiplexers, and the Arithmetic Logic Unit (
ALU). - Sequential Logic & Memory System (Level 3): Construction of clocked memory components ranging from 1-bit Flip-Flops up to multi-kilobyte Random Access Memory (
RAM) banks and Program Counters (PC). - Computer Architecture (Level 4): Integration of the
CPU,RAM, and input/output devices into a unified hardware platform. - Software Layer Hierarchy (Levels 5 & 6): Translating low-level machine instructions via Assemblers and Compilers up to high-level virtual machines and operating system abstractions.
- Elementary Logic Gates (Level 1): Built directly from primitive

- Prerequisite Topics Covered:
- Binary and decimal number systems.
- Binary arithmetic operations (Addition, Subtraction, 2's complement representation).
- Elementary logic gates (
AND,OR,NOT,XOR,NAND). - Boolean function evaluation and simplification.
- Arithmetic Logic Unit (
ALU) functional design. - Combinational circuit design principles.
- Half-Adders and Full-Adders.
- Multiplexers (
Mux) and Demultiplexers (DMux).
Fundamental Theoretical Framework of Logic Circuits
- Combinational Logic Framework:
- Definition: Logic circuits where the output is strictly a pure mathematical function of its present input signals.
- Mathematical Model:
* **Characteristics:**
* Time-independent operations.
* Output changes continuously and instantaneously in response to input changes (ignoring physical component delays).
* The Arithmetic Logic Unit (`ALU`) represents the topmost complex combinational chip.
* **Inherent Limitations of Combinational Logic:**
* **Lack of Persistence:** Cannot store state or maintain bits over time.
* **Feedback Restriction:** Feedback loops (feeding a chip's output directly back into its input) are strictly forbidden because they create indeterminate physical oscillation state conditions.
* **Fixed Input Width:** Gates can only process inputs of fixed bit-widths (e.g., an `Or4` gate cannot process arbitrary -bit streams without dedicated hardware redesign).
- Sequential Logic Framework:
- Definition: Logic circuits whose output depends on both present inputs and historical input sequences (state history).
- Mathematical Model:
* **Characteristics:**
* Incorporates physical time dependencies into gate evaluations.
* Enables state persistence over discrete time intervals.
* Forms the foundational model for Registers, Memory banks, Flip-Flops, and Counters.
Physical Time, Delays, and the Synchronization Clock
- Software Requirements for Time:
- State Persistence (Variables): Software requires persistent state holding (e.g., variable assignment ).
- Iterative Execution (Loops): Reusing identical physical hardware repeatedly across sequential loop cycles:
for i = 1..100:
sum = sum + i
* Accumulating values across iterations requires reading previous states () to calculate new states ().
- Hardware Requirements for Time:
- Physical Time Delay: Real electrical components exhibit delay due to finite switching speeds, semiconductor resistance, and stray capacitance.
- Propagation Delay (): The physical duration required for an electrical signal transition at the input terminal to traverse circuit path gates and fully stabilize at the output terminal.

* **Ripple Carry Propagation Example:** In a multi-bit ripple-carry adder, Full Adder stage cannot produce a valid carry-out signal () until it receives the carry-out () from stage . The total propagation delay accumulates linearly across the adder length:
- The Master Clock and Discrete Time:
- Physical Clock Generator: A hardware oscillator circuit (e.g., a crystal oscillator circuit utilizing quartz resonance properties) generating an continuous rectangular voltage pulse train.

* **Discrete Time Model:** Converts continuous physical time into integer steps ().
* **Clock Cycle Period ():** The time duration between two consecutive rising or falling edges of the clock signal.
* **Clock Frequency ():** Reciprocal of the clock period, measured in Hertz ():
* **Neutralizing Delays via Clock Cycle Engineering:**
* Analog signal transitions exhibit non-zero rise and fall times, creating unstable voltage intermediate phases.
* **Cycle Length Constraint:** The system clock period must be engineered to exceed the maximum total internal propagation delay plus computation delay of any sub-circuit:
* State changes are sampled exclusively at discrete integer transitions (), completely isolating internal intermediate propagation noise (represented inside gray cycle start windows).

* **Chip Diagram Symbolism:** Clock input signals are explicitly denoted on functional block diagrams by a small triangle icon () on the chip boundary.
Fundamental Sequential Building Blocks
- Data Flip-Flop (DFF):
- Definition: The foundational 1-bit bistable physical memory element that outputs the input received during its previous clock cycle.
- Functional Equation:
* **Classification of Flip-Flop Types:**
* Set-Reset (`SR`) Flip-Flop
* Data/Delay (`D`) Flip-Flop
* `JK` Flip-Flop
* Toggle (`T`) Flip-Flop
* **Native Implementation:** Primitive `DFF` gates are built physically using cross-coupled `NAND` or `NOR` logic gate latches, but serve as built-in primitive building blocks for higher-level HDL construction.
- 1-Bit Register (
BitChip):- Motivation: A standard
DFFunconditionally overwrites its state at every clock tick. A true register must retain its internal bit indefinitely across time steps until explicitly commanded to store a new bit. - Internal Circuit Construction: Formed by combining a
DFFwith a 2-to-1 Multiplexer (Mux) and a dedicatedloadcontrol line.MuxInput ( selection line): Connected to the feedback line originating directly from theDFFoutput line (out), representing state persistence.MuxInput ( selection line): Connected to the external data input pin (in), representing new state load.MuxSelector Signal: Connected directly to theloadcontrol signal.
- Formal Behavioral Specification:
- Motivation: A standard
* **State Transition Table / Logic:**
- General Sequential Logic Architecture Paradigm:
- Complex sequential systems consist of an array of clocked state elements (
DFFbanks) combined with pure combinational logic blocks configured in a continuous state-feedback topology.
- Complex sequential systems consist of an array of clocked state elements (

Multi-Bit Registers and Memory Architectures
Multi-Bit Register Architecture (-bit Register):
- Definition: An array of individual 1-bit
Bitchips connected in parallel sharing a single unifiedloadsignal line. - Standard Word Width (): Typically , , or bits. (The Hack platform specifies ).
- Functional Interface:
in[w]: -bit data input line.load: 1-bit write-enable signal line.out[w]: -bit stored state output line.
- Operational Protocol:
- Read Operation: Continuously probe
outbus; output emits stored internal state instantly. - Write Operation: Apply value to input bus
in, assertload = 1. On the next rising clock edge (), internal state transitions to , andoutemits .
- Read Operation: Continuously probe
- Definition: An array of individual 1-bit
Memory Hierarchy Abstraction:
DFFBit(1-bit Register) -bit RegisterRAM8RAM64RAM512RAM4KRAM16K.

- Random Access Memory (
RAM) Systems:- Definition: A contiguous sequential sequence of addressable, -bit registers where any individual register location can be accessed directly in constant time ().
- Address Line Calculation: The required address bus width for an -register RAM module is:
* **Why "Random Access"?** The access delay time to read or write any memory address is completely identical and constant, independent of physical geometric position relative to index .
- Direct Access Switching Logic:
- Write Decoding (Demux Routing): A -to- Demultiplexer (
DMux) takes the masterloadinput pin and routes it exclusively to the target register matching the provided -bit address binary vector. All unselected registers receiveload = 0. - Read Multiplexing (Mux Selection): An -to- Multiplexer (
Mux) takes the -bit output buses of all registers, outputting exclusively the output bus of register dictated by the -bit address input line.
- Write Decoding (Demux Routing): A -to- Demultiplexer (

The Hack 16-Bit RAM Family:
RAM8: registers, bits, address bits.RAM64: registers, bits, address bits (composed ofRAM8chips).RAM512: registers, bits, address bits (composed ofRAM64chips).RAM4K: registers, bits, address bits (composed ofRAM512chips).RAM16K: registers, bits, address bits (composed ofRAM4Kchips).
Recursive Addressing Scheme:
- To address an -register RAM block built from sub-RAM blocks, split the -bit address input field into two distinct sub-fields:
- High-order 3 bits (
address[k-3..k-1]): Fed to a 3-bitDMux8WayandMux8Way16to select the exact sub-RAM bank. - Low-order bits (
address[0..k-4]): Routed directly to all sub-RAM blocks simultaneously to select the exact internal register index inside that bank.
- High-order 3 bits (
- To address an -register RAM block built from sub-RAM blocks, split the -bit address input field into two distinct sub-fields:
Program Counter (PC) Design
Role in Computer Architecture: A dedicated -bit register situated inside the CPU that maintains the physical memory address of the next machine code instruction scheduled for fetch and execution.
Core Abstractions Supported:
- Reset: Set counter output to address zero (Fetch initial program boot instruction):
- Next / Increment: Increment internal counter state by one integer step (Sequential execution):
- Goto / Load: Overwrite counter state with external address input (Unconditional/Conditional Jump execution):
- Hold State: Retain present memory instruction pointer value:
Strict Control Line Priority Order:
- Formal Control Logic Specification:
if reset(t) then out(t+1) = 0
else if load(t) then out(t+1) = in(t)
else if inc(t) then out(t+1) = out(t) + 1
else out(t+1) = out(t)
- Implementation Strategy: Constructed internally using a standard 16-bit Register, a 16-bit Combinational Incrementer (
Inc16), and three cascaded 16-bit Multiplexers (Mux16) structured sequentially to enforce control signal priority.
Standard Data Measurement Units
- Data Units Reference Specifications:
| Unit | Abbreviation | Decimal Value | Binary Value | Decimal Size |
|---|---|---|---|---|
| Bit | b | or | or | of a byte |
| Byte | B | bits | bits | byte |
| Kilobyte | KB | bytes | bytes | bytes |
| Megabyte | MB | bytes | bytes | bytes |
| Gigabyte | GB | bytes | bytes | bytes |
| Terabyte | TB | bytes | bytes | bytes |
| Petabyte | PB | bytes | bytes | bytes |
| Exabyte | EB | bytes | bytes | bytes |
| Zettabyte | ZB | bytes | bytes | bytes |
| Yottabyte | YB | bytes | bytes | bytes |
Project 3 Hardware Construction Guidelines
Available Primitives:
- All combinational chips developed in Project 1 and Project 2.
- Built-in Data Flip-Flop (
DFF) primitive.
Required Target Hardware Specifications:
Bit.hdl(1-bit Register)Register.hdl(16-bit Register)PC.hdl(16-bit Program Counter)RAM8.hdl(8-register 16-bit RAM)RAM64.hdl(64-register 16-bit RAM)RAM512.hdl(512-register 16-bit RAM)RAM4K.hdl(4096-register 16-bit RAM)RAM16K.hdl(16384-register 16-bit RAM)
Directory Structure Organization:
- Sub-folder
projects/03/a: ContainsBit,Register,PC, andRAM8files. - Sub-folder
projects/03/b: ContainsRAM64,RAM512,RAM4K, andRAM16Kfiles.
- Sub-folder
HDL Optimization & Simulation Rules:
- Follow strict top-down dependency sequence when constructing files.
- Minimize total gate/component count per chip for maximum throughput efficiency.
- For simulation execution and consistency, call the system built-in versions of previously created lower-level chips rather than custom HDL sub-files.
Complete Hack Chip Set API Specifications
Add16(a= , b= , out= )ALU(x= , y= , zx= , nx= , zy= , ny= , f= , no= , out= , zr= , ng= )And16(a= , b= , out= )And(a= , b= , out= )Aregister(in= , load= , out= )Bit(in= , load= , out= )DFF(in= , out= )DMux4Way(in= , sel= , a= , b= , c= , d= )DMux8Way(in= , sel= , a= , b= , c= , d= , e= , f= , g= , h= )DMux(in= , sel= , a= , b= )Dregister(in= , load= , out= )FullAdder(a= , b= , c= , sum= , carry= )HalfAdder(a= , b= , sum= , carry= )Inc16(in= , out= )Keyboard(out= )Memory(in= , load= , address= , out= )Mux16(a= , b= , sel= , out= )Mux4Way16(a= , b= , c= , d= , sel= , out= )Mux8Way16(a= , b= , c= , d= , e= , f= , g= , h= , sel= , out= )Mux8Way(a= , b= , c= , d= , e= , f= , g= , h= , sel= , out= )Mux(a= , b= , sel= , out= )Nand(a= , b= , out= )Not16(in= , out= )Not(in= , out= )Or16(a= , b= , out= )Or8Way(in= , out= )Or(a= , b= , out= )PC(in= , load= , inc= , reset= , out= )PCLoadLogic(cinstr= , j1= , j2= , j3= , load= , inc= )RAM16K(in= , load= , address= , out= )RAM4K(in= , load= , address= , out= )RAM512(in= , load= , address= , out= )RAM64(in= , load= , address= , out= )RAM8(in= , load= , address= , out= )Register(in= , load= , out= )ROM32K(address= , out= )Screen(in= , load= , address= , out= )Xor(a= , b= , out= )CPU(inM= , instruction= , reset= , outM= , writeM= , addressM= , pc= )