
A Hardware Description Language (HDL) is a specialized computer language used to describe, design, model, and simulate digital hardware circuits . HDLs allow engineers to represent hardware...
A Hardware Description Language (HDL) is a specialized computer language used to describe, design, model, and simulate digital hardware circuits. HDLs allow engineers to represent hardware at different levels of abstraction—behavioral, structural, and register-transfer level (RTL).
Common HDLs:
Verilog is a hardware description language used to model digital electronic systems. It enables designers to describe hardware using text-based code and is widely used for RTL design, logic synthesis, and digital simulation.
Verilog is similar in syntax to the C programming language, making it easy to learn.
Verilog allows design at multiple levels:
Example:
always @(a or b)
c = a + b;
Example:
always @(posedge clk)
q <= d;
Example:
and(a1, x, y);
Example:
nmos(out, in, control);
A module is the basic building block in Verilog used to represent a hardware component.
Example:
module AND_gate (input a, input b, output y);
assign y = a & b;
endmodule
These are inputs/outputs of a module:
inputoutputinoutwire → for combinational connectionsreg → for storage elements (flip-flop behavior)integer, real → used in testbenchesVerilog supports:
&&, ||, !&, |, ^+, -, *, /==, !=Used for continuous assignments in combinational logic.
Example:
assign y = a & b;
Defines procedures that execute when signals change.
always @(*)
y = a + b;
always @(posedge clk)
q <= d;
Runs only once during simulation (not synthesizable).
Example:
initial begin
a = 0;
b = 1;
end
Example: 2-to-1 Multiplexer
module mux2to1(input a, input b, input sel, output y);
assign y = sel ? b : a;
endmodule
always @(posedge clk)
q <= d;
always @(posedge clk or posedge reset) begin
if (reset)
count <= 0;
else
count <= count + 1;
end
A testbench is a Verilog module written to simulate and verify the functionality of a design. It does not represent real hardware and cannot be synthesized.
Key components:
initial blocks$monitor, $display)Example:
module testbench();
reg a, b;
wire y;
AND_gate uut(a, b, y);
initial begin
a = 0; b = 0;
#10 a = 1;
#10 b = 1;
#10 $finish;
end
endmodule
Verilog is used to design:
Every modern processor is described and verified using an HDL like Verilog.
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.