Table of Contents
Overview#
Digital circuits form the foundation of modern computing, from simple logic gates to complex processors and memory systems.
Hierarchical Design Structure#
Physical Layer (Silicon)
↓
Transistor Level (NMOS/PMOS)
↓
Logic Gates (AND, OR, NOT)
↓
Functional Blocks (ALU, Registers)
↓
Processor / Memory ArchitectureProgramming Languages#
| Level | Language | Use Case |
|---|---|---|
| High-level | C, Python | Software, algorithms |
| Low-level | Verilog, VHDL | Hardware description (RTL) |
Transistor Basics#
NMOS and PMOS#
In digital circuits, transistors function as discrete switches, not amplifiers.
| Type | Conducting When | Symbol |
|---|---|---|
| NMOS | Gate = HIGH (1) | n-channel |
| PMOS | Gate = LOW (0) | p-channel |
CMOS Inverter#
VDD
|
[PMOS]
|
Input ---+--- Output
|
[NMOS]
|
GNDRTL Design Process#
RTL = Register Transfer Level
- Behavioral Description - High-level functionality
- Synthesis - Convert to gate-level
- Placement & Routing - Physical layout
- Timing Analysis - Verify timing constraints
Verilog Basics#
Module Definition#
module my_module (
input wire clk,
input wire reset,
input wire [7:0] data_in,
output reg [7:0] data_out
);
// Module logic here
endmodulePort Connections#
Positional:
my_module inst1 (clk, reset, din, dout);Named (Recommended):
my_module inst1 (
.clk(system_clk),
.reset(sys_reset),
.data_in(input_data),
.data_out(output_data)
);Blocking vs Non-Blocking#
| Assignment | Symbol | Use Case |
|---|---|---|
| Blocking | = | Combinational logic |
| Non-blocking | <= | Sequential logic |
Combinational Logic:
always @(*) begin
y = a & b; // Blocking
z = y | c; // Executes after y
endSequential Logic:
always @(posedge clk) begin
q <= d; // Non-blocking
q2 <= q; // Both execute simultaneously
endTiming Concepts#
Propagation Delay#
Time for signal to travel through a gate:
- Rise time (t_r)
- Fall time (t_f)
- Propagation delay (t_pd)
Clock Skew#
Problem: Clock arrives at different times due to:
- Wire length differences
- External noise
- Temperature variations
Solution: Phase-Locked Loop (PLL)
- Synchronizes clock distribution
- Compensates for skew
- Generates clean clock edges
Design Tips#
- Use non-blocking for flip-flops - Prevents race conditions
- Synchronize inputs - Use double-flip-flop for async signals
- Reset all registers - Ensure known initial state
- Avoid latches - Use complete if-else or case statements