Beruflich Dokumente
Kultur Dokumente
language ".
KARTHIK . S
Lecturer/ECE
S.N.G.C.E
Karthik.S S.N.G.C.E
CONTENTS
Introduction. Structural Modeling
History of Verilog. Verilog behavioral
Design and Tool Flow. modeling.
What is Verilog HDL. Procedural Timing
Controls.
Verilog HDL
language elements. Tasks and Function.
System
My First Program in Verilog. Tasks and
Functions.
Verilog data flow Modeling.
Art of writing test
benches.
Karthik.S S.N.G.C.E
Introduction.
◙Verilog is a HARDWARE DESCRIPTION LANGUAGE
(HDL).
simple flip-flop.
◙This just means that, by using a HDL one can describe any
☻Verilog simulator was first used beginning in 1985 and was extended
Gateway.
☻After many years, new features have been added to Verilog, and new version is
CONTENTS
Karthik.S S.N.G.C.E
INTRODUCTION
Karthik.S S.N.G.C.E
LOW LEVEL DESIGN
RTL CODING
☻In RTL coding, Micro Design is converted into Verilog/VHDL
code, using synthesizable constructs of the language.
Karthik.S S.N.G.C.E
SIMULATION
☻Simulation is the process of verifying the functional
characteristics of models
☻We use simulators to simulate the Hardware models.
☻To test if the RTL code meets the functional requirements of
the specification, see if all the RTL blocks are functionally
correct.
SYNTHESIS
☻Simulation is the process in which the synthesis tools takes the
RTL code to the target technology.
☻It maps RTL codes to the gates & primitives and do minimal
amount of timing analysis.
☻Example: Xillinx ISE, QuatrusII. CONTENTS
Karthik.S S.N.G.C.E
MY Ist PROGRAM
• If we refer to any text book on programming language it starts
with “HELLO WORLD” program. I start with
“WELCOME” program.
// Design name: Welcome to FDP @ SNGCE
initial begin
end
endmodule
CONTENTS
Karthik.S S.N.G.C.E
VERILOG HDL
• Single language for design & Simulation.
• Three types of modeling
1. DATAFLOW
2. STRUCTURAL
3. BEHAVIORAL
• Built-in primitives & logic functions
• Built-in data types
• User defined primitives.
Karthik.S S.N.G.C.E
BASIC UNIT-MODULE
• Modules communicates externally with input & output.
• A module can be instantiated into other module.
Karthik.S S.N.G.C.E
EXAMPLE
gates. CONTENTS
Karthik.S S.N.G.C.E
VERILOG SYNTAX
• Verilog is free-format language. White space can be used
freely.
• Verilog is CASE Sensitive
• User provided names are called identifiers and should start
with a “letter” or “_” example: CONUT_1
• Predefined identifiers are called keywords. All keywords are
lower case. Example: assign, module, begin, end, etc.,
• Comments- two forms: /* first form*/ & // second form
• Value set: 1(high), 0(low), X(unknown), Z(high impedance).
•
Karthik.S S.N.G.C.E
NUMBER REPRESENTATION
• <size><base format><number>
Examples:
Karthik.S S.N.G.C.E
DATA TYPES
NETS:
Karthik.S S.N.G.C.E
INTRODUCTION
Karthik.S S.N.G.C.E
DELAYS
Karthik.S S.N.G.C.E
OPERATORS
Karthik.S S.N.G.C.E
EXAMPLE
module half_adder (sum,cout,a,b,cin);
input a, b, cin;
output sum, cout;
endmodule
Karthik.S S.N.G.C.E
EXAMPLE 2 2X1 MUX
module mux_2 ( y, s, a, b);
input s, a, b;
outputy;
assign y = s?a : b; // if s=0 y=a else y=b
endmodule
CONTENTS
Karthik.S S.N.G.C.E
STRUCTURAL
Karthik.S S.N.G.C.E
GATE LEVEL MODELING
Karthik.S S.N.G.C.E
4X1 MUX
module mux_4 (y,s0,s1,a,b,c,d);
input a,b,c,d,s0,s1;
output y;
not n1(s0bar,s0); // gate instantiation starts here
not n2(s1bar,s1);
and a1(t0,s0bar,s1bar,a);
and a1(t1,s0bar,s1,b);
and a1(t2,s0,s1bar,c);
and a1(t3,s0,s1,d);
or o1(y,t0,t1,t2,t3);
endmodule
Karthik.S S.N.G.C.E
UER DEFINED PRIMITIVES
Karthik.S S.N.G.C.E
EXAMPLE
module RCA ( sum, cout, a, b, cin);
input [3:0] a, b;
output[3:0] sum;
input cin;
output cout;
input x,y,c;
output s, cy;
endmodule
Karthik.S S.N.G.C.E
Karthik.S S.N.G.C.E
CONTENTS