1 H ardware D escription L anguages Basic Language Concepts.

Slides:



Advertisements
Similar presentations
Hardware Description Language (HDL)
Advertisements

1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
Mridula Allani Fall 2010 (Refer to the comments if required) ELEC Fall 2010, Nov 21(Adopted from Profs. Nelson and Stroud)
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
02/02/20091 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
Week 6.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 6 VHDL Programming [Adapted from Dave Patterson’s UCB CS152.
1/31/20081 Logic devices can be classified into two broad categories Fixed Programmable Programmable Logic Device Introduction Lecture Notes – Lab 2.
HDL-Based Digital Design Part I: Introduction to VHDL (I) Dr. Yingtao Jiang Department Electrical and Computer Engineering University of Nevada Las Vegas.
331 W05.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 5: VHDL Programming [Adapted from Dave Patterson’s UCB CS152.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Behavioral & Structural.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
IAY 0600 Digital Systems Design
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
VHDL TUTORIAL Preetha Thulasiraman ECE 223 Winter 2007.
ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 6: Configurations.
1 H ardware D escription L anguages Modeling Complex Systems.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
1 H ardware D escription L anguages Modeling Digital Systems.
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 5: Modeling Structure.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
CWRU EECS 317 EECS 317 Computer Design LECTURE 1: The VHDL Adder Instructor: Francis G. Wolff Case Western Reserve University.
Basic Concepts in VHDL Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
L12 – VHDL Overview. VHDL Overview  HDL history and background  HDL CAD systems  HDL view of design  Low level HDL examples  Ref: text Unit 10, 17,
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Timing Model VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals Execute.
ECE 332 Digital Electronics and Logic Design Lab Lab 6 Concurrent Statements & Adders.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Hardware languages "Programming"-language for modelling of (digital) hardware 1 Two main languages: VHDL (Very High Speed Integrated Circuit Hardware Description.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
IAY 0600 Digital Systems Design VHDL discussion Dataflow Style Combinational Design Alexander Sudnitson Tallinn University of Technology.
Digital System Projects
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Apr. 3, 2000Systems Architecture I1 Introduction to VHDL (CS 570) Jeremy R. Johnson Wed. Nov. 8, 2000.
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
IAY 0600 Digital Systems Design VHDL discussion Structural style Modular design and hierarchy Part 1 Alexander Sudnitson Tallinn University of Technology.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
An Introduction to V.H.D.L.. Need of a Compiler… main( ) { int x=10,y=20,z; z = x + y ; printf ( “ %d “, z ); getch( ) ; } What’s That ? Give me only.
Combinational logic circuit
Elements of Structural Models
Structural style Modular design and hierarchy Part 1
Basic Language Concepts
Systems Architecture Lab: Introduction to VHDL
IAY 0600 Digitaalsüsteemide disain
Behavioral Style Combinational Design with VHDL
IAY 0600 Digital Systems Design
Dataflow Style Combinational Design with VHDL
Timing Model Start Simulation Delay Update Signals Execute Processes
Structural style Modular design and hierarchy Part 1
Behavioral Style Combinational Design with VHDL
IAY 0600 Digital Systems Design
IAS 0600 Digital Systems Design
CPE/EE 422/522 Advanced Logic Design L06
ECE 434 Advanced Digital System L08
VHDL VHSIC Hardware Description Language VHSIC
IAS 0600 Digital Systems Design
Structural style Modular design and hierarchy Part 1
VHDL Discussion Subprograms
Digital Systems Design 2
VHDL Discussion Subprograms
IAS 0600 Digital Systems Design
Modeling Complex Behavior
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

1 H ardware D escription L anguages Basic Language Concepts

2 Outline VHDL Basic Constructs: Design Elements: Entity, Architecture and Configuration Object Types: Constants, Variables, Signals and Files Events, Propagation Delays and Concurrency Concurrent Signal Assignment Statements Signal Drivers, Shared Signals, and Resolved types Delay Models Inertial delay, Transport delay, Delta delay

3 VHDL Basic Language Concepts For now we will focus only on basic language constructs. Our immediate objective is to become familiar only with the constructs provided for describing digital systems

4 Describing Digital Systems What do we need to describe a digital system ? Interface : how do we connect to the design Behavior : what does it do? b a sum carry How the design “talks” to the external world What is the internal behavior of the design

5 Describing the Interface: the Entity The interface is a collection of ports Ports are special programming objects called signals Ports have a type, e.g., bit (Guideline: avoid the type bit !!) Ports have a mode: in, out, inout (bidirectional ) b a sum carry entity half_ADder is port ( a, b : in bit; sum, carry :out bit); end entity half_adder; case insensitive VHDL 1993

6 Example: Entity Descriptions Q QQ D clk R S op N Z A B C entity ALU32 is port(A, B: in bit_vector (31 downto 0); C : out bit_vector (31 downto 0); Op: in bit_vector (5 downto 0); N, Z: out bit); end entity ALU32; entity D_ff is port(D, Clk, Rbar, Sbar: in bit; Q, Qbar : out bit); end entity D_ff; MSB LSB

7 VHDL Object Types VHDL supports four basic objects: variables, constants, signals and file types The variable and constant types They works as in conventional programming languages Variable values can be changed. Constant values cannot be changed The signal type is a programming object specifically introduced to model the behavior of digital systems A variable is simply a value in a location of memory. There is no association of time with the value. A signal is a sequence of time-value pairs ! The file type Let’s procrastinate it

8 Describing Behavior: the Architecture To describe behavior we need: Signal assignment statements: events on output signals in terms of events on input signals Specification of propagation delays The operation of digital systems is inherently concurrent b a sum carry entity half_adder is port (a, b : in bit; sum, carry :out bit); end entity half_adder; architecture behavioral of half_adder is begin sum <= (a xor b) after 5 ns; carry <= (a and b) after 5 ns; end architecture behavioral; VHDL 1993

9 Describing Behavior: the Architecture library IEEE; use IEEE.std_logic_1164.all; entity half_adder is port (a, b : in std_ulogic; sum, carry :out std_ulogic); end entity half_adder; architecture behavioral of half_adder is begin sum <= (a xor b) after 5 ns; carry <= (a and b) after 5 ns; end architecture behavioral; The type bit is not powerful enough for realistic simulation: use the IEEE 1164 value system Use of the IEEE 1164 value system requires inclusion of the library and package declaration statements b a sum carry Declarations for a design entity use clause

10 Libraries and Packages Libraries are logical units that are mapped to physical directories. The units of a library are called packages. Packages are repositories for type definitions, procedures, and functions Libraries and packages can be system defined or user defined

11 architecture-3 architecture-2 architecture-1 entity configuration Configurations “separate” the specification of the interface from that of the implementation An entity may have multiple architectures Configurations associate an entity with an architecture Binding rules: default and explicit More on configurations later! Binding entity and architecture: the Configuration

12 Design Units Primary design units (not dependent on other design units) Entity Configuration Package Declaration Secondary design units Package body Architecture Design units are arranged in files Now you know the layout of a VHDL program!

13 Concurrent Statements The operation of digital systems is inherently concurrent Signals are assigned values at specific points in time using signal assignment statements Signal assignments are denoted by the operator <= Signals can be initialized using the operator := Initialization is not required. (Guideline: do not use signal initialization!) There are several forms of C oncurrent S ignal A ssignments (Guideline: do not use CSAs)

14 Simple CSA in1 in2 c_in c_out sum s1 s3 s2 library IEEE; use IEEE.std_logic_1164.all; entity full_adder is port (in1, in2, c_in: in std_ulogic; sum, c_out: out std_ulogic); end entity full_adder; architecture dataflow of full_adder is signal s1, s2 : std_ulogic; Signal s3 : std_ulogic := ‘0’; constant gate_delay: Time:= 5 ns; begin L1: s1 <= (in1 xor in2) after gate_delay; L2: s2 <= (c_in and s1) after gate_delay; L3: s3 <= (in1 and in2) after gate_delay; L4: sum <= (s1 xor c_in) after gate_delay; L5: c_out <= (s2 or s3) after gate_delay; end architecture dataflow; Declarations

15 Simple CSA Use of signals in the architecture Internal signals connect components A statement is executed when an event (signal transition) takes place on a signal in the RHS of an expression 1-1 correspondence between signal assignment statements and signals (wires) in the circuit Order of statement execution follows propagation of events in the circuit Textual order does not imply execution order

16 Implementation of Signals  23 1 Z   s <= (in1 nand in2) after gate_delay; value expressiontime expression waveform element Driver or projected waveform Transaction transaction = time-value pair representing the future (with respect to the current simulation time ) value assigned to signal

17 Implementation of Signals (cont.) In the absence of initialization, default values are determined by signal type Waveform elements describe time-value pairs Transactions are internal representations of signal value assignments Events correspond to new signal values A transaction may lead to the same signal value

18 Implementation of Signals (cont.) Driver is the set of future signal values: current signal value is provided by the transaction at the head of the list We can specify multiple waveform elements in a single assignment statement Specifying multiple future values for a signal Rules for maintaining the driver Conflicting transactions driver head

19 Example: Waveform Generation Multiple waveform elements can be specified in a single signal assignment statement signal <= ‘0’,‘1’ after 10 ns,‘0’ after 20 ns,‘1’ after 40 ns; signal

20 Resolved Signal Types At any point in time what is the value of the bus signal? We need to “resolve” the value Take the value at the head of all drivers Select one of the values according to a resolution function Predefined IEEE 1164 resolved types are std_logic and std_logic_vector

21 Resolved Logic System

22 Conditional CSA First true conditional expression determines the output value Note that Sel can have more values that 0 or 1 hence we need the last statement to cover all cases library IEEE; use IEEE.std_logic_1164.all; entity mux4 is port ( In0, In1, In2, In3 : in std_logic_vector (7 downto 0); Sel: in std_logic_vector(1 downto 0); Z : out std_logic_vector (7 downto 0)); end entity mux4; architecture behavioral of mux4 is begin Z <= In0 after 5 ns when Sel = “00” else In1 after 5 ns when Sel = “01” else In2 after 5 ns when Sel = “10” else In3 after 5 ns when Sel = “11” else “ ” after 5 ns; end architecture behavioral; note type Evaluation Order is important!

23 Unaffected Signals Value of the signal is not changed VHDL 1993 only! library IEEE; use IEEE.std_logic_1164.all; entity pr_encoder is port (S0, S1,S2,S3: in std_logic; Z : out std_logic_vector (1 downto 0)); end entity pr_encoder; architecture behavioral of pr_encoder is begin Z <= “00” after 5 ns when S0 = ‘1’ else “01” after 5 ns when S1 = ‘1’ else unaffected when S2 = ‘1’ else “11” after 5 ns when S3 = ‘1’ else “00” after 5 ns; end architecture behavioral;

24 Selected CSA The “when others” clause can be used to ensure that all options are covered The “unaffected” clause may also be used here library IEEE; use IEEE.std_logic_1164.all; entity mux4 is port ( In0, In1, In2, In3 : in std_logic_vector (7 downto 0); Sel: in std_logic_vector(1 downto 0); Z : out std_logic_vector (7 downto 0)); end entity mux4; architecture behavioral-2 of mux4 is begin with Sel select Z <= (In0 after 5 ns) when “00”, (In1 after 5 ns) when “01”, (In2 after 5 ns) when “10”, (In3 after 5 ns) when “11” (In3 after 5 ns) when others; end architecture behavioral; All options must be covered and only one must be true!

25 A VHDL Model Template library library-name-1, library-name-2 ; use library-name-1.package-name.all ; use library-name-2.package-name.all; entity entity_name is port ( input signals : in type ; output signals : out type ); end entity entity_name; architecture arch_name of entity_name is -- declare internal signals -- you may have multiple signals of different types signal internal-signal-1 : type := initialization ; signal internal-signal-2 : type := initialization ; begin -- specify value of each signal as a function of other signals internal-signal-1 <= simple, conditional, or selected CSA ; internal-signal-2 <= simple, conditional, or selected CSA ; output-signal-1 <= simple, conditional, or selected CSA ; output-signal-2 <= simple, conditional, or selected CSA ; end architecture arch_name; Declare external libraries and visible components Define the interface Declare signals used to connect components Definition of how & when internal signal values are computed Definition of how & when external signal values are computed

26 Delay Models in VHDL Inertial delay Default delay model Suitable for modeling delays through devices with inertia such as gates Transport delay Model delays through devices with no inertia, e.g., wires no inertia = all input events are propagated to output signals Delta delay What about models where no propagation delays are specified? Infinitesimally small delay is automatically (after 0ns) inserted by the simulator to preserve correct ordering of events

27 Inertial Delays: Example VHDL 1993 enables specification of pulse rejection width General form: signal <= reject time-expression inertial value-expression after time-expression ; Input Out 1 Out input output 8 ns 2 ns Out 1: gate propagation delay 8ns Out 2: gate propagation delay 2ns

28 Transport Delays: Example a b sum carry s1 s2 Transport architecture transport_delay of half_adder is signal s1, s2: std_logic:= ‘0’; begin s1 <= (a xor b) after 2 ns; s2 <= (a and b) after 2 ns; sum <= transport s1 after 4 ns; carry <= transport s2 after 4 ns; end architecture transport_delay; Inertial

29 Delta Delays: Example In1 In2 z s1 s2 s3 s4 library IEEE; use IEEE.std_logic_1164.all; entity combinational is port (in1, in2: in std_logic; z : out std_logic); end entity combinational; architecture behavior of combinational signal s1, s2, s3, s4: std_logic:= ‘0’; begin s1 <= not in1; s2 <= not in2; s3 <= not (s1 and in2); s4 <= not (s2 and in1); z <= not (s3 and s4); end architecture behavior;

30 Delta Delays: Behavior IN1 IN2 Z S1 S2 S3 S Δ2Δ2Δ 3Δ3Δ In2 S2 S3 Z Delta Events Internal ordering established by the simulator

31 Delay Models: Summary Delay models Inertial For devices with inertia such as gates VHDL 1993 supports pulse rejection widths Transport Ensures propagation of all events Typically used to model elements such as wires Delta Automatically inserted to ensure functional correctness of code that do not specify timing Enforces the data dependencies specified in the code

32 Summary Design elements: Entity, Architecture, Configuration Object Types: Constants, Variables, Signals (and Files) Events, propagation delays, and concurrency Transactions and waveform elements Signal Drivers, Shared Signals, resolved types, and resolution functions Concurrent Signal Assignment statements Simple CSA, Conditional CSA, Selected CSA Modeling Delays Inertial delay, Transport delay, Delta delay

33 And once more … VHDL Object Types: Constants Signals Variables Files

34 Constant You can think of it just as a name for a value reset_c := ‘0’; bus_width_c := 32; The value assigned to a constant cannot be changed (the location of memory that stores the value cannot be modified) Benefits: a better documented design. it is easier to update the design. But do not exaggerate !!! since you have to remember all these names you defined !

35 Signals It models a physical signal (you can think of it like a piece of wire) A signal is a sequence of time-value pairs A signal assignment takes effect only after a certain delay (the smallest possible delay is called a “delta time”).

36 Variables All assignment to variables are scheduled (takes effect) immediately. If a variable is assigned a value, the corresponding location in memory is written with the new value while destroying the old value. This effectively happen immediately so if the next executing statement in the program uses the value of the variable, it is the new value that is used.

37 Signals vs. Variables Signals assignments are scheduled after a certain delay  Variables assignments happen immediately, there is no delay