Lecture 04 - Logic Simulation
Lecture 04 - Logic Simulation
True-value means that the simulator will compute the response for given input stimuli without
injecting any faults in the design. The input stimuli are also based on the specification.
A frequently used strategy is to exercise all functions with only critical data patterns. This is
because the simulation of the exhaustive set of data patterns can be too expensive
8/13/2023 2
8/13/2023 3
Simulation is used in this way for verifying very large electronic systems.
The weakness of this method is its dependence on the designer’s heuristics used
in generating the input stimuli.
8/13/2023 4
Note: This optimization is possible because of same blocks (FA) being used
8/13/2023
and each test vector verifying similar faults in all blocks 5
8/13/2023 6
8/13/2023 7
8/13/2023 8
endmodule
8/13/2023 9
8/13/2023 10
This is the lowest level and represents the ultimate in accuracy for the simulation of
electronic systems. The circuit is assumed to be composed of electrical elements such
as resistors, capacitors, inductors, and transistors. Equations relating branch or loop
currents and node voltages are developed and solved by numerical methods
8/13/2023 11
8/13/2023 12
If both control inputs are turned on, If both control inputs are turned on, as,
Results in High Currents the 1 input will dominate.
8/13/2023 13
8/13/2023 14
Z = ABCD
module Sample (
input A, B, C, D,
output Z,
inout w1, w2, w3 );
and g1(w1,A,B);
and g2 (w2, C,D);
and g3 (Z,w1,w3);
endmodule
15
Z = ABCD
initial begin
A = 0;
B = 0;
C = 0;
D = 0;
#10;
A = 1;
B = 1;
C = 1;
D = 1;
#10;
$finish;
end
16
Z = ABCD
Z = AB+CD
module Sample (
input A, B, C, D,
output Z,
inout w1, w2, w3 );
and g1(w1,A,B);
and g2 (w2, C,D);
or g3 (Z,w1,w3);
endmodule
18
Z = AB+CD
initial begin
A = 0;
B = 0;
C = 0;
D = 0;
#10;
A = 1;
B = 1;
C = 1;
D = 1;
#10;
$finish;
end
19
module mux_2_1(
input sel,
input i0, i1,
output y);
assign y = sel ? i1 : i0;
endmodule
21
module tristate_buffer(
input x,
input enable,
output y);
assign y = enable? x : 'bz;
endmodule
22
module Mux_using_buffer
(input x1,x2,s1,s2,
output y);
tristate_buffer g1 (x1,s1,y);
tristate_buffer g2 (x2,s2,y);
endmodule
23
24
25
Simulation
Testing
26
27
28
29
30
1. Circuit Simplification
2. Circuit Levelized
3. Signals are treated as variables in the code
4. For every input vector, the code is repeatedly executed until all variables
have attained steady values
5. Compiled-code simulators are very effective where two-state (0,1)
simulation suffices
6. Timing are not modeled in a compiled-code simulator
31
Circuit Simplification
33
34
35
36
Zero delay
Nominal delay Event-driven Faster then CC
Data structure
It is based on the recognition that any signal change (event) must have
a cause, which is also an event. Thus, an event causes new events, which in turn may
cause more events. An event-driven simulator follows the path of events.
Gates whose inputs now have events are called active and are placed in
an activity list. The simulation proceeds by removing a gate from the activity list
and evaluating it to determine whether its output has an event.
38
39
G3 taken
as 1
G2 taken
as 1
G2 taken
as 0
42
43