CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

Similar documents
Review of Digital Design with VHDL

C-Based Hardware Design

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

Hardware Description Language VHDL (1) Introduction

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Contents. Appendix D VHDL Summary Page 1 of 23

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 4 Introduction to VHDL

VHDL BASIC ELEMENTS INTRODUCTION

VHDL Lexical Elements

Introduction to VHDL #1

VHDL 3 BASIC OPERATORS AND ARCHITECTURE BODY. Design descriptions & design constructions examples are taken from foundation series examples

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

Experiment 8 Introduction to VHDL

Declarations. Lexical elements. Type declaration Subtype declaration Constant declaration Signal declaration Variable declaration.

Design units can NOT be split across different files

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

VHDL for FPGA Design. by : Mohamed Samy

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

EEL 4783: Hardware/Software Co-design with FPGAs

CPE/EE 422/522. Chapter 8 - Additional Topics in VHDL. Dr. Rhonda Kay Gaede UAH. 8.1 Attributes - Signal Attributes that return a value

IT T35 Digital system desigm y - ii /s - iii

Summary of basic structures

Performance Engineering of Real-Time and Embedded Systems. Introduction to VHDL

ECE 3401 Lecture 10. More on VHDL

Introduction to VHDL

ECOM4311 Digital Systems Design

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

BASIC VHDL LANGUAGE ELEMENTS AND SEMANTICS. Lecture 7 & 8 Dr. Tayab Din Memon

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Embedded Systems CS - ES

Getting Started with VHDL

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

5. 0 VHDL OPERATORS. The above classes are arranged in increasing priority when parentheses are not used.

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

ENGIN 241 Digital Systems with Lab

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

Lecture 4. VHDL Fundamentals. George Mason University

A bird s eye view on VHDL!

Building Blocks. Entity Declaration. Entity Declaration with Generics. Architecture Body. entity entity_name is. entity register8 is

Concurrent Signal Assignment Statements (CSAs)

Digital Systems Design

Inthis lecture we will cover the following material:

Hardware Modeling. VHDL Syntax. Vienna University of Technology Department of Computer Engineering ECS Group

VHDL Objects. Lecture 8: VHDL (2) Variables. VHDL Objects - Constant. Files. EE3109 Gopi K. Manne Fall 2007

Outline. CPE/EE 422/522 Advanced Logic Design L07. Review: JK Flip-Flop Model. Review: VHDL Program Structure. Review: VHDL Models for a MUX

Basic Language Constructs of VHDL

VHDL: skaitmeninių įtaisų projektavimo kalba. 2 paskaita Pradmenys

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

Combinational Logic COMB. LOGIC BLOCK. A Combinational Logic Block is one where the outputs depend only on the current inputs

ELCT 501: Digital System Design

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

CDA 4253 FPGA System Design Introduction to VHDL. Hao Zheng Dept of Comp Sci & Eng USF

Introduction to the VHDL language. VLSI Digital Design

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

Basic Language Concepts

VHDL Part 2. What is on the agenda? Basic VHDL Constructs. Examples. Data types Objects Packages and libraries Attributes Predefined operators

[1] Douglas L. Perry, VHDL, third edition, ISBN , McRaw- Hill Series on Computer Engineering.

Design Entry: Schematic Capture and VHDL ENG241: Digital Design Week #4

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

Very High Speed Integrated Circuit Har dware Description Language

VHDL kod yerleşimi. kütüphaneler. Dış görünüş (entity: varlık) İşleyişi, yapısı (architecture: mimari)

VHDL Basics. Mehdi Modarressi. Department of Electrical and Computer Engineering, University of Tehran. ECE381(CAD), Lecture 4:

Digital Systems Design

COE 405 Design Methodology Based on VHDL

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

Introduction to VHDL. Main language concepts

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

6.111 Lecture # 5. Entity section describes input and output. VHDL: Very High speed integrated circuit Description Language:

Outline CPE 626. Advanced VLSI Design. Lecture 3: VHDL Recapitulation. Intro to VHDL. Intro to VHDL. Entity-Architecture Pair

Lecture 3 Introduction to VHDL

VHDL And Synthesis Review

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

What Is VHDL? VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE 1076 standard (1987, 1993)

ECOM 4311 Digital System Design using VHDL. Chapter 7

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

The University of Alabama in Huntsville ECE Department CPE Midterm Exam February 26, 2003

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

CMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi

2/14/2016. Hardware Synthesis. Midia Reshadi. CE Department. Entities, Architectures, and Coding.

Libraries. Library ieee; Use ieee.std_logic_1164.all; Use ieee.std_logic_arith.all; Use ieee.std_logic_signed.all; Use ieee.std_logic_unsigned.

Subprograms, Packages, and Libraries

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

CCE 3202 Advanced Digital System Design

VHDL Essentials Simulation & Synthesis

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

Generatore di parità. LIBRARY ieee; USE ieee.std_logic_1164.all ; ENTITY xor2 IS PORT( A, B : in std_logic ; Y : out std_logic ) ; END xor2 ;

CprE 583 Reconfigurable Computing

VHDL Structural Modeling II

Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING. Fifth Semester. Subject: VHDL Programming

Chapter 2 Synthesizable VHDL for FPGA-Based Devices

Introduction to VHDL #3

Lecture 10 Subprograms & Overloading

VHDL Instant. Table of contents. History

HDL. Hardware Description Languages extensively used for:

PART I BASIC DIGITAL CIRCUITS

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

VHDL Synthesis Reference

Transcription:

CSCI 250 - Lab 3 VHDL Syntax Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\ Objectives 1. Learn VHDL Valid Names 2. Learn the presentation of Assignment and Comments 3. Learn Modes, Types, Array, and Range 4. Study Signal Concurrency We have examined some simple VHDL entities and design entry procedures. Now let's take a closer look at some of the rules and options available to us when we create a design in VHDL. Lab Tutorial 1. VHDL Valid Names A valid name for a port, signal, variable, entity name, architecture body, or similar object consists of a letter followed by any number of letters or numbers, without space. A valid name is also called a named identifier. VHDL is not case sensitive. However, an underscore may be used within a name, but may not begin or end the name. Two consecutive underscores are not permitted. A hyphenated name does not work. Here are some examples of valid and invalid names: Valid names: decode8 just_in_time array_4 Invalid names: 8decide (begins with a digit) my design (space inside a name) signal (reserved word) your_words? (special character? not allowed) _what_4 (begins with underscore) in time (two consecutive underscores) Here is a list of some reserved words for your reference: 1

abs access after alias all and array assert attribute architecture begin block body buffer bus case constant component configuration downto disconnect else elsif end entity exit file for function group generic generate guarded if impure in inertial inout is label loop literal linkage library mod map nand new next nor not null of on open or others out port pure process package postponed procedure range record rem ror rol return reject report register select sla sll sra srl signal subtype severity shared then to type transport use until units unaffected variable wait when while with xnor xor 2. Assignment and Comments The operator <= is called an "assignment operator", which is a compound symbol, consisting of the "less than" and the "equal" sign. It indicates that whatever is on the right side of the statement is assigned to the left side of the statement. Example: y <= a and (not b); Two consecutive hyphens are used to lead out the inline documentation/comment. A comment is explanatory text that is ignored by VHDL compiler. 3. Modes Example: -- This is a comment in VHDL. The mode of a port defines its direction of data flow. Generally, the following four modes are used: IN, OUT, INOUT, and BUFFER. A port of mode IN only allows data to flow from an input pin to the CPLD logic. CPLD stands for Complex Programmable Logic Device in this context. A port of mode OUT allows data to flow from the CPLD logic to the output port. A port of mode INOUT is bidirectional; it will allow data to flow in both directions. 2

BUFFER is a special case of OUT, which allows the port value to be "updated" or "modified" by the CPLD logic and to be fed back into the CPLD logic to be used by another function. 4. Type, Array, and Range A type in VHDL is a property applied to port, signal, or variable that determines what values that object can have. Some of the most common types we will use in VHDL are BIT, STD_LOGIC, and INTEGER. BIT and BIT_VECTOR The BIT type is native to VHDL and defined in the standard library of VHDL. BIT can have only two values:'0' and '1'. The values are placed in single quotes because VHDL treats them like ASCII characters. If we want to assign a multiple-bit number to a series of related input and output ports, we can use the type BIT_VECTOR. A BIT_VECTOR is defined as a one-dimensional array of elements, each of type BIT. The range of the array is indicated by listing its upper and lower bounds. For Example, define a 4-bit vector d: d: IN BIT_VECTOR (3 downto 0); 3

Each of the elements of this vector can be individually addressed by indicating its position by a number in parentheses. For the definition with range indication (3 downto 0), elements are: d(3), d(2), d(1), d(0); d(3) holds the most significant bit. For the definition with range indication (0 to 3), elements are: d(0), d(1), d(2), d(3); d(0) holds the most significant bit. VHDL always makes vector assignments from left to right. The contents of those vectors can be chosen by selecting how the elements are numbered. Constant values assigned to BIT_VECTORs are written in double quotes, because the VHDL compiler treats them like strings, or array of characters. Look at the following example: If a port d is defined by d: IN BIT_VECTOR (3 downto 0); then the following groups of the statements are equivalent. d(3) <= '0'; d <= "0101"; d(2) <= '1'; d(1) <= '0'; d(0) <= '1'; If a port d is defined by d: IN BIT_VECTOR (0 to 3); then the following groups of the statements are equivalent. d(0) <= '1'; d(1) <= '0'; d(2) <= '1'; d(3) <= '0'; d <= "1010"; STD_LOGIC and STD_LOGIC_VECTOR 4

The STD_LOGIC (standard logic) type, also called IEEE Std.1164 Multi-Valued Logic, has been defined to give a broader range of output values than just '0' and '1'. Any port, signal, or variable of type STD_LOGIC or STD_LOGIC_VECTOR can have any of the following values: 'U' -- Uninitialized 'X' -- Forcing Unknown '0' -- Forcing 0 '1' -- Forcing 1 'Z' -- High Impedance 'W' -- Weak Unknown 'L' -- Weak 0 'H' -- Weak 1 '-' -- Don't care To use STD_LOGIC in a VHDL file, you must include the following reference to the VHDL library called IEEE and the std_logic_1164 package before the entity declaration: library IEEE; use IEEE.std_logic_1164.all; The std_logic_1164 package contains the type definitions of the STD_LOGIC types. Example: Consider a 4-bit AND array, that is, an array of four 2-bit AND gates. Now let's see how to use VHDL file to describe it. library IEEE; use IEEE.std_logic_1164.all; entity Four_and_array is port( ); a0 : in std_logic; a1 : in std_logic; a2 : in std_logic; a3 : in std_logic; b0 : in std_logic; b1 : in std_logic; b2 : in std_logic; b3 : in std_logic; c0 : out std_logic; c1 : out std_logic; c2 : out std_logic; c3 : out std_logic 5

end Four_and_array; architecture arch1 of Four_and_array is begin -- Your VHDL code defining the model goes here c0 <= a0 and b0; c1 <= a1 and b1; c2 <= a2 and b2; c3 <= a3 and b3; end arch1; Now rewrite the VHDL file for the 4-bit AND array using STD_LOGIC_VECTOR types. library IEEE; use IEEE.std_logic_1164.all; entity Four_and_vec is port( ); a : in std_logic_vector(0 to 3); b : in std_logic_vector(0 to 3); c : out std_logic_vector(0 to 3) end Four_and_vec; architecture arch1 of Four_and_vec is begin -- Your VHDL code defining the model goes here c <= a and b; end arch1; 5. Signal Concurrency Within VHDL, signals are assigned values by using signal assignment statements. These statements specify a new value of a signal and the time at which the signal is to acquire this value. Multiple signal assignment statements are executed concurrently in simulated time and are referred to as concurrent signal assignment statements (CSAs). 6

The statements for the Boolean expressions are examples of concurrent signal assignment statements. The idea behind signal concurrency is that all concurrent statements are evaluated at the same time. (Concurrent means "simultaneous".) In the other programming languages such as BASIC, c, or C++, the statements are executed in sequential order. However, for a hardware description language, signal concurrency does make sense since its purpose is to synthesize hardware rather than run a sequence of program statements. Let's use half adder as an example, Two signal bits a and b are added to produce the sum s and carry c. The circuit is defined by the two equations: s = a xor b and c = a and b. Suppose both inputs are 1, then carry is 1 and the sum bit is 0. Further suppose that input b is changed to a 0. Now the carry is 0 and the sum is 1. Which changed first, sum or carry? Since both outputs depend on the same two inputs, both outputs ideally change at the same time. That is how the hardware behaves. In VHDL, we would write the following two statements: s <= a xor b; c <= a and b; Lab Assignments A quick review: A half-adder has the following properties: Truth Table =========== x y s c ---------- 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 7

---------- Functions: ========== s = x xor y c = x and y A full-adder has the following properties: Truth Table =========== a b c s c2 ---------------- 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 ---------------- Functions: ========== s = a xor b xor c c2 = (a and b) or (c and (a xor b)) Part 1. Build a half-adder device with a VHDL Model. 1. Create a VHDL Model for a Device Symbol "HalfAdder". 2. Build a Full-Adder circuit using "HalfAdder" with an additional "or" gate. 3. Connect some I/O devices and verify the truth table of the Full-Adder. Submit the following 1. Save all your files (.dwv,.dwa, cct ) into a folder 2. Submit the folder and files to \\fs2\csci250\lab-3\ 3. Screen shot of your VHDL Model file for the Half-Adder. 4. Screen shot of the circuit of your Full-Adder made by using two Half Adder devices and the truth table from your experiment. Part 2. Build an array of 8-Input NAND gate device with a VHDL Model. 1. Create a VHDL Model for a Device Symbol "nand_gate_8". 2. Build a simple circuit using "nand_gate_8" with additional I/O devices 8

3. Create a testing circuit that that verify the following both device are equal: o You nand_gate_8 device o NAND-8 gate from the library 4. Verify the output of your "nand_gate_8", against that of the library NAND-8 device Submit the following: 1. Save all your files (.dwv,dwa,cct) into a folder 2. Submit the folder and files to \\fs2\csci250\lab-3\ 3. Screen shot of your VHDL Model file for the "nand_gate_8". 4. Screen shot the circuit using "nand_gate_8" in it. 5. Simulation waveform of the testing circuit Due: Tuesday, week6 9