Thiết kế hệ thống số với Verilog
Chapter1: Introduction
Giảng viên: Phạm Hoài Luân
1
Lecturer Information
Bản thân:
Tên: Phạm Hoài Luân.
Tuổi: 29 tuổi.
Email: [email protected] hoặc
[email protected]
Học vấn:
2013-2018: Cử nhân Khoa Kỹ thuật máy tính, UIT.
2018-2020: Thạc sĩ tại Viện khoa học và công nghệ
Nara (NAIST), Nhật Bản.
2020-2022: Tiến sĩ tại NAIST, Nhật Bản.
Nghề nghiệp:
2022-nay: Assistant Professor tại NAIST.
2022-nay: Lecturer tại Khoa kỹ thuật máy tính,
UIT. 2
Course Related Information
3
Course Related Information
Doanh thu của ngành công nghệ vi mạch bán dẫn
Nguồn:
https://vista.gov.vn/vn-uploads/chien-luoc-phat-tri
en/2023_11/btld-so11-2023.pdf
4
Course Related Information
Sản phẩm của ngành công nghệ bán dẫn
Chip xử lý CPU Card đồ họa GPU Chip CPU xử lý trong điện thoại
Bộ nhớ DDR Chip cho Vi xử lý & Vi điều khiển Chip cho công nghệ ô tô
5
Course Related Information
Thiết kế phần cứng Verilog liên quan gì với
công nghệ vi mạch bán dẫn?
Thiết kế chip bằng Verilog Layout của chip dựa trên mô tả Verilog Chip đã được đúc dựa trên mô tả Verilog
Thiết kế bản vẽ kiến trúc Xây dựng mô hình 3D của ngôi nhà Xây dựng ngôi nhà thực tế
6
Agenda
1. Chapter 1: Introduction ( Week 1)
2. Chapter 2: Fundamental concepts (Week 1, 2)
3. Chapter 3: Modules and hierarchical structure (Week 2)
4. Chapter 4: Primitive Gates – Switches – User defined primitives
(Week 3)
5. Chapter 5: Structural model (Week 3, 4)
6. Chapter 6: Behavioral model – Combination circuit and
Sequential circuit (Week 4, 5)
7. Chapter 7: Tasks and Functions (Week 6)
8. Chapter 8: State machines (Week 6, 7)
9. Chapter 9: Testbench and verification (Week 8)
10. Practice: Synthesizing Knowledge through Code (Week 9, 10)
11. Project presentation (Week 11~15)
7
Contents
Chapter 1: Introduction
Requirements – Projects – Scores
Verilog – What and Why ?
CAD (Computer-Aided Design) flow
8
Requirement
Class: Starts from 8:00-10:50 every Monday.
Weekly Assignment: Due before next class (Firm
Deadline)
Link:
https://classroom.google.com/c/NzQ5Mjk5NzA4
MDIx?cjc=nmvu47f
Name your email with your full name and student ID
number. For example: Nguyễn Văn A_12345678
Final project: Write a word/pdf report and print the
report directly from week 11 to week 15.
9
Projects
• Topics :
– Topic 1: A Floating Point Unit for Numerical Calculations.
– Topic 2: SHA-256 Algorithm
– Topic 3: AES-128 Algorithm
– Topic 4: Hardware Platform for JPEG Compression/Decompression
– Topic 5: Median Filter for Image Denoising (Salt & Pepper Noise)
– Topic 6: Digit Recognition Using LeNet-5 CNN
– Topic 7: FFT Algorithm
• Group:
– Each group consists of 3 people, the group representative sends the names
of the group members to email [email protected].
– I will randomly group those who do not register.
– Groups will be assigned random topics.
10
Scores
• Score components:
– Midterm score : 30 %
– Attendance score : 10 %
– Final project score : 60 %
• How to score:
– Midterm score : do exercises with 10 questions
– Final project score:
• Weekly Exercises (10 Weeks) 20%
• Answer questions/ask good questions during online
learning: add 1~3 points to weekly assignments.
• Report 40%. 11
Verilog learning “tips”
• Verilog is essentially a programming language – similar to C with some
Pascal-like constructs
• The best way to learn any programming language is from live code
• We will get you started by going through several example programs and
explaining the key concepts
• We will not try to teach you the syntax line-by-line: pick up what you need
from the books and on-line tutorials
• Tip: Start by copying existing programs and modifying them incrementally
making sure you understand the output behavior at each step
• Tip: The best way to understand and remember a construct or keyword is to
experiment with it in code, not by reading about it
• We shall not design at the switch (transistor) level in this course – the
lowest level we shall reach is the gate level. The transistor level is more
appropriate for an electronics-oriented course
12
History
• HDL History
• 1970s: First HDLs
• Late 1970s: VHDL
• VHDL = VHSIC HDL = Very High Speed Integrated Circuit HDL
• VHDL inspired by programming languages of the day (Ada)
• 1980s:
• Verilog first introduced
• Verilog inspired by the C programming language
• VHDL standardized
• 1990s:
• Verilog standardized (Verilog-1995 standard)
• 2000s:
• Continued evolution (Verilog-2001 standard)
• Both VHDL and Verilog evolving, still in use today
13
Why To Represent Hardware?
If you’re going to design a computer, you need to write down
the design so that:
• You can read it again later
• Someone else can read and understand it
• It can be simulated and verified
• Even software people may read it!
• It can be synthesized into specific gates
• It can be built and shipped and make money
14
How To Represent Hardware?
• Draw schematics
• Hand-drawn
• Machine-drawn
• Write a netlist
Z52BH I1234 (N123, N234, N4567);
• Write primitive Boolean equations
AAA = abc DEF + ABC def
• Use a Hardware Description Language (HDL)
assign overflow = c31 ^ c32;
15
Custom design vs System design
– Custom design:
• Small design . For instance : RAM, ROM, ALU, …
• High performance
• Designed by schematic or SPICE netlist
• Very time consuming to design (timing, power,… verification by
simulation)
– System design:
• Large and complex design , system level ((millions to billions of gates). For
instance : Chip, Micro processor, CPU, …
• Lower performance
• Designed by HDL.
• Less design time more productivity.
16
HDL-Advantages
– Describe complex designs (millions to billions of gates)
– Input to synthesis tools (generated circuits)
– Design exploration with simulation with less time consuming.
– Support for structure and instantiation
– Support for describing bit-level behavior
– Support for timing
– Support for concurrency
17
HDL-Disadvantages
– Much depends on Synthesis tools.
– Hard to optimize design.
18
Verilog vs. VHDL
– Verilog is relatively simple and close to C
– VHDL is complex
– For commercial products, it’s Verilog, Verilog has 60% of the
world digital design market (larger share in US)
– For large projects such as defense and telecommunication projects
from government / aerospace work, it’s VHDL
19
“Keep in heart”
• HDLs are not “programming languages”
• When coding in an HDL, it is important to remember that you
are specifying hardware that executes in parallel rather than
software that executes sequentially.
• In a program, we start at the beginning (e.g. “main”), and we
proceed sequentially through the code as directed. The program
represents an algorithm, a step-by-step sequence of actions to
solve some problem
• Hardware is all active at once; there is no starting point.
Everything happens concurrently.
• “Sequential design in HDL differs from sequential executive
commands in programming languages”.
20
CAD flow
Evolution of Computer Aided Design (CAD)
Vacuum tubes and transitors
Integrated circuit (IC)
Increase to use CAD
More sophisticated
Small scale integration (SSI) Gate count
was small
Medium scale integration (MSI) Hundreds of
gates
Large scale integration (LSI) EDA began evolve
Thousands of gates
in logic simulation
Very large scale integration
(VLSI) >100,000 transistors EDA was critical
21
CAD flow (cont’d)
Computer Aided Design vs Manual Design
Verilog design Schematic design
Pros - Easy to implement function - Customer design
- Simulate to verify function quickly - Be able to optimize performance, power
due to simple netlist and area of design.
- Generate schematic and layout
automatically by using CAD tools.
- Helpful for system synthesis
Cons - No optimality for performance, - Must be master on IC design
power and area of design. - Take time to simulate to verify function
due to big and complicated netlist.
- Hard to design for system level
22
CAD flow (cont’d)
CAD Design Flow: Design Specification
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
Timing analyis
Post-synthesis verification
Physical layout
Chip 23
CAD flow (cont’d)
Design specification: Design Specification
Behavior Description
+ Describe the FUNCTIONALITY, INTERFACE, and OVERALL ARCHITECTURE
+ Do not need to think about HOW to implement
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
Timing analyis
Post-synthesis verification
Physical layout
Chip 24
CAD flow (cont’d)
Behavior Description: Design Specification
Behavior Description
+ Analyze the design in terms of FUNCTIONALITY, PERFORMANCE,
Pre-synthesis verification
COMPLIANCE to standards, and OTHER high-level issues
Compilation
+ Often written with HDLs or EDA tools (combineand
HDLsSynthesis
and object oriented languages
such as C++)
Routing
Behavior description for and
design Placement in Verilog
specification
module design(…); comp 1 U1(…);
Timing analyis always (posedge clk)
assign … comp2 U2(…); begin …end
Post-synthesis verification
always … … if (…) bus = w;
compi (…) compn Un(…);
Physical layout else …
endmodule
Chip
25
CAD flow (cont’d)
Pre-synthesis Design Specification
verification:
Behavior Description
Pre-synthesis verification
+ Check design function flaws that may Compilation
cause by ambiguous
and Synthesis
problem specification,
designer errors, or incorrect use of parts in the design.
Routing and
+ Done by simulation (presynthesis simulation), Placement
assertion verification with testbench
definition or input waveform.
Timing analyis
+ Do not consider gate, propagation delay, hazards, glitches, race conditions, setup and
hold violations, and other related timing issues.
Post-synthesis verification
Physical layout
Chip 26
CAD flow (cont’d)
Function verification with testbench:
27
CAD flow (cont’d)
Function verification with testbench:
28
CAD flow (cont’d)
Function verification with input waveform:
Define input waveform manually
29
CAD flow (cont’d)
Compilation and Design Specification
Synthesis:
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
-Compilation and systhesis : automaticRouting
hardware
and
generation
Placementfrom Verilog description.
-Analysis phase: Analyze and translate the functional specification ( Verilog description)
Timing
the specification of hardware, technology files withanalyis
detailed timing into the uniform
format data.
Post-synthesis verification
-Synthesis phase: Combine all uniform format data above together and generate the
corresponding logic.
Physical layout
Chip 30
CAD flow (cont’d)
Compilation and Synthesis
Determine which
logic gates, elements
to implement the
boolean expressions
A set of boolean expressions A set of optimized boolean expressions,
or a netlist of basic gates. tabular logic representations or primitive
gate netlists. 31
CAD flow (cont’d)
Routing and Design Specification
Placement:
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
-Decide the placement of cells and connection
Timing analyis
between inputs and outputs of these cells
for the target hardware ( ASIC, FPGA).
-Output is a complete netlist of Post-synthesis
target hardwareverification
including components, wiring delays of
each interconnection, and load effects on gates.
Physical layout
Chip 32
CAD flow (cont’d)
Timing analysis: Design Specification
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
Timing analyis
-Generates worst-case delays, clock speed, delay
Post-synthesis paths and setup times, hold times.
verification
-Designers use these information to optimize design such as changing routing and
placement. Physical layout
Chip 33
CAD flow (cont’d)
Post-synthesis Design Specification
verification:
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
Timing analyis
Post-synthesis verification
-Using netlist from routing and placement phase
Physical as the input for post-synthesis simulation.
layout
-Verify clock frequency, race condition, hazzard condition, function and delay timings
Chip
such as setup times, hold times, access times, output hold times ... 34
CAD flow (cont’d)
Physical layout: Design Specification
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
Timing analyis
-Programming for FPGA
-Layout for ASIC manufacturing
Post-synthesis
( poly-silicon,verification
diffusion, metal connection…)
Physical layout
Chip 35
CAD flow (cont’d)
Fabrication Design Specification
for Chip:
Behavior Description
Pre-synthesis verification
Compilation and Synthesis
Routing and Placement
Timing analyis
Post-synthesis verification
-Fabrication for design on wafer Physical layout
Chip 36
CAD flow (cont’d)
Summary:
– HDLs are now the dominant method for large digital designs
– Syntax is similar to C language easy to learn and easy to use
– Allows different levels of abstraction (switches, gates, RTL, or behavioral
code) to be mixed in the same level
– Most popular logic synthesis tools support Verilog
– Allows the user to write custom C code to interact with internal data structures
of Verilog by using PLI (Programming Language Interface)
37
Exercise
1. Why is Verilog not “Programming Languages”?
2. In the CAD Flow, what is the most critical stage? At which point
does Verilog-based hardware design fit in, and why?
38
END
39