Docsity

VHDL Programming for Computer Architecture: Entity-Architecture and Signal Assignments, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download VHDL Programming for Computer Architecture: Entity-Architecture and Signal Assignments and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Fall 2006

Computer Architecture and Assembly Language

Fall 2006

Week 5: VHDL Programming

[Adapted from Dave Patterson’s UCB CS152 slides and

Mary Jane Irwin’s PSU CSE331 slides]

Fall 2006

To make the architect’s crucial task even conceivable,it is necessary to separate the architecture, thedefinition of the product as perceivable by the user,from its implementation. Architecture versusimplementation defines a clean boundary betweenparts of the design task, and there is plenty of workon each side of it.

The Mythical Man-Month

, Brooks, pg. 256

Fall 2006

Levels of Description of a Digital System

ArchitecturalFunctional/BehavioralRegister TransferLogic Circuit

models programmer's view at ahigh level; written in your favoriteprogramming languagemore detailed model, like theblock diagram viewmodel is in terms of datapath FUs,registers, busses; register xferoperations are clock phaseaccuratemodel is in terms of logic gates;delay information can be specifiedfor gates; digital waveformsmodel is in terms of circuits(electrical behavior); accurateanalog waveforms

LessAbstractMoreAccurateSlowerSimulation

Special languages + simulation systems for describing the inherent

parallel activity in hardware (VHDL and verilog) Schematic capture + logic simulation package like

LogicWorks

Fall 2006

Why Simulate First? ‰^ Physical breadboarding

z^ discrete components/lower scale integration precedesactual construction of the prototype z^ verification of the initial design

‰^ No longer possible as designs reach higher levelsof integration! ‰^ Simulation before construction - aka functionalverification

z^ high level constructs means faster to design and test z^ can play “what if” more easily z^ limited performance (can’t usually simulate all possibleinput transitions) and accuracy (can’t usually modelwiring delays accurately), however

Fall 2006

Entity Interface ‰^ Externally visible characteristics

z^ Ports: channels of communication

-^ (inputs, outputs, clocks, control) z^ Generic parameters: define class of components -^ (timing characteristics, size, fan-out) entity

name_of_component

is

port(a,b:

in

std_logic; y: out

std_logic);

end

name_of_component;

Fall 2006

Architecture Body ‰^ Internal behavior or structure of circuit z^ Declaration of module’s internal signals z^ Description of behavior of circuit

-^ concurrent behavioral description - collection of ConcurrentSignal Assignment (CSA) statements executed concurrently -^ process behavioral description - CSAs and variableassignment statements within a process description -^ structural description - system described in terms of theinterconnections of its components architecture

behavioral

of

name_of_component

is

signal

s1,s2:

std_logic;

begin

-^

description

of

behavior

of

ports

and

signals;

end

behavioral;

Fall 2006

Things to Notice ‰^ <= indicates a Concurrent Signal Assignment (CSA)

z^ like “real” logic, nor_nor “process” is in an infinite loop

‰^ t0 and y are signals, not variables

z^ they change when ever the inputs (a, b, or c) change z^ std_logic conforms to the IEEE 1164 standard

U^

UNINITIALIZED

X^

Forcing unknown

Forcing 0

Forcing 1

Z^

High impedance

W^

Weak unknown

L^

Weak 0

H^

Weak 1

-^

Don’t care

library

IEEE;

use

IEEE.std_logic_1164.all; entity

nor_nor_logic

is

Fall 2006

Modeling Delays ‰^ Can model temporal, as well as functional behavior,with delays in CSAs

z^ t0 changes 1 ns after a or b changes entity

nor_nor_logic

is

port

(a,b,c:

in

std_logic;

y:

out

std_logic);

end

nor_nor_logic; architecture

concurrent_behavior

of

nor_nor_logic

is

signal

t0:

std_logic;

begin

t

(a

nor

b)

after

ns;

y^

(t

nor

c)

after

ns;

end

concurrent_behavior;

Fall 2006

Entity-Architecture Features ‰^ Entity defines externally visible characteristics

z^ Ports: channels of communication

-^ signal names for inputs, outputs, clocks, control z^ Generic parameters: define class of components -^ timing characteristics, size (fan-in), fan-out

‰^ Architecture defines the internal behavior orstructure of circuit

z^ Declaration of internal signals z^ Description of behavior

-^ concurrent behavioral description: collection of ConcurrentSignal Assignment (CSA) statements (indicated by <=)executed concurrently; can also model temporal behaviorwith the delay annotation -^ process behavioral description: CSAs and variableassignment statements within a process description -^ structural description: system described in terms of theinterconnections of its components

Fall 2006

New Object: Signals ‰^ Digital systems are about signals, not variables^ signal

value

expressions

after

time

expression

z^ signals are analogous to wires and change when ever theirinputs change - time-value pairs resulting in a waveform z^ std_logic conforms to the 9-value IEEE 1164 standard forsignals

U^

UNINITIALIZED

X^

Forcing unknown

Forcing 0

Forcing 1

Z^

High impedance

W^

Weak unknown

L^

Weak 0

H^

Weak 1

-^

Don’t care

When a signal has multiple drivers(e.g., a bus), the value of the resultingsignal is determined by a resolutionfunction

for std_logic

and

std_logic_vector

the

resolution function (lookuptable) is provided by std_logic_

package

Fall 2006

Constant Objects ‰^ Constant parameters provide default values

z^ may be overridden on each instance z^ attach value to symbol as attribute entity

nor_nor_logic

is

port(a,b,c:

in

std_logic;

y:

out

std_logic);

end

nor_nor_logic; architecture

concurrent_behavior

of

nor_nor_logic

is signal

t0:

std_logic;

constant

gate_delay:

Time

ns;

begin

t

(a

nor

b)

after

gate_delay;

y^

(t

nor

c)

after

gate_delay;

end

concurrent_behavior;

Fall 2006

Bit-Vector Data Types ‰^ Std_logic_vector (31 downto 0) is equivalent to a32-bit bus

z^ Can convert it to a 32 bit integer entity

nand

is

port(a,b:

in

std_logic_vector

downto

y: out

std_logic_vector

downto

end

nand32; architecture

concurrent_behavior

of

nand

is

begin

y^

a nand

b;

end

concurrent_behavior;

‰^ Analyzer (compiler) expands the architecture into 322-input nand gates with the inputs connectedappropriately

331 W05.

Fall 2006

Selected Signal Assignment Statement

‰^ Selected CSA

z^ all choices are evaluated, but only one must be true entity reg_file

is

port(addr1,addr2:

in

std_logic_vector (

downto

0);

dout1,

dout2:

out

std_logic_vector

(31 downto

0));

end

reg_file; architecture behavior

of

reg_file

is

signal

reg0:

std_logic_vector

(

downto

:=

to_stdlogicvector

(x”00000000”);

signal

reg1,reg2:

std_logic_vector

(

downto

:=

to_stdlogicvector

(x”ffffffff”);

beginwith

addr

select dout

<=

reg

after

5

ns^

when

“00”,

<=^

reg

after

5

ns^

when

“01”,

<=^

reg

after

5

ns^

when

others;

with

addr

select dout

<=

reg

after

5

ns^

when

“00”,

<=^

reg

after

5

ns^

when

“01”,

<=^

reg

after

5

ns^

when

others;

end

behavior;

Fall 2006

Summary ‰^ Introduction to VHDL

z^ A language to describe hardware

-^ entity = symbol, architecture ~ schematic, signals =wires

z^ Inherently concurrent (parallel) z^ Has time as concept z^ Behavioral descriptions of a component

-^ can be specified using CSAs -^ can be specified using one or more processes andsequential statements

z^ Structural descriptions of a system are specifiedin terms of its interconnections

-^ behavioral models of each component must be provided