Fdocuments - in - Chapter 2 Structural Chapter 2 Structural Modeling Digital System Designs and
Fdocuments - in - Chapter 2 Structural Chapter 2 Structural Modeling Digital System Designs and
Objectives
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-2
Chapter 2: Structural Modeling
Structural Modeling
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-3
Chapter 2: Structural Modeling
Gate Primitives
and/or gates
have one scalar output and multiple scalar inputs
are used to realize the basic logic operations
include
and or xor nand nor xnor
buf/not gates
have one scalar input and one or multiple scalar outputs
are used to realize the not operation,
are used to buffer the output of an and/or gate,
are used as controlled buffers
include
buf not bufif0 notif0 bufif1 notif1
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-4
Chapter 2: Structural Modeling
and/nand Gates
i1 i1
i2 out i2 out
i2 i2
and nand
0 1 x z 0 1 x z
0 0 0 0 0 0 1 1 1 1
1 0 1 x x 1 1 0 x x
i1
i1
x 0 x x x x 1 x x x
z 0 x x x z 1 x x x
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-5
Chapter 2: Structural Modeling
or/nor Gates
i1 i1
i2 out i2 out
i2 i2
or nor
0 1 x z 0 1 x z
0 0 1 x x 0 1 0 x x
1 1 1 1 1 1 0 0 0 0
i1
i1
x x 1 x x x x 0 x x
z x 1 x x z x 0 x x
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-6
Chapter 2: Structural Modeling
xor/xnor Gates
i1 i1
i2 out i2 out
i2 i2
xor xnor
0 1 x z 0 1 x z
0 0 1 x x 0 1 0 x x
1 1 0 x x 1 0 1 x x
i1
i1
x x x x x x x x x x
z x x x x z x x x x
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-7
Chapter 2: Structural Modeling
buf/not Gates
in out in out
in out in out
0 0 0 1
1 1 1 0
x x x x
z x z x
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-8
Chapter 2: Structural Modeling
bufif0/notif0 Gates
in out in out
ctrl ctrl
ctrl ctrl
bufif0 notif0
0 1 x z 0 1 x z
0 0 z L L 0 1 z H H
1 1 z H H 1 0 z L L
in
in
x x z x x x x z x x
z x z x x z x z x x
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-9
Chapter 2: Structural Modeling
bufif1/notif1 Gates
in out in out
ctrl ctrl
ctrl ctrl
bufif1 notif1
0 1 x z 0 1 x z
0 z 0 L L 0 z 1 H H
1 z 1 H H 1 z 0 L L
in
in
x z x x x x z x x x
z z x x x z z x x x
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-10
Chapter 2: Structural Modeling
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-11
Chapter 2: Structural Modeling
Array of Instances
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-12
Chapter 2: Structural Modeling
c2
c_out
c3
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-13
Chapter 2: Structural Modeling
i1 y1
out
i2 y2
module mux4_to_1_structural (i0, i1, i2, i3, s1, s0, out);
input i0, i1, i2, i3, s1, s0; i3 y3
output out;
wire s1n, s0n; // Internal wire declarations
wire y0, y1, y2, y3;
// Gate instantiations s1 s0
not (s1n, s1); // Create s1n and s0n signals.
not (s0n, s0);
and (y0, i0, s1n, s0n); // 3-input and gates instantiated
and (y1, i1, s1n, s0);
and (y2, i2, s1, s0n);
and (y3, i3, s1, s0);
or (out, y0, y1, y2, y3); // 4-input or gate instantiated
endmodule
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-14
Chapter 2: Structural Modeling
x[0] c
x[1]
g
ep
x[2] d
x[3]
i
x[4] e
x[5]
h
op
x[6] f
x[7]
x[8]
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-15
Chapter 2: Structural Modeling
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-16
Chapter 2: Structural Modeling
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-17
Chapter 2: Structural Modeling
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-18
Chapter 2: Structural Modeling
x a x
f
y 2 4 6 8 10 12 14 16 18 20
y
b
2 4 6 8 10 12 14 16 18 20
b
wire a; 2 4 6 8 10 12 14 16 18 20
and #4 (b, x, y); // Inertial delay
a
and #4 (a, x, y);
not #1 (f, a); 2 4 6 8 10 12 14 16 18 20
f
Inertial delay 2 4 6 8 10 12 14 16 18 20
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-19
Chapter 2: Structural Modeling
x a
f
y
x
b 2 4 6 8 10 12 14 16 18 20
y
2 4 6 8 10 12 14 16 18 20
wire #2 a; // Transport delay b
and #4 (b, x, y); // Inertial delay 2 4 6 8 10 12 14 16 18 20
and #4 (a, x, y);
not #1 (f, a); a
2 4 6 8 10 12 14 16 18 20
Inertial delay f
Transport delay 2 4 6 8 10 12 14 16 18 20
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-20
Chapter 2: Structural Modeling
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-23
Chapter 2: Structural Modeling
1 0 1 0 1 0 0 1 0 1 1 0 1 0
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-24
Chapter 2: Structural Modeling
x
module hazard_static (x, y, z, f); t pd
input x, y, z; y t pd
output f;
x'
// internal declaration
wire a, b, c; // internal net
z t pd
// logic circuit body
and #5 a1 (a, x, y); t pd
not #5 n1 (c, x); a
t pd t pd
and #5 a2 (b, c, z); t pd t pd
b
or #5 o2 (f, b, a); t pd
t pd t pd
endmodule f
Hazard
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-25
Chapter 2: Structural Modeling
x=y=z=1
e
dynamic hazard
f
Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 2-26