vhdl. what is vhdl? vhdl: vhsic hardware description language vhsic: very high speed integrated...

Post on 22-Dec-2015

245 Views

Category:

Documents

7 Downloads

Preview:

Click to see full reader

TRANSCRIPT

VHDL

What is VHDL?

VHDL: VHSIC Hardware Description LanguageVHSIC: Very High Speed Integrated Circuit

04/19/23 2R.H.Khade

Entity :- The most basic building block in the design. The uppermost level of the design is the top level entity. Entity is a hardware abstration of the

actual hardware device. The entity declaration specifies the name

of the entity modeled and lists the interfaces.

An entity X, when used in another entity Y, becomes a component for the entity Y.

R.H.Khade 304/19/23

Entity communicates with other models in its external environment through port

signals.Entity Declaration

R.H.Khade 404/19/23

Entity Declaration For Half Adder

R.H.Khade 504/19/23

Entity Entity Declaration:

Indicates what comes in and what goes out.

entity name port names port mode (direction)port type punctuation

04/19/23 6R.H.Khade

The port type for this entity have been specified to be of type BIT, which means that the ports can take the values ‘0’ or ‘1’.

R.H.Khade 704/19/23

Entity declaration for the 2-to-4 decoder circuit.

R.H.Khade 804/19/23

BIT_VECTOR is a predefined unconstrained array type of BIT.

entity DECODER2×4 is

Port (A, B, ENABLE: in BIT;

Z:out BIT_VECTOR(0 to 3));

end DECODER2×4;

R.H.Khade 904/19/23

The range ”0 to 3” for port Z specifies the array size.

An unconstrained array type is a type in which the size of the array

is not specified.

R.H.Khade 1004/19/23

Architecture – All entities that can be simulated have an architecture description. The architecture describes the behavior of the entity.

. Each VHDL design unit comprises an "entity" declaration and one or more "architectures".

04/19/23 11R.H.Khade

R.H.Khade 1204/19/23

Architecture Body

The internal details of an entity are specified by an architectural body using any of the following modeling style:

4) As any combination of previous three.

3) As a set of sequential assignments (to represent behavior)

R.H.Khade 1304/19/23

1) As a set of interconnected components (to represent structure)

2) As a set of concurrent assignment statements (to represent dataflow)

Dataflow model of HALF_ADDER described usig two concurrent signal assignment statements.

R.H.Khade 1404/19/23

Architecture of full adder

entity name port names port mode (direction)port type

reserved words

punctuation

04/19/23 15R.H.Khade

1) Structural style of modeling.

2) Dataflow style of modeling

3) Behavioral style of modeling

Architecture Modeling Style

R.H.Khade 1604/19/23

In the structural style of modeling, an entity is described as a set of interconnected

components

R.H.Khade 1704/19/23

In the structural style of modeling, the architecture body

is composed of two parts:1) The declarative part before

the keyword begin.2) The statement part after the

keyword begin.

R.H.Khade 1804/19/23

The declared components are instantiated in the statement part of the architecture body

using component instantiation statements.

X1 and A1 are the component labels for these component

instantiation

R.H.Khade 1904/19/23

The first component instantiation statement labeled X1, shows that signals A and B (the input ports of the HALF_ADDER) are connected

to the X and Y input ports of a XOR2 component, while output port Z of this component is connected to

output port SUM

R.H.Khade 2004/19/23

Separate entity models should be written for the components XOR2

and AND2.

The signals in the port map of a component instantiation and the port signals in the component declaration

are associated by position called positional association.

R.H.Khade 2104/19/23

A component instantiation statement is a concurrent

statement .

The order of these statements is not important.

R.H.Khade 2204/19/23

The structural style of modeling describes only an

interconnection of components (viewed as black boxes),

without implying any behavior of the components.

R.H.Khade 2304/19/23

Architecture of the DECODER2×4 using structural representation

R.H.Khade 2404/19/23

BIT_VECTOR is a predefined unconstrained array type of BIT.

entity DECODER2×4 is

Port (A, B, ENABLE: in BIT;

Z:out BIT_VECTOR(0 to 3));

end DECODER2×4;

R.H.Khade 2504/19/23

R.H.Khade 2604/19/23

The architecture body contains a signal declaration that declares two signals,

ABAR and BBAR, of type BIT.These signals, which represent wires,

are used to connect components.The scope of these signals is restricted to the architecture body; and therefore these signals are not visible outside

the architecture body.

R.H.Khade 2704/19/23

Architecture

Defines one particular implementation of a design unit 

architecture arch_name of entity_name is        ...  declarations ...    // can be data types, constants, signals, etc begin        ...  concurrent statements …    end

Concurrent statements describe a design unit at one or more levels of modeling abstraction:

Behavioral Model: No structure implied. Usually written in sequential, procedural style.

Dataflow Model: All datapaths shown, plus all control signals. Structural Model: Interconnection of components.

04/19/23 28R.H.Khade

R.H.Khade 2904/19/23

Let’s Start Simple

Support different description levels Structural (specifying interconnections of the gates), Dataflow (specifying logic equations), and Behavioral (specifying behavior)

04/19/23 30R.H.Khade

Arithmetic and Logical Expressions

Expressions in VHDL are similar to those of most high-level languages. Data elements must be of the type, or subtypes of the same base type. Operators include the following:

Logical: and, or, nand, nor, xor, not (for boolean or bit ops) Relational: =, /=, <, <=, >, >= Arithmetic: +, -, *, /, mod, rem, **, abs

(a mod b takes sign of b, a rem b takes sign of a) Concatenate: &

(ex. a & b makes one array) Examples    a <= b nand c;    d := g1 * g2 / 3;    Bus_16 <= Bus1_8 & Bus2_8;

04/19/23 31R.H.Khade

VHDL Data Types

Each VHDL object must be classified as being of a specific data type.

Predefined Scalar Data Types (single objects) bit values: '0', '1' , boolean values: TRUE, FALSE integer values: -(231) to +(231 - 1) natural values: 0 to integer'high (subtype of integer) character values: ASCII characters (eg. 'A') time values include units (eg. 10ns, 20us)

Predefined VHDL Aggregate Data Types bit_vector array (natural range <>) of bit Example :signal dbus: bit_vector(15 downto 0);   Accessing element: dbus(n) example: dbus(0) string array (natural range <>) of char

04/19/23 32R.H.Khade

VHDL Objects: Variables

A variable is declared within a block, process, procedure, or function, and is updated immediately when an assignment statement is executed.

Can be of any scalar or aggregate data type, Is utilized primarily in behavioral descriptions. Declaration syntax: variable symbol: type [:= initial_value]; Example:

process        variable count: integer  := 0;

       variable rega: bit_vector(7 downto 0);    begin       

...        count := 7;      -- assign values to variables       

rega  := x"01";        end;

04/19/23 33R.H.Khade

VHDL Objects: Signals

A signal is an object with a history of values (related to "event" times, i.e. times at which the signal value changes).

Signals are declared via signal declaration statements or entity port definitions, and may be of any data type.

Declaration syntax : signal sig_name: data_type [:=initial_value];

Example:   signal clock: bit; Signal assignment statement: A <= B after 10ns;

04/19/23 34R.H.Khade

Modeling Flip-Flops Using VHDL Processes

Whenever one of the signals in the sensitivity list changes, the sequential statements are executed in sequence one time

General form of process

04/19/23 35R.H.Khade

D Flip-flop Model

Bit values are enclosed in single quotes

04/19/23 36R.H.Khade

JK Flip-Flop Model

04/19/23 37R.H.Khade

JK Flip-Flop Model

04/19/23 38R.H.Khade

Backup

04/19/23 39R.H.Khade

Object Attributes

An object attribute returns information about a signal or data type. Signal Condition Attributes (for a signal S)

S'DELAYED(T) - value of S delayed by T time units S'STABLE(T) - true if no event on S over last T time units S'QUIET(T) - true if S quiet for T time units S'LAST_VALUE - value of S prior to latest change S'LAST_EVENT - time at which S last changed S'LAST_ACTIVE - time at which S last active S'EVENT - true if an event has occurred on S in current cycle S'ACTIVE - true if signal S is active in the current cycle S'TRANSACTION - bit value which toggles each time signal S changes

04/19/23 40R.H.Khade

Constants

• A constant associates a value to a symbol of a given data type

• Declaration syntax:

constant symbol: type := value;• Example: 

constant  zero4: bit_vector(0 to 3) := ('0','0','0','0');

04/19/23 41R.H.Khade

top related