Documente Academic
Documente Profesional
Documente Cultură
• Types of Simulation
– Trace Simulation
• Steps
• Analog
Kuruvilla Varghese
33
Simulation 34
D Q D Q • Simulation Time
Comb
CK CK – Event time at which
CLK computation happens
– Events are ordered
CLK
chronologically
• Simulation Cycle
– Resolving concurrency, by
• Sequential Circuit sequential computation
– Cycle based simulation – Delta delay
• Simulated every clock cycle
Kuruvilla Varghese
34
1
Simulation Cycle - Timing 35
3 ns
a x
b
5 ns • Issue 1: Order of statements
y
c
architecture dflow of ckt1 is
– Resolving concurrency – order
begin of concurrent statements may not
y <= c nor x after 5 ns; match the data flow.
x <= a and b after 3 ns; – Solution: Event driven
end dflow; computation
Time(ns) a b c x y – Feedback
0 1 1 0 1 0
– Solution: Keep computing till
100 0 1 0
stable.
100 + 3 0 0
100 + 3 + 5 1
108 0 1 0 0 1
Kuruvilla Varghese
35
Kuruvilla Varghese
36
2
Logic Simulation 37
Kuruvilla Varghese
37
R Z
Z
architecture dflow of bff is
begin
Y
Z <= R nand Y;
Y <= S nand Z;
end dflow; R
Time(ns) S R Y Z
0 1 0 0 1 S
100 0 1 0 100 100 + δ 100 + 2δ
100 + δ 1
100 + 2δ 0 Solution: Event driven computation
100 0 1 1 0 Keep computing till stable.
Kuruvilla Varghese
38
3
Simulation Cycle - Feedback 39
Y
Y
0 5 10
Time (ns) Y
0 0
5 1
10 0
. .
. . Solution: Event driven computation
. . Oscillates
Kuruvilla Varghese
39
40
4
Process – Correct usage 41
process (a, b, c, d, e, f, x, y)
begin
…
x <= f1 (a, b);
…
y <= f2 (c, d, x);
…
z <= f3 (e, f, y);
end process;
Kuruvilla Varghese
41
42
5
Synthesis 43
y <= a + b;
0 0 0 1 0 0 0 0 0
y <= x + 1;
1 1 1 1 1 1 1 1 1
Kuruvilla Varghese
43
Data Objects 44
• Classes • Constants
Constants, Signals, Variables, Files – For readability and easy modification
of code
constant width: integer := 8;
• Syntax
class object_name: data type;
• Variables
– Declared in sequential bodies
• Signals (process, functions, procedures).
Signals declared in architecture – Used in simulation extensively.
declarative region and used anywhere Indexing, temporary storage etc..
(architecture, processes, functions, Synthesis is not well defined in non-
procedures) trivial cases.
signal carry: std_logic_vector(7 variable count: integer range 0 to
downto 0); 255;
Kuruvilla Varghese
44
6
Data Objects, Types 45
Kuruvilla Varghese
45
Kuruvilla Varghese
46
7
Data Types, Scalar Predefined 47
47
Subtypes 48
Kuruvilla Varghese
48
8
User defined Data Types 49
Kuruvilla Varghese
49
• Record Types
type table8x4 is array (0 to 7, 0 to 3) of
std_logic;
type iocell is record
constant ex_or: table8x4 := buffer_inp: std_logic_vector(7
downto 0);
(“000_0”, “001_1”,
enable: std_logic;
“010_1”, “011_0”,
buffer_out: std_logic_vector(7
“100_1”, “101_0”, downto 0);
“110_0”, “111_1”); end record;
Kuruvilla Varghese
50
9
Data Types - Composite 51
51
10