SlideShare a Scribd company logo
1 of 43
EVENT DRIVEN SIMULATION
WHY?
WHAT?
HOW?
1
WHY HDL
I THINK “ WE “ are the reason behind the invention of
this language.
2
Needs are
small
Circuit are
small
Leads to
increase in
Circuit
complexity
to Draw
Schemetic of
more than 600
gates is not
possible for us
Leads to the
development
of EDA TOOLS
Can be drawn by using
boolean algebra , k
map etc
Now man wants
more features in
their devices
Requirement
of a
automation
tool is
required
Use to design
circuits
comprises of
millions of
transistors
Example Synopsys,
Cadence Design
Systems ,Chrysalis
Hardware Description
Languages
Special-purpose languages
special constructs for hardware description
timing, concurrency, bit vectors, etc.
can usually include structural description
examples
 Verilog
 VHDL
Standard programming languages
add data types and objects for hardware
description
examples
 C
 C++
 Matlab
4
 Simulation is the process of conducting experiments on a
model of a system for the purpose of understanding or
verifying the operation of the actual system.
 In simple words it means
1. Take the input
2. Process the input
3. Output
 Simulation in the VHDL/PLD methodology:
 Functional verification verifies the functional operation
of a description.
 Post-synthesis simulation verifies that the synthesizer
accurately translated the description to logic.
 Timing simulation verifies that the synthesized logic,
when mapped to the target PLD, will meet the system’s
requirements.
Types of simulations:
1. Behavioral: use the system as black box.
2.Functional: checks the functionality and ignores
timing and just include unit delay.
3.Timing : system is partitioned into asic and timing
analysis is done. This is called static timing analysis
because outputs and inputs values are placed and then
timing is done.
4. Logic / gate level: logic cell is taken and its timing
and performance is done.
5. Switch level: models transistor as switches.
6.Transistor level: it requires models of transistor
describing their nonlinear voltage and current
characteristics(varitions).
Classification of Simulators
Logic Simulators
Emulator-based Schematic-basedHDL-based
Event-driven Cycle-based Gate System
Classification of Simulators
HDL-basedHDL-based: Design and testbench described
using HDL
Event-driven
Cycle-based
Schematic-basedSchematic-based: Design is entered graphically
using a schematic editor
EmulatorsEmulators: Design is mapped into FPGA hardware
for prototype simulation. Used to perform
hardware/software co-simulation.
8
 VHDL is an event-driven language.
 A VHDL simulator must provide data structures and
algorithms that allow it to efficiently simulate the
execution of concurrent statements in a VHDL
program.
 Simulator's sequential execution must be able to
provide the illusion of concurrency.
 Changes in input and output signals occur in
simulation time: the time value maintained by the
simulator, as opposed to real time.
 There are three common kinds of simulators:
 time driven
 event driven
 cycle based (for simulation of sequental systems)
9
HOW
Simulation Algorithms
Compiled simulation
 logic equations compiled to code
 execute code - fast
 works well with zero and unit delay models
 difficult with general timing models
 no use of latency, multi-rate behavior
Event-driven simulation
 input changes cause evaluation of model, scheduling of output change event
 use timing models to determine new event times
 output change evaluated at scheduled time
 advantage
 real circuits have 10-30% activity
 dormant parts of circuit are not evaluated
Event-driven Simulation
Event: change in logic value at a node, at a certain
instant of time → (V,T)
Event-driven: only considers active nodes
Efficient
Performs both timing and functional verification
All nodes are visible
Glitches are detected
Most heavily used and well-suited for all types of
designs
Event-Driven Logic
Simulation
Evaluate gate when inputs change
use logic model to compute new output value
use timing model to compute when output will
change
Schedule an output change event
store the event on a time-sorted event queue
Process events from the queue
output change evaluated at scheduled time
causes new events to be scheduled
5
5
7
5
5
5
0
0
0
1->0
(0)
0
1
1
1
0->1
(5)
1->0
(12)
1->0
(10)
Event-Driven Logic
Simulation
1. t=X: Schedule PI:1->0 at t=0
2. t=0: PI changes 1->0
Evaluate A, schedule A:0->1 at t=5
4. t=5: A changes 0->1
Evaluate B, schedule B:1->0 at t=10
Evaluate C, schedule C:1->0 at t=12
5. t=10: B changes 1->0, output
6. t=12: C changes 1->0, output
5
5
7
5
5
5
0
0
0
1->0
(0)
0
1
1
1
0->1
(5)
1->0
(12)
1->0
(10)
A
B
C
An event-driven VHDL example
process (count)
begin
my_count <= count;
trigger <= not trigger;
end process;
process (trigger)
begin
if (count<=15) then
count <= count + 1 after 1ns;
else
count <= 0 after 1ns;
end if;
end process;
Block
1
Block 2
Each process:
- loops forever
- waits for change in signal
from other process
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's simulate:
a=11
b=01
Time = 0ns
(step1)
Red Boxes : evaluate
in current step
1
1
1
0
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 0ns
(step2)
1
1
1
0 1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 0ns
(step3)
1
1
1
0 1 1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 0ns
(step4)
1
1
1
0 1 1 1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 1ns
(step1)
1
1
1
0 1 1 1
1
1
1
1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 1ns
(step2)
1
1
1
0 1 0 1
1
1
1
1
1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 1ns
(step3)
1
1
1
0 1 0 0
1
1
1
1
1
1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 1ns
(step4)
1
1
1
1
0 1 0 0
1
1
1
1
1
1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
Let's
simulate:
a=11
b=01
Time = 1ns
(step5)
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
s(1)
sum_out(1)
and
and
or
or
=>
=>
sum_out(0)
carry_out
1
1
1
1
0 1 0 0
1
1
1
1
1
1
1
A more hardware-oriented example
s(0) <= a(0) xor b(0) after 2ns;
c(0) <= a(0) and b(0) after 1ns;
s(1) <= a(1) xor b(1) xor c(0) after 2ns;
c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns;
sum_out(1 to 0) <= s(1 to 0);
carry_out <= c(1);
and
a
b
and
xor
s(0)
c(0)
xor
xor
=>
c(1)
carry_out
and
and
or
or
=>
=>
sum_out(0)
carry_out
Let's
simulate:
a=11
b=01
Time = 1ns
(step5)
1
1
1
1
0 1 0 0
1
1
1
1
1
1
1
That's enough - you get the point
The statement-(process-) dependencies define a network.
Changes are dynamically propagated through the network
Simulation
Algorithm
while (HaveEvents())
event = NextEvent(); /* time-sorted order
*/
currenttime = event->time; /* update global time
*/
event->gate->output = event->output/* change gate output
*/
print output if it is primary output;
for (all gates g in event->gate fan-out list)
newoutput = EvalGate(g); /* new gate output */
newtime = currenttime + g->delay; /* when it changes */
ScheduleEvent(g, newoutput, newtime);
Event Queue
Implementation
Events must be processed in time order
 event queue must sort by time
Must be able to delete events
 cancel obsolete events on a gate
Implementations
 priority queue
 O(logN) time to insert/delete for N-item queue
 many implementations - AVL tree, heap, etc.
 problem: N is often large
 bucket queue - time wheel
 divide time into time quanta Q, e.g. 1ps
 circular buffer of N entries 1 quantum in size
 can store events Q*N into future
 events beyond buffer go into unsorted far list
 O(1) time to insert, nearly so for delete
Event-driven
Simulation
Uses a timewheel to manage the relationship between
components
TimewheelTimewheel = list of all events not processed yet,
sorted in time (complete ordering)
When event is generated, it is put in the appropriate
point in the timewheel to ensure causality
Event-driven
Simulation
b(1)=1
d(5)=1
D=1
1
0
1
0
1
D=2
a
b
c
d(5)=1
d
5
0
1
e
0
1
3
c(3)=0
d(5)=1
0
1
4
d(5)=1
e(4)=0
6
e(6)=1
Time
Wheel
0
1
i-1
i
i+1
999
event event
curtime
curtime+999ps
curtime+1ps
time wheel of time quantums
all events scheduled for
a given time quantum
Wheel only needs to be big enough to hold most variation in gate delays
Time Wheel
Operation
Insertion
if (eventtime - curtime >= WHEELLENGTH*quantum)
insert event into far list
else
insert at wheel[eventtime % (WHEELLENGTH*quantum)]
Deletion
i = curtime % (WHEELLENGTH*quantum)
while (wheel[i] == NULL)
if (i == WHEELLENGTH-1)
i = 0; timebase += (WHEELLENGTH*quantum);
for all events in far list
if (eventtime - timebase < WHEELLENGTH*quantum) insert
event into wheel
else i++
remove first event from wheel[i] list and
return it
32
The LRM (Language Reference Manual) defines how an
event-driven simulator must execute the VHDL.
Simulator vendors implement this concepts.
An event-driven simulator performs three steps to
accomplish a simulation:
1) elaboration
2) initialization
3) repeated execution of simulation cycles
33
Elaboration
Elaboration is the creation of a simulation model for a
design entity from its VHDL description. This simulation
model consists of a net of simulation processes.
During elaboration, all concurrent statements are
converted to equivalent simulation processes.
VHDL semantics: initialization
At the beginning of initialization, the current time, Tc is 0 ns.
 The … effective value of each explicitly declared signal are computed,
and the current value of the signal is set to the effective value. …
 Each ... process … is executed until it suspends.
 The time of the next simulation cycle (… in this case … the 1st cycle), Tn
is calculated according to the rules of step f of the simulation cycle,
below.
VHDL semantics: The simulation
cycle (1)
According to the standard, the simulation cycle is as
follows:
a) Stop if Tn= time‘high
and “nothing else is to be done” at Tn.
The current time, Tc is set to Tn.
?
VHDL semantics: The simulation
cycle (2)
b) Each active explicit signal in the model is
updated. (Events may occur as a result.)
Previously computed entries in the queue are now assigned if their
time corresponds to the current time Tc.
New values of signals are not assigned before the next simulation
cycle, at the earliest.
Signal value changes result in events  enable the execution of
processes that are sensitive to that signal.
c) ..
VHDL semantics: The simulation
cycle (3)
d
e
e
δ) ∀ P sensitive to s: if event on s in current
cycle: P resumes.
e) Each ... process that has resumed in the current simulation
cycle is executed until it suspends*.
*Generates future values for signal drivers.
VHDL semantics: The
simulation cycle (4)
f) Time Tn of the next simulation cycle = earliest of
1. time‘high (end of simulation time).
2. The next time at which a driver becomes active
3. The next time at which a process resumes
(determined by wait for statements).
 Next simulation cycle (if any) will be a delta cycle if Tn = Tc.
f
δ-simulation cycles
…
Next simulation cycle (if any) will be a delta cycle if Tn = Tc.
Delta cycles are generated for delay-less models.
There is an arbitrary number of δ cycles between any 2
physical time instants:
Cycle-based
Simulation
Take advantage of the fact that most digital designs
are largely synchronous
• Synchronous circuit: state elements
change value on active edge of clock
• Only boundary nodes are evaluated
Internal Node
Boundary Node
L
a
t
c
h
e
s
L
a
t
c
h
e
s
Cycle-based
Simulation
Compute steady-state response of the circuit
at each clock cycle
at each boundary node
L
a
t
c
h
e
s
L
a
t
c
h
e
s
Internal Node
(Some) EDA Tools and Vendors
Formal Verification
Formality → Synopsys
FormalCheck → Cadence Design Systems
DesignVerifyer → Chrysalis
Static Timing Analysis
PrimeTime → Synopsys (gate-level)
PathMill → Synopsys (transistor-level)
Pearl → Cadence Design Systems
Event driven simulator

More Related Content

What's hot

lect5_Stick_diagram_layout_rules
lect5_Stick_diagram_layout_ruleslect5_Stick_diagram_layout_rules
lect5_Stick_diagram_layout_rules
vein
 

What's hot (20)

Design of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCEDesign of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCE
 
System On Chip
System On ChipSystem On Chip
System On Chip
 
Unit I.fundamental of Programmable DSP
Unit I.fundamental of Programmable DSPUnit I.fundamental of Programmable DSP
Unit I.fundamental of Programmable DSP
 
lect5_Stick_diagram_layout_rules
lect5_Stick_diagram_layout_ruleslect5_Stick_diagram_layout_rules
lect5_Stick_diagram_layout_rules
 
Verilog Tasks and functions
Verilog Tasks and functionsVerilog Tasks and functions
Verilog Tasks and functions
 
Simulation power analysis low power vlsi
Simulation power analysis   low power vlsiSimulation power analysis   low power vlsi
Simulation power analysis low power vlsi
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 
Design-for-Test (Testing of VLSI Design)
Design-for-Test (Testing of VLSI Design)Design-for-Test (Testing of VLSI Design)
Design-for-Test (Testing of VLSI Design)
 
Cadence Design Flow.pptx
Cadence Design Flow.pptxCadence Design Flow.pptx
Cadence Design Flow.pptx
 
Small signal analysis of bjt amplifiers
Small signal analysis of bjt amplifiersSmall signal analysis of bjt amplifiers
Small signal analysis of bjt amplifiers
 
VLSI subsystem design processes and illustration
VLSI subsystem design processes and illustrationVLSI subsystem design processes and illustration
VLSI subsystem design processes and illustration
 
04~chapter 02 dft.ppt
04~chapter 02 dft.ppt04~chapter 02 dft.ppt
04~chapter 02 dft.ppt
 
MOSFETs: Single Stage IC Amplifier
MOSFETs: Single Stage IC AmplifierMOSFETs: Single Stage IC Amplifier
MOSFETs: Single Stage IC Amplifier
 
Session 2,3 FPGAs
Session 2,3 FPGAsSession 2,3 FPGAs
Session 2,3 FPGAs
 
Two stage op amp design on cadence
Two stage op amp design on cadenceTwo stage op amp design on cadence
Two stage op amp design on cadence
 
Study of vlsi design methodologies and limitations using cad tools for cmos t...
Study of vlsi design methodologies and limitations using cad tools for cmos t...Study of vlsi design methodologies and limitations using cad tools for cmos t...
Study of vlsi design methodologies and limitations using cad tools for cmos t...
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation final
 
Switch level modeling
Switch level modelingSwitch level modeling
Switch level modeling
 
STANDARD CELL LIBRARY DESIGN
STANDARD CELL LIBRARY DESIGNSTANDARD CELL LIBRARY DESIGN
STANDARD CELL LIBRARY DESIGN
 
Overview of digital design with Verilog HDL
Overview of digital design with Verilog HDLOverview of digital design with Verilog HDL
Overview of digital design with Verilog HDL
 

Viewers also liked (10)

Modeling Style and Delay Model of VHDL By Ap
Modeling Style and Delay Model of VHDL By ApModeling Style and Delay Model of VHDL By Ap
Modeling Style and Delay Model of VHDL By Ap
 
9 d55201 testing & testability
9 d55201 testing & testability9 d55201 testing & testability
9 d55201 testing & testability
 
Jtag presentation
Jtag presentationJtag presentation
Jtag presentation
 
NS2: Events and Handlers
NS2: Events and HandlersNS2: Events and Handlers
NS2: Events and Handlers
 
Fault simulation – application and methods
Fault simulation – application and methodsFault simulation – application and methods
Fault simulation – application and methods
 
Basic structures in vhdl
Basic structures in vhdlBasic structures in vhdl
Basic structures in vhdl
 
NS2--Event Scheduler
NS2--Event SchedulerNS2--Event Scheduler
NS2--Event Scheduler
 
AODV Protocol
AODV ProtocolAODV Protocol
AODV Protocol
 
Basics of Vhdl
Basics of VhdlBasics of Vhdl
Basics of Vhdl
 
Hardware Software Codesign
Hardware Software CodesignHardware Software Codesign
Hardware Software Codesign
 

Similar to Event driven simulator

EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
PRADEEP
 
Frequency Response with MATLAB Examples.pdf
Frequency Response with MATLAB Examples.pdfFrequency Response with MATLAB Examples.pdf
Frequency Response with MATLAB Examples.pdf
Sunil Manjani
 

Similar to Event driven simulator (20)

dokumen.tips_logic-synthesis-report.pdf
dokumen.tips_logic-synthesis-report.pdfdokumen.tips_logic-synthesis-report.pdf
dokumen.tips_logic-synthesis-report.pdf
 
Hardware Description Language
Hardware Description Language Hardware Description Language
Hardware Description Language
 
5_2019_01_12!09_25_57_AM.ppt
5_2019_01_12!09_25_57_AM.ppt5_2019_01_12!09_25_57_AM.ppt
5_2019_01_12!09_25_57_AM.ppt
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 
dokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdfdokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdf
 
Frequency Response with MATLAB Examples.pdf
Frequency Response with MATLAB Examples.pdfFrequency Response with MATLAB Examples.pdf
Frequency Response with MATLAB Examples.pdf
 
slide8.ppt
slide8.pptslide8.ppt
slide8.ppt
 
lecture8_Cuong.ppt
lecture8_Cuong.pptlecture8_Cuong.ppt
lecture8_Cuong.ppt
 
3 analysis.gtm
3 analysis.gtm3 analysis.gtm
3 analysis.gtm
 
Advanced Digital Design With The Verilog HDL
Advanced Digital Design With The Verilog HDLAdvanced Digital Design With The Verilog HDL
Advanced Digital Design With The Verilog HDL
 
Introduction to Polyhedral Compilation
Introduction to Polyhedral CompilationIntroduction to Polyhedral Compilation
Introduction to Polyhedral Compilation
 
design-compiler.pdf
design-compiler.pdfdesign-compiler.pdf
design-compiler.pdf
 
Verilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdfVerilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdf
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
 
verilog ppt .pdf
verilog ppt .pdfverilog ppt .pdf
verilog ppt .pdf
 
C language programming
C language programmingC language programming
C language programming
 
04 comb ex
04 comb ex04 comb ex
04 comb ex
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbg
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

Event driven simulator

  • 2. WHY HDL I THINK “ WE “ are the reason behind the invention of this language. 2 Needs are small Circuit are small Leads to increase in Circuit complexity to Draw Schemetic of more than 600 gates is not possible for us Leads to the development of EDA TOOLS Can be drawn by using boolean algebra , k map etc Now man wants more features in their devices Requirement of a automation tool is required Use to design circuits comprises of millions of transistors Example Synopsys, Cadence Design Systems ,Chrysalis
  • 3. Hardware Description Languages Special-purpose languages special constructs for hardware description timing, concurrency, bit vectors, etc. can usually include structural description examples  Verilog  VHDL Standard programming languages add data types and objects for hardware description examples  C  C++  Matlab
  • 4. 4  Simulation is the process of conducting experiments on a model of a system for the purpose of understanding or verifying the operation of the actual system.  In simple words it means 1. Take the input 2. Process the input 3. Output  Simulation in the VHDL/PLD methodology:  Functional verification verifies the functional operation of a description.  Post-synthesis simulation verifies that the synthesizer accurately translated the description to logic.  Timing simulation verifies that the synthesized logic, when mapped to the target PLD, will meet the system’s requirements.
  • 5. Types of simulations: 1. Behavioral: use the system as black box. 2.Functional: checks the functionality and ignores timing and just include unit delay. 3.Timing : system is partitioned into asic and timing analysis is done. This is called static timing analysis because outputs and inputs values are placed and then timing is done. 4. Logic / gate level: logic cell is taken and its timing and performance is done. 5. Switch level: models transistor as switches. 6.Transistor level: it requires models of transistor describing their nonlinear voltage and current characteristics(varitions).
  • 6. Classification of Simulators Logic Simulators Emulator-based Schematic-basedHDL-based Event-driven Cycle-based Gate System
  • 7. Classification of Simulators HDL-basedHDL-based: Design and testbench described using HDL Event-driven Cycle-based Schematic-basedSchematic-based: Design is entered graphically using a schematic editor EmulatorsEmulators: Design is mapped into FPGA hardware for prototype simulation. Used to perform hardware/software co-simulation.
  • 8. 8  VHDL is an event-driven language.  A VHDL simulator must provide data structures and algorithms that allow it to efficiently simulate the execution of concurrent statements in a VHDL program.  Simulator's sequential execution must be able to provide the illusion of concurrency.  Changes in input and output signals occur in simulation time: the time value maintained by the simulator, as opposed to real time.  There are three common kinds of simulators:  time driven  event driven  cycle based (for simulation of sequental systems)
  • 9. 9
  • 10. HOW Simulation Algorithms Compiled simulation  logic equations compiled to code  execute code - fast  works well with zero and unit delay models  difficult with general timing models  no use of latency, multi-rate behavior Event-driven simulation  input changes cause evaluation of model, scheduling of output change event  use timing models to determine new event times  output change evaluated at scheduled time  advantage  real circuits have 10-30% activity  dormant parts of circuit are not evaluated
  • 11. Event-driven Simulation Event: change in logic value at a node, at a certain instant of time → (V,T) Event-driven: only considers active nodes Efficient Performs both timing and functional verification All nodes are visible Glitches are detected Most heavily used and well-suited for all types of designs
  • 12. Event-Driven Logic Simulation Evaluate gate when inputs change use logic model to compute new output value use timing model to compute when output will change Schedule an output change event store the event on a time-sorted event queue Process events from the queue output change evaluated at scheduled time causes new events to be scheduled 5 5 7 5 5 5 0 0 0 1->0 (0) 0 1 1 1 0->1 (5) 1->0 (12) 1->0 (10)
  • 13. Event-Driven Logic Simulation 1. t=X: Schedule PI:1->0 at t=0 2. t=0: PI changes 1->0 Evaluate A, schedule A:0->1 at t=5 4. t=5: A changes 0->1 Evaluate B, schedule B:1->0 at t=10 Evaluate C, schedule C:1->0 at t=12 5. t=10: B changes 1->0, output 6. t=12: C changes 1->0, output 5 5 7 5 5 5 0 0 0 1->0 (0) 0 1 1 1 0->1 (5) 1->0 (12) 1->0 (10) A B C
  • 14. An event-driven VHDL example process (count) begin my_count <= count; trigger <= not trigger; end process; process (trigger) begin if (count<=15) then count <= count + 1 after 1ns; else count <= 0 after 1ns; end if; end process; Block 1 Block 2 Each process: - loops forever - waits for change in signal from other process
  • 15. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out
  • 16. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 0ns (step1) Red Boxes : evaluate in current step 1 1 1 0
  • 17. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 0ns (step2) 1 1 1 0 1
  • 18. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 0ns (step3) 1 1 1 0 1 1
  • 19. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 0ns (step4) 1 1 1 0 1 1 1
  • 20. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 1ns (step1) 1 1 1 0 1 1 1 1 1 1 1
  • 21. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 1ns (step2) 1 1 1 0 1 0 1 1 1 1 1 1
  • 22. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 1ns (step3) 1 1 1 0 1 0 0 1 1 1 1 1 1
  • 23. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 1ns (step4) 1 1 1 1 0 1 0 0 1 1 1 1 1 1
  • 24. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); Let's simulate: a=11 b=01 Time = 1ns (step5) and a b and xor s(0) c(0) xor xor => s(1) sum_out(1) and and or or => => sum_out(0) carry_out 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1
  • 25. A more hardware-oriented example s(0) <= a(0) xor b(0) after 2ns; c(0) <= a(0) and b(0) after 1ns; s(1) <= a(1) xor b(1) xor c(0) after 2ns; c(1) <= (a(1) and b(1)) or (b(1) and c(0)) or (c(0) and a(1)) after 1ns; sum_out(1 to 0) <= s(1 to 0); carry_out <= c(1); and a b and xor s(0) c(0) xor xor => c(1) carry_out and and or or => => sum_out(0) carry_out Let's simulate: a=11 b=01 Time = 1ns (step5) 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 That's enough - you get the point The statement-(process-) dependencies define a network. Changes are dynamically propagated through the network
  • 26. Simulation Algorithm while (HaveEvents()) event = NextEvent(); /* time-sorted order */ currenttime = event->time; /* update global time */ event->gate->output = event->output/* change gate output */ print output if it is primary output; for (all gates g in event->gate fan-out list) newoutput = EvalGate(g); /* new gate output */ newtime = currenttime + g->delay; /* when it changes */ ScheduleEvent(g, newoutput, newtime);
  • 27. Event Queue Implementation Events must be processed in time order  event queue must sort by time Must be able to delete events  cancel obsolete events on a gate Implementations  priority queue  O(logN) time to insert/delete for N-item queue  many implementations - AVL tree, heap, etc.  problem: N is often large  bucket queue - time wheel  divide time into time quanta Q, e.g. 1ps  circular buffer of N entries 1 quantum in size  can store events Q*N into future  events beyond buffer go into unsorted far list  O(1) time to insert, nearly so for delete
  • 28. Event-driven Simulation Uses a timewheel to manage the relationship between components TimewheelTimewheel = list of all events not processed yet, sorted in time (complete ordering) When event is generated, it is put in the appropriate point in the timewheel to ensure causality
  • 30. Time Wheel 0 1 i-1 i i+1 999 event event curtime curtime+999ps curtime+1ps time wheel of time quantums all events scheduled for a given time quantum Wheel only needs to be big enough to hold most variation in gate delays
  • 31. Time Wheel Operation Insertion if (eventtime - curtime >= WHEELLENGTH*quantum) insert event into far list else insert at wheel[eventtime % (WHEELLENGTH*quantum)] Deletion i = curtime % (WHEELLENGTH*quantum) while (wheel[i] == NULL) if (i == WHEELLENGTH-1) i = 0; timebase += (WHEELLENGTH*quantum); for all events in far list if (eventtime - timebase < WHEELLENGTH*quantum) insert event into wheel else i++ remove first event from wheel[i] list and return it
  • 32. 32 The LRM (Language Reference Manual) defines how an event-driven simulator must execute the VHDL. Simulator vendors implement this concepts. An event-driven simulator performs three steps to accomplish a simulation: 1) elaboration 2) initialization 3) repeated execution of simulation cycles
  • 33. 33 Elaboration Elaboration is the creation of a simulation model for a design entity from its VHDL description. This simulation model consists of a net of simulation processes. During elaboration, all concurrent statements are converted to equivalent simulation processes.
  • 34. VHDL semantics: initialization At the beginning of initialization, the current time, Tc is 0 ns.  The … effective value of each explicitly declared signal are computed, and the current value of the signal is set to the effective value. …  Each ... process … is executed until it suspends.  The time of the next simulation cycle (… in this case … the 1st cycle), Tn is calculated according to the rules of step f of the simulation cycle, below.
  • 35. VHDL semantics: The simulation cycle (1) According to the standard, the simulation cycle is as follows: a) Stop if Tn= time‘high and “nothing else is to be done” at Tn. The current time, Tc is set to Tn. ?
  • 36. VHDL semantics: The simulation cycle (2) b) Each active explicit signal in the model is updated. (Events may occur as a result.) Previously computed entries in the queue are now assigned if their time corresponds to the current time Tc. New values of signals are not assigned before the next simulation cycle, at the earliest. Signal value changes result in events  enable the execution of processes that are sensitive to that signal. c) ..
  • 37. VHDL semantics: The simulation cycle (3) d e e δ) ∀ P sensitive to s: if event on s in current cycle: P resumes. e) Each ... process that has resumed in the current simulation cycle is executed until it suspends*. *Generates future values for signal drivers.
  • 38. VHDL semantics: The simulation cycle (4) f) Time Tn of the next simulation cycle = earliest of 1. time‘high (end of simulation time). 2. The next time at which a driver becomes active 3. The next time at which a process resumes (determined by wait for statements).  Next simulation cycle (if any) will be a delta cycle if Tn = Tc. f
  • 39. δ-simulation cycles … Next simulation cycle (if any) will be a delta cycle if Tn = Tc. Delta cycles are generated for delay-less models. There is an arbitrary number of δ cycles between any 2 physical time instants:
  • 40. Cycle-based Simulation Take advantage of the fact that most digital designs are largely synchronous • Synchronous circuit: state elements change value on active edge of clock • Only boundary nodes are evaluated Internal Node Boundary Node L a t c h e s L a t c h e s
  • 41. Cycle-based Simulation Compute steady-state response of the circuit at each clock cycle at each boundary node L a t c h e s L a t c h e s Internal Node
  • 42. (Some) EDA Tools and Vendors Formal Verification Formality → Synopsys FormalCheck → Cadence Design Systems DesignVerifyer → Chrysalis Static Timing Analysis PrimeTime → Synopsys (gate-level) PathMill → Synopsys (transistor-level) Pearl → Cadence Design Systems