welcome to the ece 449 computer design...

28
VHDL Overview ECOM 4311 Digital System Design

Upload: others

Post on 09-Feb-2020

10 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

VHDL

Overview

ECOM 4311

Digital System Design

Page 2: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

2

Outline

• VHDL Design Styles

• Test bench

Page 3: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

3

Required reading

• P. Chu, RTL Hardware Design using VHDL

Chapter 2.2. BASIC VHDL CONCEPT

VIA AN EXAMPLE

Page 4: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

VHDL Design Styles

Page 5: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

5

VHDL Design Styles

Components and interconnects

structural

VHDL Design

Styles

dataflow

Concurrent statements

behavioral

(sequential)

• Registers

• State machines

• Decoders

Sequential statements

Subset most suitable for synthesis

• Testbenches

Page 6: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

6

VHDL Design Styles

• Commonly used modeling styles in

hardware description are:

• Structural: Circuit is described as a

network of interconnected components

• Behavioral: Circuit is described as an i/o

relationship using sequential statements

inside a process

• Dataflow: Circuit is described using

concurrent statements

Page 7: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

7

Example: 3 input XOR

Page 8: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

8

Entity xor3_gate

LIBRARY ieee;

USE ieee.std_logic_1164.all;

ENTITY xor3_gate IS

PORT(

A : IN STD_LOGIC;

B : IN STD_LOGIC;

C : IN STD_LOGIC;

Result : OUT STD_LOGIC

);

end xor3_gate;

Page 9: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

9

Dataflow Architecture (xor3_gate)

ARCHITECTURE dataflow OF xor3_gate IS

SIGNAL U1_OUT: STD_LOGIC;

BEGIN

U1_OUT <= A XOR B;

Result <= U1_OUT XOR C;

END dataflow;

U1_OUT

Page 10: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

10

Dataflow Description

• Describes how data moves through the system and the various processing steps.

• Dataflow uses series of concurrent statements to realize logic.

• Dataflow is 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 doesn’t matter

• This is not true for sequential/behavioral statements

This order…

U1_out <= A XOR B;

Result <= U1_out XOR C;

Is the same as this order…

Result <= U1_out XOR C;

U1_out <= A XOR B;

Page 11: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

11

Structural Architecture

• A formal VHDL structural description is

done using the concept of ’component’

• First declared (make known)

• Then instantiated (used)

Page 12: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

12

Structural Architecture ARCHITECTURE structural OF xor3_gate IS

SIGNAL U1_OUT: STD_LOGIC;

COMPONENT xor2 -- declaration for xor gate

PORT(

I1 : IN STD_LOGIC;

I2 : IN STD_LOGIC;

Y : OUT STD_LOGIC

);

END COMPONENT;

BEGIN

-- instantiation of the 1st xor instance

U1: xor2 PORT MAP (I1 => A,

I2 => B,

Y => U1_OUT);

-- instantiation of the 1st xor instance

U2: xor2 PORT MAP (I1 => U1_OUT,

I2 => C,

Y => Result);

END structural;

A

B

C

Result xor3_gate

I1

I2 Y I1

I2 Y

U1_OUT

PORT NAME

LOCAL WIRE NAME

Page 13: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

13

xor2

• The definition of the actual components are ’decoupled’

and ’hidden’ from the architecture and can be defined

(and later changed) in a library

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 xor2;

ARCHITECTURE dataflow OF xor2 IS

BEGIN

Y <= I1 xor I2;

END dataflow;

xor2.vhd

Page 14: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

14

Structural Description

• Structural design is the simplest to understand.

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 15: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

15

Structural Description

Even-parity Detector Example

• Consider the even-parity detector again

• Assume there is a library of predesigned

parts, xor2 and not1:

Page 16: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

16

Structural Description

Even-parity Detector Example

Page 17: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

17

Somewhere in library

Page 18: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

18

Behavioral Architecture

• Human reasoning and algorithms resemble

a sequential process

• VHDL provides language constructs that

resemble sequential semantics

• The process: a language construct to

encapsulate “sequential semantics”

• The entire process statement is a

concurrent statement

Page 19: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

19

• Syntax:

process (sensitivity_list)

variable declaration;

begin

sequential statements;

end process;

• The process has a sensitivity list, which is a set of signals

• When a signal in the sensitivity list changes, the process

is activated

• Inside the process, the semantics are similar to that of a

PL, e.g., variables can be used and execution of the

statements is sequential

Behavioral Architecture

Page 20: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

20

• Unlike signal assignment in a concurrent statement, the variable and

loop constructs do NOT have a direct hardware counterpart

Behavioral Architecture

Even-parity Detector Example

Page 21: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

21

Behavioral Description

• The process should be treated as one indivisible part,

whose behavior is specified by sequential statements

• The code describes the behavior of the component, not

the structure.

• Conceptual interpretation:

Page 22: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

22

A second example:

Page 23: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

23 ECE 448 – FPGA and ASIC Design with VHDL

Testbenches

Page 24: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

24

Testbench

• a “virtual” experiment table • Circuit to be tested

• Input stimuli (e.g., function generator)

• Output monitor (e.g., logic analyzer)

• e.g.,

Page 25: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

25

Example: Even_Parity_Detector

Page 26: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL
Page 27: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL
Page 28: Welcome to the ECE 449 Computer Design Labsite.iugaza.edu.ps/rsalamah/files/2013/09/lecture3_VHDL_overview.pdf · • P. Chu, RTL Hardware Design using VHDL Chapter 2.2. BASIC VHDL

28

?