Combinational & Sequential Logic
Master the fundamentals of digital logic design from basic gates to complex sequential circuits.
π― Fundamental Concepts
Combinational Logic Circuits
BeginnerLogic circuits where outputs depend only on current inputs, with no memory elements.
Key Topics:
- β’Logic gates (AND, OR, NOT, NAND, NOR, XOR)
- β’Truth tables and logic expressions
- β’Multiplexers and demultiplexers
- β’Encoders and decoders
- β’Adders and arithmetic circuits
Truth Table:
A | B | AND | OR | XOR | NAND --|---|-----|----|----|----- 0 | 0 | 0 | 0 | 0 | 1 0 | 1 | 0 | 1 | 1 | 1 1 | 0 | 0 | 1 | 1 | 1 1 | 1 | 1 | 1 | 0 | 0
Verilog Example:
// 4-to-1 Multiplexer
module mux_4to1 (
input logic [3:0] data_in,
input logic [1:0] select,
output logic data_out
);
always_comb begin
case (select)
2'b00: data_out = data_in[0];
2'b01: data_out = data_in[1];
2'b10: data_out = data_in[2];
2'b11: data_out = data_in[3];
endcase
end
endmoduleSequential Logic Circuits
IntermediateCircuits with memory elements where outputs depend on both inputs and previous state.
Key Topics:
- β’Flip-flops (D, JK, T, SR types)
- β’Latches vs flip-flops
- β’Counters (binary, ring, Johnson)
- β’Shift registers
- β’State machines and memory
Truth Table:
D FF | Clk | Q(next) -----|-----|-------- 0 | β | 0 1 | β | 1 X | 0/1 | Q(prev)
Verilog Example:
// 4-bit Counter with Load
module counter_4bit (
input logic clk, rst_n,
input logic load, enable,
input logic [3:0] load_data,
output logic [3:0] count
);
always_ff @(posedge clk or negedge rst_n) begin
if (!rst_n)
count <= 4'b0000;
else if (load)
count <= load_data;
else if (enable)
count <= count + 1;
end
endmoduleArithmetic Circuits
IntermediateDigital circuits performing mathematical operations like addition, subtraction, and multiplication.
Key Topics:
- β’Binary addition and subtraction
- β’Half adder and full adder
- β’Ripple carry vs carry lookahead
- β’Multipliers (array, Booth)
- β’ALU design principles
Truth Table:
Full Adder A | B | Cin | Sum | Cout --|---|-----|-----|----- 0 | 0 | 0 | 0 | 0 0 | 0 | 1 | 1 | 0 0 | 1 | 0 | 1 | 0 1 | 1 | 1 | 1 | 1
Verilog Example:
// 4-bit Ripple Carry Adder module ripple_carry_adder_4bit ( input logic [3:0] a, b, input logic cin, output logic [3:0] sum, output logic cout ); logic [2:0] carry; // Full adder instances full_adder fa0 (.a(a[0]), .b(b[0]), .cin(cin), .sum(sum[0]), .cout(carry[0])); full_adder fa1 (.a(a[1]), .b(b[1]), .cin(carry[0]), .sum(sum[1]), .cout(carry[1])); full_adder fa2 (.a(a[2]), .b(b[2]), .cin(carry[1]), .sum(sum[2]), .cout(carry[2])); full_adder fa3 (.a(a[3]), .b(b[3]), .cin(carry[2]), .sum(sum[3]), .cout(cout)); endmodule // Full Adder Module module full_adder ( input logic a, b, cin, output logic sum, cout ); assign sum = a ^ b ^ cin; assign cout = (a & b) | (cin & (a ^ b)); endmodule
ποΈ Common Design Examples
Traffic Light Controller
FSM-based traffic light system with timing control
Inputs:
Outputs:
8-bit ALU
Arithmetic Logic Unit with multiple operations
Inputs:
Outputs:
Frequency Divider
Clock frequency division by programmable factor
Inputs:
Outputs:
Priority Encoder
8-to-3 priority encoder with valid output
Inputs:
Outputs:
π οΈ Digital Design Tools
Logic Simulator
Simulate and verify digital logic circuits
Key Features:
- βWaveform viewing
- βTiming analysis
- βTest vectors
- βCoverage analysis
Popular Tools:
Logic Synthesis
Convert RTL to gate-level netlists
Key Features:
- βTechnology mapping
- βOptimization
- βTiming constraints
- βArea/power trade-offs
Popular Tools:
Timing Analysis
Verify timing requirements and constraints
Key Features:
- βSetup/hold checking
- βClock analysis
- βCritical paths
- βSlack reporting
Popular Tools:
π Hands-On Tutorials
Building Your First Counter
Step-by-step guide to designing a simple binary counter
Concepts Covered:
Designing a Simple ALU
Create an 8-bit ALU with basic arithmetic and logic operations
Concepts Covered:
Advanced Sequential Circuits
Design complex counters and state machines
Concepts Covered:
Ready to Master Digital Logic Design?
Practice with interactive exercises and build real digital circuits from scratch.