Professional Documents
Culture Documents
(비공개) Verilog 설계언어 초급 - 2019 - 08
(비공개) Verilog 설계언어 초급 - 2019 - 08
(비공개) Verilog 설계언어 초급 - 2019 - 08
Verilog HDL 언어 초급 및
설계 가이드라인
송재훈
IDEC
Contents
1. What is HDL?
2. A System and Its Verilog Representation
3. Signals
4. A Structural View of a System
5. Specification with Signal Transformations
6. The Behavioral Approach
7. Towards Real Engineering
8. Is It Working?
2
IDEC
What is HDL?
송재훈
The World Before Verilog IDEC
4
Logic Synthesis - Principles IDEC
Function, Technology
Area, library
Input-to-output timing
HDL Gate-level
Synthesis
description netlists
Constraints
Area, timing,
power, testability
5
IDEC
7
The Structure of a Module
IDEC
8
The Structure of a Module IDEC
Definition of a Module
9
The Structure of a Module IDEC
Definition of a Module
10
The Structure of a Module IDEC
Definition of a Module
11
The Structure of a Module IDEC
Definition of a Module
12
The Structure of a Module IDEC
Definition of a Module
module module_name
(port_declaration port_name, port_name,...,
port_declaration port_name, port_name,...);
module items
endmodule
13
The Structure of a Module IDEC
14
The Structure of a Module IDEC
15
The Structure of a Module IDEC
16
The Structure of a Module IDEC
19
Different Types of Module Body IDEC
20
Different Types of Module Body IDEC
21
Different Types of Module Body IDEC
22
Different Types of Module Body IDEC
23
Different Types of Module Body IDEC
24
Different Types of Module Body IDEC
25
IDEC
Signals
An Introduction to Signals IDEC
27
An Introduction to Signals IDEC
28
An Introduction to Signals IDEC
0 1
29
An Introduction to Signals IDEC
X (x) Z (z)
30
Signals in Verilog IDEC
31
Signals in Verilog IDEC
32
Signals in Verilog IDEC
33
Signals in Verilog IDEC
34
Signals in Verilog IDEC
35
Signals in Verilog IDEC
36
External Signals IDEC
37
External Signals IDEC
38
External Signals IDEC
39
IDEC
41
Module Instantiation IDEC
42
Module Instantiation IDEC
P1 P4
net net S6 S9 net
net
P2
var net S7
P5
P3 S10 var net
net net S8
43
Module Instantiation IDEC
44
Module Instantiation IDEC
45
Module Instantiation IDEC
GoldBox
46
IDEC
48
Expressions IDEC
49
Expressions IDEC
Integer Constant
27
3’b011
• size (optional) is the number of bits in the number. Unsized integers default to
at least 32-bits.
50
Expressions IDEC
Integer Constant
• ’base represents the radix and sign property of the value. The base and sign
characters are not case sensitive (e.g. ’b and ’B are equivalent).
(Base)
51
Expressions IDEC
Integer Constant
52
Expressions IDEC
Integer Constant
53
Expressions IDEC
DataBus
54
Operators IDEC
55
Operators IDEC
56
Operators IDEC
57
Operators IDEC
58
Operators IDEC
Case Equality Operator
59
Operators IDEC
60
Operators IDEC
61
Operators IDEC
62
Operators IDEC
63
Operators IDEC
64
Operators IDEC
65
Operators IDEC
Operator Precedence
Compound expressions are evaluated in the order of operator precedence.
Operators within parenthesis have a higher precedence and are evaluated first.
66
The Continuous Assignment IDEC
67
The Continuous Assignment IDEC
68
The Continuous Assignment IDEC
ChipOut
69
The Continuous Assignment IDEC
ChipOut
70
IDEC
송재훈
Variables and Parameters IDEC
Variables
[ [
[
[
[
[
72
Variables and Parameters IDEC
Variables
• variable_type is one of the following:
• signed (optional) may only be used with reg variables, and indicates that
values are interpreted as 2’s complement signed values. If either a port or the
reg connected to the port is declared as signed, then both are signed. Signed
reg variables were added in Verilog-2001.
73
Variables and Parameters IDEC
Variables
• [range] (optional) may only be used with reg variables, and is a range
from [msb :lsb] (most-significant-bit to least-significant-bit).
- If no range is specified, then reg variables are 1-bit wide.
- The msb and lsb must be a literal number, a constant, an expression,
or a call to a constant function.
74
Variables and Parameters IDEC
Variables
75
Variables and Parameters IDEC
Variables
76
Variables and Parameters IDEC
77
Variables and Parameters IDEC
78
Variables and Parameters IDEC
79
Behavioral Basics IDEC
81
Behavioral Basics IDEC
82
Behavioral Basics IDEC
variable type
signals
83
Behavioral Basics IDEC
84
Behavioral Basics IDEC
85
Behavioral Basics IDEC
86
Behavioral Basics IDEC
87
Behavioral Basics IDEC
88
Behavioral Basics IDEC
89
Behavioral Basics IDEC
90
Behavioral Basics IDEC
91
Behavioral Basics IDEC
92
Behavioral Basics IDEC
Multi-Way Branching
94
Complex Statements IDEC
Multi-Way Branching
95
Complex Statements IDEC
Multi-Way Branching
96
Complex Statements IDEC
Multi-Way Branching
97
Complex Statements IDEC
Multi-Way Branching
98
Complex Statements IDEC
Multi-Way Branching
99
Complex Statements IDEC
Multi-Way Branching
100
Complex Statements IDEC
Multi-Way Branching
101
Complex Statements IDEC
Multi-Way Branching
case ( expression )
case_item: statement or statement_group
case_item, case_item: statement or statement_group
default: statement or statement_group
endcase
• Compares the value of the expression to each case item and executes the
statement or statement group associated with the first matching case.
Executes the default if none of the cases match (the default case is optional).
102
Complex Statements IDEC
103
Complex Statements IDEC
Loops
104
Complex Statements IDEC
Loops
105
Complex Statements IDEC
Loops
106
Complex Statements IDEC
Loops
while ( expression ) statement or statement group
Loops
• A loop that executes the statement or statement group a set number of times.
The number may be an expression (the expression is only evaluated when the
loop is first entered).
//--- example ---//
integer count;
initial
begin
count = 0;
repeat(128)
begin
$display("Count = %d", count);
count = count + 1;
end
end 108
Complex Statements IDEC
Loops
109
Advanced Control over Behavior IDEC
Timing Control (1/8) - (Delay-based)
#delay
• Delays execution of the next statement for a specific amount of time. The
delay may be a literal number, a variable, or an expression.
110
Advanced Control over Behavior IDEC
Timing Control (2/8) - (Event-based)
• [ ] : option
• Delays execution of the next statement until there is a transition on a signal.
- edge (optional) maybe either posedge or negedge. If no edge is
specified, then any logic transition is used.
• Either a comma or the keyword or may be used to specify events on any
of several signals. The use of commas was added in Verilog-2001.
• signal may be a net type or variable type, and may be any vector size.
111
Advanced Control over Behavior IDEC
Timing Control (3/8) - (Event-based)
112
Advanced Control over Behavior IDEC
Timing Control (4/8) - (Level-sensitive)
wait (expression)
113
Advanced Control over Behavior IDEC
Timing Control (5/8)
114
Advanced Control over Behavior IDEC
Timing Control (6/8)
output
115
Advanced Control over Behavior IDEC
Timing Control (8/8)
116
Advanced Control over Behavior IDEC
117
Advanced Control over Behavior IDEC
Sensitivity List
118
Advanced Control over Behavior IDEC
Sensitivity List
119
Advanced Control over Behavior IDEC
120
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
121
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
122
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
123
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
124
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
125
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
126
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
127
Advanced Control over Behavior IDEC
Non-Blocking
Assignment
128
IDEC
송재훈
129
Logic Synthesis - Principles IDEC
130
Logic Synthesis - Principles IDEC
131
Logic Synthesis - Principles IDEC
132
IDEC
Is It Working?
송재훈
An Introduction to Test Benches IDEC
stimuli generator
134
An Introduction to Test Benches IDEC
135
An Introduction to Test Benches IDEC
136
An Introduction to Test Benches IDEC
137
The Structure of a Test Bench IDEC
138
The Structure of a Test Bench IDEC
139
The Structure of a Test Bench IDEC
140
The Structure of a Test Bench IDEC
141
IDEC
Thank you!
142