hardware description languages1 - sharif

41
1 [email protected] Hardware Description Languages VHDL

Upload: others

Post on 13-Apr-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hardware Description Languages1 - Sharif

1

[email protected]

Hardware Description Languages

VHDL

Page 2: Hardware Description Languages1 - Sharif

2

[email protected]

• Midterm 25%• Final 35%• Homework and Quiz 20%• Project 20%

• Reference:– Zain Navabi, ”VHDL, analysis and modeling of

digital systems”,McGraw-Hill,2nd Edition, 1998

Page 3: Hardware Description Languages1 - Sharif

3

[email protected]

Chapter 1

Hardware Design Environment

Page 4: Hardware Description Languages1 - Sharif

4

[email protected]

Digital System Design ProcessDesign Idea

Behavioral Design

Data Path Design

Logic Design

Physical Design

Manufacturing

Chip or Board

Flow Graph, Pseudo Code

Bus & Register Structure

Gate Wirelist, Netlist

Transistor List, Layout

Page 5: Hardware Description Languages1 - Sharif

5

[email protected]

Design Automation

• Design is completed when an idea is transformed into architecture or data pathdescription

• Transforming a design from one form to another

• Verifying a design stage output• Generating test data

Page 6: Hardware Description Languages1 - Sharif

6

[email protected]

The Art Of Modeling

Page 7: Hardware Description Languages1 - Sharif

7

[email protected]

Hardware Description Languages

• HDLs are used to describe hardware for the purpose of:– Modeling– Simulation– Testing– Design– Synthesis– Documentation

Page 8: Hardware Description Languages1 - Sharif

8

[email protected]

Hardware Description Languages

• Special purpose HDLs:– ISPS1, behavioral description HDL– AHPL2, data flow description HDL

• General purpose HDLs:– Verilog– VHDL– SystemC

1- Instruction Set Processor Specification

2- A Hardware Programming Language

Page 9: Hardware Description Languages1 - Sharif

9

[email protected]

Hardware Simulation

Simulation

Engine

Simulation Results

Test DataComponent

Library

Automatic test generation

Simulation Hardware

ModelHDL

Model

•Simulation time

•Output details

Page 10: Hardware Description Languages1 - Sharif

10

[email protected]

Simulator Types

• Based on HDL:– Behavioral Simulator– Data Flow Simulator– Gate Level Simulator– Device Simulator

• Based on Engine:– Oblivious– Event Driven

Page 11: Hardware Description Languages1 - Sharif

11

[email protected]

Hardware Synthesis

• A design aid that automatically transformsa design description from one form to another is a synthesis tool

• Many commercial synthesis tools use the output of the data path design

• Many commercial synthesis tools have targeted the FPGA market

Page 12: Hardware Description Languages1 - Sharif

12

[email protected]

Hardware Synthesis

• Synthesis process:1. Resource sharing2. Logic optimization3. Binding

a<=b+c;

c<=a AND e

b c

e

Adder

a

Page 13: Hardware Description Languages1 - Sharif

13

[email protected]

Chapter 2

VHDL Backgroound

Page 14: Hardware Description Languages1 - Sharif

14

[email protected]

VHDL Features

• General features– Describing from system to gate– Concurrency

• Support for design hierarchy– Operation of system can be specified based

on:• Its functionality• Its smaller subcomponents

• Library support

Page 15: Hardware Description Languages1 - Sharif

15

[email protected]

VHDL Features

• Sequential statements– Design based on functionality

• Generic design– Some conditions may influence model

operation, but it is not necessary to generate a new model

• Physical characteristics (delay)• Environment parameters (temperature)

Page 16: Hardware Description Languages1 - Sharif

16

[email protected]

VHDL Features

• Type declaration (strongly typed language)– Integer type– Floating point type– Enumerate types– User defined types– Operator overloading– Array types– Composite-type (records)

Page 17: Hardware Description Languages1 - Sharif

17

[email protected]

VHDL Features

• Use of subprograms (Function, Procedure)– Explicit type conversion– Logic unit definition– Operator redefinition– New operation definition

• Structural specification– Constructs for specifying structural

decomposition of hardware at all levels

Page 18: Hardware Description Languages1 - Sharif

18

[email protected]

VHDL Features

• Timing Control– Schedule values to signals– Delay the actual assignments until a later time– Allow any number of explicitly defined clock– Constructs for edge detection– Setup and hold time specification– Pulse width checking– Setting various time constraints

Page 19: Hardware Description Languages1 - Sharif

19

[email protected]

Chapter 3

Design Methodology Based on VHDL

Page 20: Hardware Description Languages1 - Sharif

20

[email protected]

VHDL Elements

• Components– Entity– Architecture

• Packages– Package declaration– Package body

• Configuration (binding)�Libraries

Page 21: Hardware Description Languages1 - Sharif

21

[email protected]

Component Description

Component ARCHITECTUREs

Logic Function

Component ENTITY

Interface to the Real World

Page 22: Hardware Description Languages1 - Sharif

22

[email protected]

Component Description

ENTITY ComponentName IS

input and output ports

physical and other parameters

END ComponentName;

ARCHITECTURE identifier OF ComponentName IS

declarations

BEGIN

specification of model in term of its

inputs and influenced by physical

and other parameters

END identifier;

Page 23: Hardware Description Languages1 - Sharif

23

[email protected]

Multiple Architecture Specification

ENTITY cpu IS PORT(…)

ARCHITECTURE behavioral OF cpu IS

ARCHITECTURE rtl OF cpu IS

ARCHITECTURE structural OF cpu IS

ARCHITECTURE other OF cpu IS

Page 24: Hardware Description Languages1 - Sharif

24

[email protected]

Packages

PACKAGE PackageName IS

Component Declaration.

sub-program declarations.

type definitions

END PackageName;

PACKAGE BODY PackageName IS

sub-programs.

END PackageName;

•Groups components and utilities used for description

Page 25: Hardware Description Languages1 - Sharif

25

[email protected]

Configurations

CONFIGURATION ConfName OF ComponentName IS

bindings of Entities and Architectures.

specifying parameters of a design.

END CONFIGURATION;

•Binds subcomponents of a design to elements of various libraries

Page 26: Hardware Description Languages1 - Sharif

26

[email protected]

Libraries

LIBRARY LibName;

USE LibName.SubPackage.Scope

LIBRARY IEEE;

USE IEEE.std_logic_1164.ALL;

LIBRARY WORK;

USE WORK.util_package.int2bit;

•Groups packages and components to use in another design (reusability)

Page 27: Hardware Description Languages1 - Sharif

27

[email protected]

Top-Down Design• Is divide-and-conquer method• Is referred to as recursive partitioning until all

sub-components become manageable

Partition(System)

IF HardwareMappingOf(System) IS done THEN

SaveHardwareOf(System)

ELSE

FOR EVERY Functionally-Distinct Part_I OF System

Partition(Part_I)

END FOR;

END IF;

END Partition;

Page 28: Hardware Description Languages1 - Sharif

28

[email protected]

Top-Down Design

SUD

SSC1 SSC2 SSC3 SSC4

SSC31 SSC32 SSC41 SSC42

SUD: System Under Design

SSC: System Sub-Component

Design Flow Implementation

Page 29: Hardware Description Languages1 - Sharif

29

[email protected]

Verification

• design must be simulated to verify the designer’s understanding of the problem

• This simulation must be done for every SSD

Page 30: Hardware Description Languages1 - Sharif

30

[email protected]

Top-Down Design with VHDL

• Design a 8 bit serial adder with– Two data inputs “a” and “b”– One input control signal “start”– One “Clock” input signal– 8 bit “Result” output– “Ready” output

Page 31: Hardware Description Languages1 - Sharif

31

[email protected]

Serial Adder – Functionality

Clk

11000111

00001111

11010110

A

B

Result

Ready

1 1 1 0 0 0 1 1

1 1 1 1 0 0 0 0

0 1 1 0 1 0 1 1

Page 32: Hardware Description Languages1 - Sharif

32

[email protected]

Serial Adder – Behavioral ModelIf ( clk=‘1’ and clk’EVENT) then

if(start=‘1’) thencount:=0;carry:=0;

elseIF count<8 thencount:=count+1;sum:= a XOR b XOR carry;Carry:=(a AND b) OR (a AND carry) AND (b AND carry);Result<=sum & result(7 downto 1);

END IF;end if;if count=8 then ready<=‘1’;else ready<=‘0’; end if;

end if;

Page 33: Hardware Description Languages1 - Sharif

33

[email protected]

Serial Adder – Top Down Design

8 bit Serial Adder

FullAdder ShiftRegister 8 bit Counter Flip Flop

Page 34: Hardware Description Languages1 - Sharif

34

[email protected]

Serial Adder – Data Flow Model

ADDER

a

b

Shift RegisterEn

Si

Counter

Flip Flop

CarryIn

CarryOut

Result

Clk

Page 35: Hardware Description Languages1 - Sharif

35

[email protected]

Design Flow

8 bit Serial Adder

FullAdder ShiftRegister 8 bit Counter Flip Flop

Page 36: Hardware Description Languages1 - Sharif

36

[email protected]

Flip Flop DescriptionENTITY flop IS

GENERIC(td_reset,td_in: TIME:=8 NS);PORT(reset,din,clk: IN BIT; qout: BUFFER:=‘0’);

END flop;ARCHITECTURE behavioral OF flop ISBEGIN

PROCESS(clk)BEGIN

IF(clk=‘0’ AND clk’EVENT) THENIF reset=‘1’ THEN

qout<=‘0’ AFTER td_reset;ELSE

qout<=din AFTER td_in;END IF;

END IF;END PROCESS;

END behavioral;

Page 37: Hardware Description Languages1 - Sharif

37

[email protected]

Design Flow

8 bit Serial Adder

FullAdder ShiftRegister 8 bit Counter Flip Flop

Page 38: Hardware Description Languages1 - Sharif

38

[email protected]

Full-Adder Description

Entity fulladder ISPORT(a,b,cin: IN BIT;sum,count:OUT BIT);

END fulladder;

ARCHITECTURE behavioral OF fulladder ISBEGIN

Sum<=a XOR b XOR cin;Cout<=(a AND b) OR (a AND cin) OR (b AND cin);

END behavioral;

Page 39: Hardware Description Languages1 - Sharif

39

[email protected]

Design Flow

8 bit Serial Adder

FullAdder ShiftRegister 8 bit Counter Flip Flop

Page 40: Hardware Description Languages1 - Sharif

40

[email protected]

Shifter DescriptionENTITY shifter IS

PORT(sin,reset,enable,clk:IN BIT;parout BUFFER BIT_VECTOR(7 DOWNTO 0)

);END shifter;ARCHITECTURE dataflow OF shifter ISBEGIN

Sh: BLOCK(clk=‘0’ AND NOT clk’STABLE)BEGIN

parout<= GUARDED “00000000” WHEN reset=‘1’ ELSEsin & parout(7 DOWNTO 1) WHEN enable=‘1’ ELSEUNAFFECTED;

END BLOCK;END dataflow;

Page 41: Hardware Description Languages1 - Sharif

41

[email protected]

Structural Description of Serial Adder

ENTITY serial_adder ISPORT(a,b,start,clock: IN BIT;ready:OUT BIT;Result :BUFFER BIT_VECTOR(7 DOWNTO 0));

END;

ARCHITECTURE structural OF serial_adder ISSIGNAL serial_sum,carry_in,carry_out,counting:BIT;BEGIN

u1:ENTITY WORK.fulladder PORT MAP(a,b,carry_in,serial_sum,carry_out);u2:ENTITY WORK.flop PORT MAP(start,carry_out,clock,carry_in);u3:ENTITY WORK.counter PORT MAP(start,clock,counting);u4:ENTITY WORK.shifter PORT MAP(serial_sum,start,countig,clock,result);u5:ready <= NOT counting;

END;