CDA 4253 FPGA System Design Introduction to VHDL Hao Zheng Dept of - - PowerPoint PPT Presentation

cda 4253 fpga system design introduction to vhdl
SMART_READER_LITE
LIVE PREVIEW

CDA 4253 FPGA System Design Introduction to VHDL Hao Zheng Dept of - - PowerPoint PPT Presentation

CDA 4253 FPGA System Design Introduction to VHDL Hao Zheng Dept of Comp Sci & Eng USF Reading P. Chu, FPGA Prototyping by VHDL Examples - Chapter 1, Gate-level combinational circuits Xilinx XST User Guide - Xilinx specific


slide-1
SLIDE 1

CDA 4253 FPGA System Design Introduction to VHDL

Hao Zheng Dept of Comp Sci & Eng USF

slide-2
SLIDE 2

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
slide-3
SLIDE 3

3

Recommended reading

  • Wikipedia – The Free On-line Encyclopedia

VHDL - http://en.wikipedia.org/wiki/VHDL Verilog - http://en.wikipedia.org/wiki/Verilog

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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
slide-6
SLIDE 6

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

slide-7
SLIDE 7

7

Features of VHDL/Verilog

  • Technology/vendor independent
  • Portable
  • Reusable
slide-8
SLIDE 8

8

Good VHDL/Verilog Books

coming soon

slide-9
SLIDE 9

9

VHDL Fundamentals

slide-10
SLIDE 10

10

Naming and Labeling (1)

  • VHDL is case insensitive.

Example:

Names or labels databus Databus DataBus DATABUS are all equivalent

  • Avoid inconsistent styles
slide-11
SLIDE 11

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.

slide-12
SLIDE 12

12

Extended Identifiers

Allowed only in VHDL-93 and higher:

1. Enclosed in backslashes 2. May contain spaces and consecutive underscores 3. May contain punctuation and reserved characters within a name (!, ?, ., &, +, -, etc.) 4. VHDL keywords allowed 5. Case sensitive Examples: \rdy\ \My design\ \!a\ \RDY\ \my design\ \-a\ Should not be used to avoid confusioin!

slide-13
SLIDE 13

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”
slide-14
SLIDE 14

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

slide-15
SLIDE 15

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 as a 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

slide-16
SLIDE 16

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

slide-17
SLIDE 17

17

Free Format

  • VHDL is a free format language

No formatting conventions, such as spacing or indentation imposed by VHDL compilers. Space, tabs, and carriage return treated the same way.

Example: if (a=b) then

  • r

if (a=b) then

  • r

if (a = b) then

are all equivalent

slide-18
SLIDE 18

18

Readability Standards & Coding Style

Adopt 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 following these recommendations!!!

slide-19
SLIDE 19

19

Describing Designs

slide-20
SLIDE 20

20

Example: NAND Gate

a b z

Design name and Interface

NAND

entity nand_gate is port( a : in STD_LOGIC; b : in STD_LOGIC; z : out STD_LOGIC); end nand_gate;

slide-21
SLIDE 21

21

Example: NAND Gate – Function

a b z 1 1 1 1 1 1 1 a b z ARCHITECTURE model OF nand_gate IS BEGIN z <= a NAND b; END model;

slide-22
SLIDE 22

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 LIBRARY ieee ieee; USE USE ieee ieee.std_logic_1164.all; .std_logic_1164.all; ENTITY ENTITY nand_gate IS IS PORT PORT( a : IN STD_LOGIC : IN STD_LOGIC; b : IN STD_LOGIC IN STD_LOGIC; z : OUT STD_LOGIC OUT STD_LOGIC); END END nand_gate; ARCHITECTURE ARCHITECTURE model OF OF nand_gate IS IS BEGIN BEGIN z <= a NAND NAND b; END END model;

slide-23
SLIDE 23

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

slide-24
SLIDE 24

24

ENTITY ENTITY nand_gate IS IS PORT PORT( a : IN STD_LOGIC IN STD_LOGIC; b : IN STD_LOGIC IN STD_LOGIC; z : OUT STD_LOGIC OUT STD_LOGIC ); END 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.

slide-25
SLIDE 25

25

Entity Declaration – Simplified Syntax

ENTITY ENTITY entity_name IS IS PORT ( PORT ( port_name : : port_mode signal_type; port_name : : port_mode signal_type; …………. …………. port_name : : port_mode signal_type ); ); END ENTITY END ENTITY entity_name;

slide-26
SLIDE 26

26

a Entity Port signal Driver resides

  • utside the entity

Port Mode – IN

slide-27
SLIDE 27

27

Entity Port signal Driver resides inside the entity Output cannot be read within the entity z

c <= z

c

Port Mode – OUT

slide-28
SLIDE 28

28

Port signal Entity Driver resides inside the entity Signal x can be read inside the entity

x c

z z <= x c <= x

Port Mode – OUT (with Extra Signal)

slide-29
SLIDE 29

29

Signal can be read inside the entity Entity Port signal Driver may reside both inside and

  • utside of the entity

a

Port Mode – INOUT

slide-30
SLIDE 30

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

  • r 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.

slide-31
SLIDE 31

31

Architecture (Architecture body)

  • Describes an implementation of a design

entity

  • Architecture example:

ARCHITECTURE dataflow OF nand_gate IS BEGIN z <= a NAND b; END [ARCHITECTURE] dataflow;

Logic operators: NOT NOT, AND AND, OR OR, NAND NAND, NOR NOR, XOR XOR, XNOR XNOR

slide-32
SLIDE 32

32

Architecture – Simplified Syntax

ARCHITECTURE ARCHITECTURE architecture_name OF OF entity_name IS IS Declarations Declarations BEGIN BEGIN Concurrent statements Concurrent statements END [ARCHITECTURE] END [ARCHITECTURE] architecture_name;

slide-33
SLIDE 33

33

Entity Declaration & Architecture

LIBRARY LIBRARY ieee ieee; USE USE ieee ieee.std_logic_1164.all; .std_logic_1164.all; ENTITY ENTITY nand_gate IS IS PORT PORT( a : IN STD_LOGIC : IN STD_LOGIC; b : IN STD_LOGIC IN STD_LOGIC; z : OUT STD_LOGIC OUT STD_LOGIC); END END ENTITY ENTITY nand_gate; ARCHITECTURE ARCHITECTURE dataflow OF OF nand_gate IS IS BEGIN BEGIN z <= a NAND NAND b; END END ARCHITECTURE ARCHITECTURE dataflow;

slide-34
SLIDE 34

34

Tips & Hints

Place each entity in a different file. The name of each file should be exactly the same as the name of an entity it contains.

These rules are not enforced by all tools but are worth following in order to increase readability and portability of your designs

slide-35
SLIDE 35

35

Place the declaration of each port, signal, constant, and variable in a separate line for better readability

These rules are not enforced by all tools but are worth following in order to increase readability and portability of your designs

Tips & Hints

slide-36
SLIDE 36

36

Libraries

slide-37
SLIDE 37

37

LIBRARY LIBRARY ieee ieee; USE USE ieee ieee.std_logic_1164.all; .std_logic_1164.all;

ENTITY ENTITY nand_gate IS IS PORT PORT( a : IN STD_LOGIC : IN STD_LOGIC; b : IN STD_LOGIC IN STD_LOGIC; z : OUT STD_LOGIC OUT STD_LOGIC); END END ENTITY ENTITY nand_gate; ARCHITECTURE ARCHITECTURE dataflow OF OF nand_gate IS IS BEGIN BEGIN z <= a NAND NAND b; END END ARCHITECTURE ARCHITECTURE dataflow;

Library Declarations

Use all definitions from the package std_logic_1164 Library declaration

slide-38
SLIDE 38

38

Library Declarations – Syntax

LIBRARY LIBRARY library_name; USE USE library_name.package_name.package_parts;

slide-39
SLIDE 39

39

Structure of a Library

PACKAGE 1 PACKAGE 2 TYPES CONSTANTS FUNCTIONS PROCEDURES COMPONENTS TYPES CONSTANTS FUNCTIONS PROCEDURES COMPONENTS LIBRARY

slide-40
SLIDE 40

40

  • ieee
  • std
  • work – current working directory

Libraries

Need to be explicitly declared 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

  • perations, basic type conversion

functions, basic text i/o functions, etc. Holds current designs after compilation

slide-41
SLIDE 41

41

Operators in Standard VHDL

slide-42
SLIDE 42

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”
slide-43
SLIDE 43

43

STD_LOGIC Demystified

slide-44
SLIDE 44

44

STD_LOGIC

LIBRARY LIBRARY ieee ieee; USE USE ieee ieee.std_logic_1164.all; .std_logic_1164.all; ENTITY ENTITY nand_gate IS IS PORT PORT( a : IN : IN STD_LOGIC STD_LOGIC; b : IN IN STD_LOGIC STD_LOGIC; z : OUT OUT STD_LOGIC STD_LOGIC); END END nand_gate; ARCHITECTURE ARCHITECTURE dataflow OF OF nand_gate IS IS BEGIN BEGIN z <= a NAND NAND b; END END dataflow;

slide-45
SLIDE 45

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)

slide-46
SLIDE 46

46

STD_LOGIC type demystified

Value Meaning

U Uninitialized X Forcing (Strong driven) Unknown 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
slide-47
SLIDE 47

47

More on STD_LOGIC Meanings (1)

1 X Contention on the bus

slide-48
SLIDE 48

48

More on STD_LOGIC Meanings (2)

slide-49
SLIDE 49

49

Resolving Logic Levels

U X 0 1 Z W L H - U U U U U U U U U U X U X X X X X X X X 0 U X 0 X 0 0 0 0 X 1 U X X 1 1 1 1 1 X Z U X 0 1 Z W L H X W U X 0 1 W W W W X L U X 0 1 L W L W X H U X 0 1 H W W H X

  • U X X X X X X X X
slide-50
SLIDE 50

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]

slide-51
SLIDE 51

51

Signals Modeling Wires and Buses

SIGNAL SIGNAL a : STD_LOGIC; SIGNAL SIGNAL b : STD_LOGIC_VECTOR(7 DOWNTO DOWNTO 0);

wire

a

bus

b

1 8

slide-52
SLIDE 52

52

Standard Logic Vectors

SIGNAL SIGNAL a: STD_LOGIC; SIGNAL SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO DOWNTO 0); SIGNAL SIGNAL c: STD_LOGIC_VECTOR(3 DOWNTO DOWNTO 0); SIGNAL SIGNAL d: STD_LOGIC_VECTOR(15 DOWNTO DOWNTO 0); SIGNAL SIGNAL e: STD_LOGIC_VECTOR(8 DOWNTO DOWNTO 0); ………. a <= 1;

  • -assign a with logic ONE

b <= 0000;

  • -Binary base assumed by default

c <= B0000;

  • -Binary base explicitly specified

d <= XAF67;

  • - Hexadecimal base

e <= O723;

  • - Octal base
slide-53
SLIDE 53

53

Vectors and Concatenation

SIGNAL SIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO DOWNTO 0); SIGNAL SIGNAL b: STD_LOGIC_VECTOR(3 DOWNTO DOWNTO 0); SIGNAL SIGNAL c, d, e: STD_LOGIC_VECTOR(7 DOWNTO 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
slide-54
SLIDE 54

54

Merging Wires and Buses

SIGNAL SIGNAL addr : STD_LOGIC_VECTOR(3 DOWNTO DOWNTO 0); SIGNAL SIGNAL data : STD_LOGIC_VECTOR(4 DOWNTO DOWNTO 0); SIGNAL SIGNAL ctrl : STD_LOGIC_vector(1 downto 0); SIGNAL SIGNAL bus : STD_LOGIC_VECTOR(10 DOWNTO DOWNTO 0); bus <= addr & data & ctrl;

4 5 10

2 addr data ctrl bus

slide-55
SLIDE 55

55

Splitting Buses

SIGNAL SIGNAL a: STD_LOGIC_VECTOR(3 DOWNTO DOWNTO 0); SIGNAL SIGNAL b: STD_LOGIC_VECTOR(4 DOWNTO DOWNTO 0); SIGNAL SIGNAL c: STD_LOGIC; SIGNAL SIGNAL d: STD_LOGIC_VECTOR(9 DOWNTO DOWNTO 0); a <= d(9 downto downto 6); b <= d(5 downto downto 1); c <= d(0);

4 5 10

a b c d

slide-56
SLIDE 56

56

Modeling Styles

slide-57
SLIDE 57

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

slide-58
SLIDE 58

58

Types of VHDL Descriptions

Components and interconnects

structural VHDL Descriptions dataflow

Concurrent statements

behavioral

  • Registers
  • State machines
  • Decoders

Sequential statements

Subset most suitable for synthesis

  • Testbenches
slide-59
SLIDE 59

59

xor3 Example

slide-60
SLIDE 60

60

Entity xor3 Gate

LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY xor3 IS PORT( A : IN STD_LOGIC; B : IN STD_LOGIC; C : IN STD_LOGIC; Result : OUT STD_LOGIC); end ENTITY xor3;

slide-61
SLIDE 61

61

Dataflow Modeling

slide-62
SLIDE 62

62

Dataflow Architecture - xor3 Gate

ARCHITECTURE ARCHITECTURE dataflow OF OF xor3 IS IS SIGNAL SIGNAL U1_OUT: STD_LOGIC; BEGIN BEGIN U1_OUT <= A XOR XOR B; Result <= U1_OUT XOR XOR C; END END ARCHITECTURE ARCHITECTURE dataflow;

U1_OUT

slide-63
SLIDE 63

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 XOR B; Result <= U1_out XOR XOR C; Result <= U1_out XOR XOR C; U1_out <= A XOR XOR B; Describe the same behavior

slide-64
SLIDE 64

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 XOR B; Result <= U1_out XOR XOR C; Result <= U1_out XOR XOR C; U1_out <= A XOR XOR B;

slide-65
SLIDE 65

65

Event-Driven Semantics

U1_out <= A XOR XOR B; Result <= U1_out XOR XOR C; Result <= U1_out XOR XOR C; U1_out <= A XOR XOR B;

A B C U1_out Result

slide-66
SLIDE 66

66

Event-Driven Semantics

U1_out <= A XOR XOR B; Result <= U1_out XOR XOR C; Result <= U1_out XOR XOR C; U1_out <= A XOR XOR B;

1 A 1 B C U1_out Result

slide-67
SLIDE 67

67

Event-Driven Semantics

U1_out U1_out <= A XOR XOR B; Result <= U1_out U1_out XOR XOR C; Result <= U1_out U1_out XOR XOR C; U1_out U1_out <= A XOR XOR B;

1 1 + t A 1 1 B C U1_out 1 Result

slide-68
SLIDE 68

68

Event-Driven Semantics

U1_out <= A XOR XOR B; Result Result <= U1_out XOR XOR C; Result Result <= U1_out XOR XOR C; U1_out <= A XOR XOR B;

1 1 + t 1 + 2t A 1 1 1 B C U1_out 1 1 Result 1

slide-69
SLIDE 69

69

Event-Driven Semantics – Another Example

U1_out <= A XOR XOR B; Result <= U1_out XOR XOR C;

1 A 1 B C 1 U1_out Result

slide-70
SLIDE 70

70

Event-Driven Semantics – Another Example

U1_out U1_out <= A XOR XOR B; Result Result <= U1_out U1_out XOR XOR C;

1 1 + t A 1 1 B C 1 1 U1_out 1 Result 1

slide-71
SLIDE 71

71

Event-Driven Semantics – Another Example

U1_out <= A XOR B; Result Result <= U1_out XOR XOR C;

1 1 + t 1 + 2t A 1 1 1 B C 1 1 1 U1_out 1 1 Result 1

slide-72
SLIDE 72

72

Structural Modeling

slide-73
SLIDE 73

73

Structural Architecture – xor3 Gate

A B C Result xor3

I1 I2 Y I1 I2 Y

U1_OUT

LIBRARY LIBRARY ieee ieee; USE USE ieee ieee.std_logic_1164.all; .std_logic_1164.all; ENTITY ENTITY xor2 IS IS PORT PORT( I1 : IN STD_LOGIC : IN STD_LOGIC; I2 : IN STD_LOGIC IN STD_LOGIC; Y : OUT STD_LOGIC OUT STD_LOGIC); END END ENTITY ENTITY xor2; ARCHITECTURE ARCHITECTURE dataflow OF OF xor2 IS IS BEGIN BEGIN Y <= I1 xor xor I2; END END ARCHITECTURE ARCHITECTURE dataflow;

xor2.vhd

slide-74
SLIDE 74

74

Structural Architecture in VHDL 93

ARCHITECTURE ARCHITECTURE structural OF OF xor3 IS IS SIGNAL SIGNAL U1_OUT: STD_LOGIC; BEGIN BEGIN U1: entity entity work.xor2(dataflow) –- VHDL93 style PORT MAP PORT MAP (I1 => A, I2 => B, Y => U1_OUT); U2: entity entity work.xor2(dataflow) PORT MAP PORT MAP (I1 => U1_OUT, I2 => C, Y => Result); END END ARCHITECTURE ARCHITECTURE structural;

A B C Result xor3

I1 I2 Y I1 I2 Y

U1_OUT

slide-75
SLIDE 75

75

Structural Architecture in VHDL 93

inst_label: entity entity lib_name.entity_name(arch_name) PORT MAP 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
slide-76
SLIDE 76

76

I1 I2 Y I1 I2 Y

U1_OUT

Structural Architecture in VHDL 87

ARCHITECTURE ARCHITECTURE structural OF OF xor3 IS IS SIGNAL SIGNAL U1_OUT: STD_LOGIC; COMPONENT xor2 COMPONENT xor2 PORT PORT( I1 : IN IN STD_LOGIC; I2 : IN IN STD_LOGIC; Y : OUT OUT STD_LOGIC); END COMPONENT END COMPONENT; BEGIN BEGIN U1: xor2 PORT MAP PORT MAP (I1 => A, I2 => B, Y=> U1_OUT); U2: xor2 PORT MAP PORT MAP (I1 => U1_OUT, I2 => C, Y => Result); END END structural;

A B C Result xor3

slide-77
SLIDE 77

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
  • r complex, abstract components.
  • Structural style is useful when expressing a design

that is naturally composed of sub-blocks.

slide-78
SLIDE 78

78

Behavioral Modeling

slide-79
SLIDE 79

79

Behavioral Architecture – xor3 Gate

ARCHITECTURE ARCHITECTURE behavioral OF OF xor3 IS IS BEGIN BEGIN xor3_behave: PROCESS PROCESS (A, B, C) BEGIN BEGIN IF IF ((A XOR XOR B XOR XOR C) = '1') THEN THEN Result <= '1'; ELSE ELSE Result <= '0'; END IF END IF; END PROCESS END PROCESS xor3_behave; END END ARCHITECTURE

ARCHITECTURE behavioral;

slide-80
SLIDE 80

80

Behavioral Description

  • It describes what happens on the inputs and
  • utputs 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.
slide-81
SLIDE 81

81

Verification and Test Bench

slide-82
SLIDE 82

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

slide-83
SLIDE 83

83

Testbench in VHDL

Test vector generator UUT/ DUT Monitor testbench

library library ieee; use use ieee.std_logic_1164.all; ll; ENTITY ENTITY testbench IS IS END END testbench;

slide-84
SLIDE 84

84

ARCHITECTURE ARCHITECTURE tb_arch OF OF testbench IS IS

  • - signal declarations

signal A, B, C, Result : std_logic;

BEGIN BEGIN

  • - Instantiate the design under test.

uut: entity work.xor3(structural) port map port map (A => A, B => B, ... );

  • - test vector generator

test_gen: process process begin begin

  • - generate sequence of vectors to
  • - drive

drive design inputs A, B, and C.

end end process process; end nd tb_arch;

slide-85
SLIDE 85

85

ARCHITECTURE ARCHITECTURE tb_arch OF OF testbench IS IS

  • - signal declarations

signal A, B, C, Result : std_logic; BEGIN BEGIN

  • - DUT instance

...

  • - test vector generator

process process begin begin A <= ‘1’; -- first test vector B <= ‘0’; C <= ‘0’; wait wait for 20ns; -- wait for circuit

  • - to stablize

... end process end process; end end tb_arch;

slide-86
SLIDE 86

86

Backup

slide-87
SLIDE 87

87

Brief History of VHDL

slide-88
SLIDE 88

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

slide-89
SLIDE 89

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

slide-90
SLIDE 90

90

Verilog

slide-91
SLIDE 91

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

slide-92
SLIDE 92

92

Types of VHDL Descriptions: Alternative View

Components & interconnects

Structural VHDL Descriptions dataflow

Concurrent statements

algorithmic

Sequential statements

Behavioral