0% found this document useful (0 votes)
115 views14 pages

Gate Level Modeling in Verilog

The document discusses gate level modeling in Verilog HDL. It introduces basic gate primitives like AND, OR, NOT etc. and how to model combinational logic circuits using gates. It also explains how to call one module inside another using port mapping and provides an example of implementing a 2:1 multiplexer at gate level.

Uploaded by

Maison Kids
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views14 pages

Gate Level Modeling in Verilog

The document discusses gate level modeling in Verilog HDL. It introduces basic gate primitives like AND, OR, NOT etc. and how to model combinational logic circuits using gates. It also explains how to call one module inside another using port mapping and provides an example of implementing a 2:1 multiplexer at gate level.

Uploaded by

Maison Kids
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Course Instructor: Ms.

Saba Zia
Gate Level Modeling
CLO3, PLO3

3/26/2021 1
Introduction
 Structural Modeling ~ Gate level Modeling
 Equivalent to schematic diagram
 Structural model is created from built-in primitives or user-defined
primitives
 Built-in Verilog primitives are basic gates built into the Verilog language

3/26/2021 2
Introduction to Verilog
Keywords Module Name Input and Output Ports (write outputs
first for better programming practice)

Port Declaration

(write outputs first)

Instance name

3/26/2021 3
Built-in Primitives (Gate Types)
Single output but  module logic_cct (a, b, out);
extendable inputs
Detect error in the
code with respect
input a, b; to execution of
statements and
output out; rectify it
and ins2and (out ,a, b);
nand ins2nand (out , a, b);
or ins2or (out ,a, b);
nor ins2nor (out , a, b);
xor ins2xor (out ,a, b);
xnor ins2xnor (out , a, b);
xnor ins3xnor (out , a, b, c);
endmodule
3/26/2021 4
Truth Tables

3/26/2021 5
Built-in Primitives (Gate Types)
 These primitives have
one scalar input but
extendable outputs.
 Buf
 (pass-through
primitive)

 Not
 (inverter primitive)

3/26/2021 6
3/26/2021 7
Conditional Buf/Not

3/26/2021 8
3/26/2021 9
Gate Delays
 Physical circuits exhibit propagation delay
 Therefore, sometimes necessary to specify delays only in simulation

and #(30) G1(w1,A,B);


not #(10) G2 (E,C);
or #(20) G3 (D,w1,E);

3/26/2021 10
Examples- Gate Level Modeling
 module logic_cct (out,a, b, c, d);
input a,b,c,d;
a
output out; w3
b w1
w4
wire w1,w2,w3,w4;
out
and ins1(w1,a,b);
c
and ins2(w2,c,d); d w2 logic_cct.v
not ins3(w3,w1);
xor ins4(w4,w3,w2);
not ins5(out,w4);
endmodule

3/26/2021 11
Calling a Module into
another Module - out
Port Mapping w a
w3
x b w1
 Positional Mapping w4

module port_mapping(out, w, x, y, z); out


y c
input w,x,y,z; w2
z d logic_cct
output out;
logic_cct ins_logic (out, w, x, y, z); port_mapping.v
endmodule

 Named Mapping
module port_mapping(out, w, x, y, z);
input w,x,y,z;
output out;
logic_cct ins_logic (.out(out),.a(w), .b(x), .c(y), .d(z));
endmodule 3/26/2021 12
Multiplexer Implementation (Gate level)- 2X1 MUX
A X A X1 X0 X
0 X0 0 0 0 0 X = A’ . X0 + A . X1
1 X1 0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
not ins1 (w1,A);
w1
w2 not ins2 (w2,w1);
w3
and ins3 (w3,w2,X1);
and ins4 (w4,w1,X0);
w4 or ins5 (X,w3,w4);
3/26/2021 13
Task
 Design 4X1 MUX using 2X1 MUX and write its Verilog HDL code using gate
level modeling.

3/26/2021 14

You might also like