cda 4253 fpga system design introduction to vhdlhaozheng/teach/cda4253/slides/... · 2019. 1....
TRANSCRIPT
![Page 1: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/1.jpg)
CDA 4253 FPGA System DesignIntroduction to VHDL
Hao ZhengDept of Comp Sci & Eng
USF
![Page 2: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/2.jpg)
2
Reading
• P. Chu, FPGA Prototyping by VHDL Examples- Chapter 1, Gate-level combinational circuits
• Xilinx XST User Guide- Xilinx specific language support
• Two purposes of using VHDL:- Simulation- Synthesis – focus of this course
![Page 3: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/3.jpg)
3
Recommended reading
• Wikipedia – The Free On-line Encyclopedia
VHDL - http://en.wikipedia.org/wiki/VHDLVerilog - http://en.wikipedia.org/wiki/Verilog
![Page 4: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/4.jpg)
4
• VHDL is a language for describing digital logic systems used by industry worldwide
VHDL is an acronym for VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
• Now, there are extensions to describe analog designs.
VHDL
![Page 5: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/5.jpg)
5
Subsequent versions of VHDL
- IEEE-1076 1987- IEEE-1076 1993 ← most commonly supported by
CAD tools- IEEE-1076 2000 (minor changes)- IEEE-1076 2002 (minor changes)- IEEE-1076 2008
![Page 6: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/6.jpg)
6
VHDL vs. Verilog
Government Developed
Commercially Developed
Ada based C based
Strongly Type Cast Mildly Type Cast
Case-insensitive Case-sensitive
Difficult to learn Easier to Learn
More Powerful Less Powerful
![Page 7: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/7.jpg)
7
Features of VHDL/Verilog
• Technology/vendor independent
• Portable
• Reusable
![Page 8: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/8.jpg)
8
Good VHDL/Verilog Books coming soon
![Page 9: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/9.jpg)
9
VHDL Fundamentals
![Page 10: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/10.jpg)
10
Naming and Labeling (1)
• VHDL is case insensitive.Example:
Names or labelsdatabusDatabusDataBusDATABUS
are all equivalent
• Avoid inconsistent styles
![Page 11: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/11.jpg)
11
Naming and Labeling (2)General rules of thumb (according to VHDL-87)
1. All names should start with an alphabet character (a-z or A-Z)
2. Use only alphabet characters (a-z or A-Z) digits (0-9) and underscore (_)
3. Do not use any punctuation or reserved characters within a name (!, ?, ., &, +, -, etc.)
4. Do not use two or more consecutive underscore characters (_ _) within a name (e.g., Sel_ _A is invalid)
5. No forward slashes “/” in names.6. All names and labels in a given entity and architecture
must be unique.
![Page 12: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/12.jpg)
12
Extended IdentifiersAllowed only in VHDL-93 and higher:1. Enclosed in backslashes2. May contain spaces and consecutive underscores3. May contain punctuation and reserved characters within a
name (!, ?, ., &, +, -, etc.)4. VHDL keywords allowed5. Case sensitive
Examples: \rdy\ \My design\ \!a\\RDY\ \my design\ \-a\
Should not be used to avoid confusioin!
![Page 13: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/13.jpg)
13
Literals
• Numeric: 32, -16, 3.1415927• Bits : ‘1’, ‘0’• Strings: “Hello”• Bit strings: B”1111_1111”, O”353”, X”AA55”• Concatenation: “1111” & “0000” => “1111_0000”
![Page 14: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/14.jpg)
14
Objects
• Signal – model real physical wires for communications- Or physical storage of information
• Variable – a programming construct to model temporary storage
• Constant – its value never changes after initialization
![Page 15: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/15.jpg)
15
Comments• Comments in VHDL are indicated with
a �double dash�, i.e., �--�§ Comment indicator can be placed anywhere in the line§ Any text that follows in the same line is treated asa comment
§ Carriage return terminates a comment§ No method for commenting a block extending over a
couple of lines• Examples:-- main subcircuit
Data_in <= Data_bus; -- reading data from the input FIFO
![Page 16: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/16.jpg)
16
• Explain function of module to other designers• Explanatory, not Just restatement of code• Placed close to the code described- Put near executable code, not just in a header
Comments
![Page 17: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/17.jpg)
17
Free Format
• VHDL is a �free format� languageNo formatting conventions, such as spacing or indentation imposed by VHDL compilers. Space, tabs, and carriage return treated the same way.Example:
if (a=b) thenor
if (a=b) then or
if (a =
b) then
are all equivalent
![Page 18: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/18.jpg)
18
Readability Standards & Coding StyleAdopt readability standards based on the
textbook by Chu
Use coding style recommended in OpenCores Coding Guidelines
Available at the course web page
Penalty may be enforced for not followingthese recommendations!!!
![Page 19: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/19.jpg)
19
Describing Designs
![Page 20: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/20.jpg)
20
Example: NAND Gate
ab
zDesign name
andInterface
NAND
entity nand_gate isport( a : in STD_LOGIC;
b : in STD_LOGIC;z : out STD_LOGIC);
end nand_gate;
![Page 21: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/21.jpg)
21
Example: NAND Gate – Function
a b z0 0 10 1 11 0 11 1 0
ab
z
ARCHITECTURE model OF nand_gate ISBEGIN
z <= a NAND b;END model;
![Page 22: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/22.jpg)
22
Example VHDL Code• 3 sections of VHDL code to describe a design.• File extension for a VHDL file is .vhd• Name of the file should be the same as the entity name
(nand_gate.vhd) [OpenCores Coding Guidelines]
LIBRARY DECLARATION
ENTITY DECLARATION
ARCHITECTURE BODY
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY nand_gate IS
PORT( a : IN STD_LOGIC;
b : IN STD_LOGIC;
z : OUT STD_LOGIC);
END nand_gate;
ARCHITECTURE model OF nand_gate IS
BEGIN
z <= a NAND b;
END model;
![Page 23: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/23.jpg)
23
Design Entity - most basic building block of a design.
One entity can have many different architectures.
entity declaration
architecture 1
architecture 2
architecture 3
design entity
Design Entity
![Page 24: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/24.jpg)
24
ENTITY nand_gate IS
PORT(
a : IN STD_LOGIC;
b : IN STD_LOGIC;
z : OUT STD_LOGIC
);
END ENTITY nand_gate;
Entity name Port names Port type Semicolon
No Semicolon after last port
Port modes (data flow directions)
Entity Declaration
• Entity Declaration describes an interface of the component, i.e. input and output ports.
![Page 25: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/25.jpg)
25
Entity Declaration – Simplified Syntax
ENTITY entity_name IS
PORT (
port_name : port_mode signal_type;
port_name : port_mode signal_type;
………….
port_name : port_mode signal_type
);
END ENTITY entity_name;
![Page 26: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/26.jpg)
26
a
EntityPort signal
Driver residesoutside the entity
Port Mode – IN
![Page 27: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/27.jpg)
27
Entity Port signal
Driver residesinside the entity
Output cannot be read within the entity
z
c <= z
c
Port Mode – OUT
![Page 28: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/28.jpg)
28
Port signal
EntityDriver residesinside the entity
Signal x can beread inside the entity
x
c
z
z <= xc <= x
Port Mode – OUT (with Extra Signal)
![Page 29: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/29.jpg)
29
Signal can beread inside the entity
EntityPort signal
Driver may reside both inside and outside of the entity
a
Port Mode – INOUT
![Page 30: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/30.jpg)
30
Port Modes – Summary
The Port Mode of the interface describes the direction in which data travels with respect to the component- In: Data comes into this port and can only be read within
the entity. It can appear only on the right side of a signal or variable assignment.
- Out: The value of an output port can only be updated within the entity. It cannot be read. It can only appear on the left side of a signal assignment.
- Inout: The value of a bi-directional port can be read and updated within the entity model. It can appear on both sides of a signal assignment.
![Page 31: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/31.jpg)
31
Architecture (Architecture body)
• Describes an implementation of a design entity
• Architecture example:
ARCHITECTURE dataflow OF nand_gate ISBEGIN
z <= a NAND b;END [ARCHITECTURE] dataflow;
Logic operators: NOT, AND, OR, NAND, NOR, XOR, XNOR
![Page 32: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/32.jpg)
32
Architecture – Simplified Syntax
ARCHITECTURE architecture_name OF entity_name IS
Declarations
BEGIN
Concurrent statements
END [ARCHITECTURE] architecture_name;
![Page 33: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/33.jpg)
33
Entity Declaration & ArchitectureLIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY nand_gate IS
PORT( a : IN STD_LOGIC;
b : IN STD_LOGIC;
z : OUT STD_LOGIC);
END ENTITY nand_gate;
ARCHITECTURE dataflow OF nand_gate IS
BEGIN
z <= a NAND b;
END ARCHITECTURE dataflow;
![Page 34: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/34.jpg)
34
Tips & Hints
Place each entity in a different file.
The name of each file should be exactly the sameas the name of an entity it contains.
These rules are not enforced by all toolsbut are worth following in order to increasereadability and portability of your designs
![Page 35: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/35.jpg)
35
Place the declaration of each port, signal, constant, and variable
in a separate linefor better readability
These rules are not enforced by all toolsbut are worth following in order to increasereadability and portability of your designs
Tips & Hints
![Page 36: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/36.jpg)
36
Libraries
![Page 37: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/37.jpg)
37
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY nand_gate IS
PORT( a : IN STD_LOGIC;
b : IN STD_LOGIC;
z : OUT STD_LOGIC);
END ENTITY nand_gate;
ARCHITECTURE dataflow OF nand_gate IS
BEGIN
z <= a NAND b;
END ARCHITECTURE dataflow;
Library Declarations
Use all definitions from the packagestd_logic_1164
Library declaration
![Page 38: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/38.jpg)
38
Library Declarations – Syntax
LIBRARY library_name;
USE library_name.package_name.package_parts;
![Page 39: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/39.jpg)
39
Structure of a Library
PACKAGE 1 PACKAGE 2
TYPESCONSTANTSFUNCTIONS
PROCEDURESCOMPONENTS
TYPESCONSTANTSFUNCTIONS
PROCEDURESCOMPONENTS
LIBRARY
![Page 40: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/40.jpg)
40
• ieee
• std
• work – current working directory
Libraries
Need to be explicitlydeclared
Visible by default
Specifies digital logic system,including STD_LOGIC, and STD_LOGIC_VECTOR types
Specifies built-in data types(BIT, BOOLEAN, INTEGER, REAL, SIGNED, UNSIGNED, etc.), arithmetic operations, basic type conversion functions, basic text i/o functions, etc.
Holds current designs after compilation
![Page 41: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/41.jpg)
41
Operators in Standard VHDL
RTL Hardware Design by P. Chu
Chapter 3 35
Operators in standard VHDL
![Page 42: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/42.jpg)
42
Standard VHDL – Data Types
• integer-Minimal range: -(2^31 – 1) to 2^31 – 1
• boolean: {true, false}• bit: {‘1’, ‘0’}• bit_vector: string of bits.- “0001_1111”
![Page 43: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/43.jpg)
43
STD_LOGIC Demystified
![Page 44: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/44.jpg)
44
STD_LOGICLIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY nand_gate IS
PORT( a : IN STD_LOGIC;
b : IN STD_LOGIC;
z : OUT STD_LOGIC);
END nand_gate;
ARCHITECTURE dataflow OF nand_gate IS
BEGIN
z <= a NAND b;
END dataflow;
![Page 45: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/45.jpg)
45
BIT versus STD_LOGIC
• VHDL standard BIT type - Can only model a value of ‘0’ or ‘1’
• STD_LOGIC can model nine values- ’U’, ’X’, ‘0’, ’1’, ’Z’, ’W’, ’L’, ’H’, ’-’- Useful mainly for simulation- ‘0’, ’1’, ‘X’ and ‘Z’ are synthesizable
(your codes should use only these four values)
![Page 46: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/46.jpg)
46
STD_LOGIC type demystified
Value Meaning
�U� Uninitialized
�X� Forcing (Strong driven) Unknown
�0� Forcing (Strong driven) 0
�1� Forcing (Strong driven) 1
�Z� High Impedance
�W� Weak (Weakly driven) Unknown
�L�Weak (Weakly driven) 0.Models a pull down.
�H�Weak (Weakly driven) 1.
Models a pull up.
�-� Don't Care
![Page 47: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/47.jpg)
47
More on STD_LOGIC Meanings (1)
�1�
�0�
�X� Contention on the bus
![Page 48: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/48.jpg)
48
More on STD_LOGIC Meanings (2)
![Page 49: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/49.jpg)
49
Resolving Logic Levels
U X 0 1 Z W L H -U U U U U U U U U UX U X X X X X X X X0 U X 0 X 0 0 0 0 X1 U X X 1 1 1 1 1 XZ U X 0 1 Z W L H XW U X 0 1 W W W W XL U X 0 1 L W L W XH U X 0 1 H W W H X- U X X X X X X X X
![Page 50: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/50.jpg)
50
STD_LOGIC Rules
• In this course, use only std_logic or std_logic_vector for all entity input or output ports
• Do NOT use integer, unsigned, signed, bit for ports- You can use them inside of architectures if desired- You can use them in generics
• Instead use std_logic_vector and a conversion function inside of your architecture[Consistent with OpenCores Coding Guidelines]
![Page 51: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/51.jpg)
51
Signals Modeling Wires and Buses
SIGNAL a : STD_LOGIC;
SIGNAL b : STD_LOGIC_VECTOR(7 DOWNTO 0);
wirea
busb
1
8
![Page 52: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/52.jpg)
52
Standard Logic Vectors
SIGNAL a: STD_LOGIC;
SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL c: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL d: STD_LOGIC_VECTOR(15 DOWNTO 0);
SIGNAL e: STD_LOGIC_VECTOR(8 DOWNTO 0);
……….
a <= �1�; --assign a with logic ONE
b <= �0000�; --Binary base assumed by default
c <= B�0000�; --Binary base explicitly specified
d <= X�AF67�; -- Hexadecimal base
e <= O�723�; -- Octal base
![Page 53: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/53.jpg)
53
Vectors and ConcatenationSIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL c, d, e: STD_LOGIC_VECTOR(7 DOWNTO 0);
a <= �0000�;
b <= �1111�;
c <= a & b; -- c = �00001111�
d <= �0� & �0001111�; -- d <= �00001111�
e <= �0� & �0� & �0� & �0� & �1� & �1� &
�1� & �1�; -- e <= �00001111�
![Page 54: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/54.jpg)
54
Merging Wires and Buses
SIGNAL addr : STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL data : STD_LOGIC_VECTOR(4 DOWNTO 0);
SIGNAL ctrl : STD_LOGIC_vector(1 downto 0);
SIGNAL bus : STD_LOGIC_VECTOR(10 DOWNTO 0);
bus <= addr & data & ctrl;
4
5
10
2
addr
data
ctrl
bus
![Page 55: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/55.jpg)
55
Splitting Buses
SIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO 0);
SIGNAL b: STD_LOGIC_VECTOR(4 DOWNTO 0);
SIGNAL c: STD_LOGIC;
SIGNAL d: STD_LOGIC_VECTOR(9 DOWNTO 0);
a <= d(9 downto 6);
b <= d(5 downto 1);
c <= d(0);
4
5
10
a
b
c
d
![Page 56: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/56.jpg)
56
Modeling Styles
![Page 57: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/57.jpg)
57
Design Entity - most basic building block of a design.
One entity can have many different architectures.
entity declaration
architecture 1
architecture 2
architecture 3
design entity
Design Entity
![Page 58: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/58.jpg)
58
Types of VHDL Descriptions
Components andinterconnects
structural
VHDL Descriptions
dataflow
Concurrent statements
behavioral
• Registers• State machines• Decoders
Sequential statements
Subset most suitable for synthesis
• Testbenches
![Page 59: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/59.jpg)
59
xor3 Example
![Page 60: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/60.jpg)
60
Entity xor3 Gate
LIBRARY ieee;USE ieee.std_logic_1164.all;
ENTITY xor3 ISPORT( A : IN STD_LOGIC;
B : IN STD_LOGIC;C : IN STD_LOGIC;Result : OUT STD_LOGIC);
end ENTITY xor3;
![Page 61: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/61.jpg)
61
Dataflow Modeling
![Page 62: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/62.jpg)
62
Dataflow Architecture - xor3 Gate
ARCHITECTURE dataflow OF xor3 IS
SIGNAL U1_OUT: STD_LOGIC;
BEGIN
U1_OUT <= A XOR B;
Result <= U1_OUT XOR C;
END ARCHITECTURE dataflow;
U1_OUT
![Page 63: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/63.jpg)
63
Dataflow Description • Describes how data moves through the various processing steps of the
system. - Uses series of concurrent statements to realize logic. - Most useful style when series of Boolean equations can represent a
logic à used to implement simple combinational logic
- Dataflow code also called concurrent code• Concurrent statements are evaluated at the same time; thus, the order of
these statements does NOT matter- This is not true for sequential/behavioral statements
U1_out <= A XOR B;
Result <= U1_out XOR C;
Result <= U1_out XOR C;
U1_out <= A XOR B;
Describe the same behavior
![Page 64: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/64.jpg)
64
Event-Driven Semantics
• When a concurrent statement is evaluated?
• An event is a change of value on a signal.• Consider the example in the previous slide.
when there is an event on a signal on the right hand side of an assignment.
U1_out <= A XOR B;
Result <= U1_out XOR C;
Result <= U1_out XOR C;
U1_out <= A XOR B;
![Page 65: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/65.jpg)
65
Event-Driven Semantics
U1_out <= A XOR B;
Result <= U1_out XOR C;
Result <= U1_out XOR C;
U1_out <= A XOR B;
0A 0B 0C 0U1_out 0Result 0
![Page 66: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/66.jpg)
66
Event-Driven Semantics
U1_out <= A XOR B;
Result <= U1_out XOR C;
Result <= U1_out XOR C;
U1_out <= A XOR B;
0 1A 0 1B 0 0C 0 0U1_out 0 0Result 0 0
![Page 67: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/67.jpg)
67
Event-Driven Semantics
U1_out <= A XOR B;
Result <= U1_out XOR C;
Result <= U1_out XOR C;
U1_out <= A XOR B;
0 1 1 + tA 0 1 1B 0 0 0C 0 0 0U1_out 0 0 1Result 0 0 0
![Page 68: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/68.jpg)
68
Event-Driven Semantics
U1_out <= A XOR B;
Result <= U1_out XOR C;
Result <= U1_out XOR C;
U1_out <= A XOR B;
0 1 1 + t 1 + 2tA 0 1 1 1B 0 0 0 0C 0 0 0 0U1_out 0 0 1 1Result 0 0 0 1
![Page 69: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/69.jpg)
69
Event-Driven Semantics – Another Example
U1_out <= A XOR B;
Result <= U1_out XOR C;
0 1A 0 1B 0 0C 0 1U1_out 0 0Result 0 0
![Page 70: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/70.jpg)
70
Event-Driven Semantics – Another Example
U1_out <= A XOR B;
Result <= U1_out XOR C;
0 1 1 + tA 0 1 1B 0 0 0C 0 1 1U1_out 0 0 1Result 0 0 1
![Page 71: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/71.jpg)
71
Event-Driven Semantics – Another Example
U1_out <= A XOR B;
Result <= U1_out XOR C;
0 1 1 + t 1 + 2tA 0 1 1 1B 0 0 0 0C 0 1 1 1U1_out 0 0 1 1Result 0 0 1 0
![Page 72: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/72.jpg)
72
Structural Modeling
![Page 73: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/73.jpg)
73
Structural Architecture – xor3 GateABC
Resultxor3I1I2
Y I1I2
YU1_OUT
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY xor2 IS
PORT( I1 : IN STD_LOGIC;
I2 : IN STD_LOGIC;
Y : OUT STD_LOGIC);
END ENTITY xor2;
ARCHITECTURE dataflow OF xor2 IS
BEGIN
Y <= I1 xor I2;
END ARCHITECTURE dataflow;
xor2.vhd
![Page 74: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/74.jpg)
74
Structural Architecture in VHDL 93
ARCHITECTURE structural OF xor3 IS
SIGNAL U1_OUT: STD_LOGIC;
BEGIN
U1: entity work.xor2(dataflow) –- VHDL93 style
PORT MAP (I1 => A, I2 => B, Y => U1_OUT);
U2: entity work.xor2(dataflow)
PORT MAP (I1 => U1_OUT, I2 => C, Y => Result);
END ARCHITECTURE structural;
ABC
Resultxor3I1I2
Y I1I2
Y
U1_OUT
![Page 75: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/75.jpg)
75
Structural Architecture in VHDL 93
inst_label: entity lib_name.entity_name(arch_name)
PORT MAP (
port1 => actual_signal1,
port2 => actual_signal2,
...
);
General Syntax
Actual signals can be• ports of the entity where the component is instantiated• signals declared in the architecture body
![Page 76: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/76.jpg)
76
I1I2
Y I1I2
Y
U1_OUT
Structural Architecture in VHDL 87ARCHITECTURE structural OF xor3 IS
SIGNAL U1_OUT: STD_LOGIC;COMPONENT xor2
PORT(I1 : IN STD_LOGIC;I2 : IN STD_LOGIC;Y : OUT STD_LOGIC);
END COMPONENT;
BEGINU1: xor2 PORT MAP (I1 => A, I2 => B, Y=> U1_OUT);
U2: xor2 PORT MAP (I1 => U1_OUT,I2 => C,Y => Result);
END structural;
ABC
Resultxor3
![Page 77: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/77.jpg)
77
Structural Description
• Allows divide-n-conquer for large designs.• This style is the closest to schematic capture and
utilizes simple building blocks to compose logic functions.
• Components are interconnected in a hierarchical manner.
• Structural descriptions may connect simple gates or complex, abstract components.
• Structural style is useful when expressing a design that is naturally composed of sub-blocks.
![Page 78: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/78.jpg)
78
Behavioral Modeling
![Page 79: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/79.jpg)
79
Behavioral Architecture – xor3 Gate
ARCHITECTURE behavioral OF xor3 ISBEGINxor3_behave: PROCESS (A, B, C)BEGIN
IF ((A XOR B XOR C) = '1') THENResult <= '1';
ELSEResult <= '0';
END IF;END PROCESS xor3_behave;
END ARCHITECTURE behavioral;
![Page 80: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/80.jpg)
80
Behavioral Description
• It describes what happens on the inputs and outputs of the black box (no matter how a design is actually implemented).- Focus on functions mapping inputs to outputs- Similar to dataflow style, -More like sequential SW programming.
• This style uses process statements in VHDL.- A process itself is a concurrent statement.- A process consist of sequential statements.
• More will be covered later.
![Page 81: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/81.jpg)
81
Verification and Test Bench
![Page 82: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/82.jpg)
82
Design Testing and Testbenches
• After a design is done, it needs to be tested.• During testing, design inputs are driven by
various test vectors, and• Outputs are monitored and checked.
Test vector generator
UUT/DUT
Monitor
![Page 83: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/83.jpg)
83
Testbench in VHDL
Test vector generator
UUT/DUT
Monitor
testbench
library ieee;use ieee.std_logic_1164.all;
ENTITY testbench ISEND testbench;
![Page 84: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/84.jpg)
84
ARCHITECTURE tb_arch OF testbench IS-- signal declarationssignal A, B, C, Result : std_logic;
BEGIN-- Instantiate the design under test.
uut: entity work.xor3(structural)port map (A => A, B => B, ... );
-- test vector generatortest_gen: processbegin
-- generate sequence of vectors to-- drive design inputs A, B, and C.
end process;end tb_arch;
![Page 85: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/85.jpg)
85
ARCHITECTURE tb_arch OF testbench IS-- signal declarationssignal A, B, C, Result : std_logic;
BEGIN-- DUT instance...-- test vector generatorprocessbegin
A <= ‘1’; -- first test vectorB <= ‘0’;C <= ‘0’;wait for 20ns; -- wait for circuit
-- to stablize...
end process;end tb_arch;
![Page 86: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/86.jpg)
86
Backup
![Page 87: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/87.jpg)
87
Brief History of VHDL
![Page 88: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/88.jpg)
88
Genesis of VHDL – State of art circa 1980-Multiple design entry methods and hardware
description languages in use-No or limited portability of designs between CAD tools from different vendors-Objective: shortening the time from a design
concept to implementation from 18 months to 6 months
![Page 89: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/89.jpg)
89
A Brief History of VHDL
• July 1983: a DoD contract for the development of VHDL awarded to-Intermetrics-IBM-Texas Instruments
• August 1985: VHDL Version 7.2 released• December 1987:
VHDL became IEEE Standard 1076-1987 and in 1988 an ANSI standard
![Page 90: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/90.jpg)
90
Verilog
![Page 91: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/91.jpg)
91
- Essentially identical in function to VHDL- Simpler and syntactically different
• C-like- Gateway Design Automation Co., 1985- Gateway acquired by Cadence in 1990- IEEE Standard 1364-1995 (Verilog-95)- Early de facto standard for ASIC design- Two subsequent versions
• Verilog 2001 (major extensions) ← dominant version used in industry
• Verilog 2005 (minor changes)- Programming language interface to allow connection to non-
Verilog code
Verilog
![Page 92: CDA 4253 FPGA System Design Introduction to VHDLhaozheng/teach/cda4253/slides/... · 2019. 1. 17. · 30 Port Modes –Summary The Port Modeof the interface describes the direction](https://reader036.vdocument.in/reader036/viewer/2022081616/5fe8cba1c12211713c3c853a/html5/thumbnails/92.jpg)
92
Types of VHDL Descriptions: Alternative View
Components & interconnects
Structural
VHDL Descriptions
dataflow
Concurrent statements
algorithmic
Sequential statements
Behavioral