Verilog Fundamentals
Verilog Fundamentals
Verilog Fundamentals
Shubham Singh
Junior Undergrad.
Electrical Engineering
VERILOG FUNDAMENTALS
HDLs HISTORY
HOW FPGA & VERILOG ARE
RELATED
CODING IN VERILOG
HDLs HISTORY
HDL – HARDWARE DESCRIPTION LANGUAGE
EARLIER DESIGNERS USED BREADBOARDS
FOR DESIGNING
SOLDERLESS
BREADBOARD
PRINTED CIRCUIT
BOARD
HDLs ENABLED LOGIC LEVEL SIMULATION
AND TESTING
GATE LEVEL
DESCRIPTION
SIMULATE
MANUAL
THEN DESIGNERS BEGAN TO USE HDLs
FOR HIGHER LEVEL DESIGN
BEHAVIOURAL SIMUALTE
ALGORITHM
MANUAL
REGISTER SIMULATE
TRANSFER
LEVEL
MANUAL
SIMULATE
GATE LEVEL
MANUAL
HDLs LED TO TOOLS FOR AUTOMATIC
TRANSLATION
BEHAVIOURAL SIMULATE
ALGORITHM
MANUAL
SIMULATE
REGISTER
TRANSFER LEVEL
LOGIC SYNTHESIS
SIMULATE
GATE LEVEL
BEHAVIOURAL
C,C++ MATLAB
VERILOG
COMPILERS ARE NOT
AVAILABLE TO CONVERT
BEHAVIOURAL LEVEL TO
REGISTER TRANSFER
LEVEL STRUCTURAL
VERILOG
LOGIC SYNTHESIS
GATE
LEVEL
MUX 4 : GATE LEVEL DESIGNING
modulemux4(input a,b,c,d, input[1:0] sel, output out);
wire[1:0] sel_b;
not not0( sel_b[0], sel[0] );
not not1( sel_b[1], sel[1] );
wire n0, n1, n2, n3;
and and0( n0, c, sel[1] );
and and1( n1, a, sel_b[1] );
and and2( n2, d, sel[1] );
and and3( n3, b, sel_b[1] );
wirex0, x1;
nor nor0( x0, n0, n1 );
nor nor1( x1, n2, n3 );
wirey0, y1;
or or0( y0, x0, sel[0] );
or or1( y1, x1, sel_b[0] );
nand nand0( out, y0, y1 );
endmodule
MUX 4 : REGISTER TRANSFER LEVEL
endmodule
VERILOG & FPGAs
VERILOG
Verilog
is a HARDWARE DESCRIPTION
LANGUAGE.
HDLs are used to describe a digital system
Nota programming language despite the
syntax being similar to C
Synthesized (analogous to compiled for C)
to give the circuit logic diagram
FPGAs
• DEFINING MODULE
• Name: 4029
• Input Ports: One
• Output Ports: Four
• Size
• Driver type
• Internal Logic: At every rising edge of the
clock, increment the output by one
MODULE
Syntax
always @(condition)
begin
//Code
end
Blocks starting with keyword always run
simultaneously.
@ symbol is used to specify the condition which
should be satisfied for the execution of this block.
Usage of always block
always
always @(a)
The code in this block will be executed every time
the value of a changes.
It
is an abstraction provided in Verilog to
mainly implement sequential circuits.