Hardware Description Language VHDL (1) Introduction

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

ELCT 501: Digital System Design

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

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

Contents. Appendix D VHDL Summary Page 1 of 23

Digital Systems Design

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

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

Review of Digital Design with VHDL

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

COE 405 Design Methodology Based on VHDL

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

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

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

VHDL BASIC ELEMENTS INTRODUCTION

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

C-Based Hardware Design

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

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

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

Getting Started with VHDL

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Very High Speed Integrated Circuit Har dware Description Language

Embedded Systems CS - ES

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

ENGIN 241 Digital Systems with Lab

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

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

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

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

VHDL Examples Mohamed Zaky

Digital Design with FPGAs. By Neeraj Kulkarni

HDL. Hardware Description Languages extensively used for:

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

Introduction to VHDL #1

Computer-Aided Digital System Design VHDL

ECOM4311 Digital Systems Design

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

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

Architecture des Ordinateurs I

EEL 4783: Hardware/Software Co-design with FPGAs

A bird s eye view on VHDL!

Introduction to VHDL #3

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

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Chapter 6 Combinational-Circuit Building Blocks

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

[VARIABLE declaration] BEGIN. sequential statements

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

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

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

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

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

VHDL for FPGA Design. by : Mohamed Samy

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

ECE 3401 Lecture 10. More on VHDL

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

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

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

Design units can NOT be split across different files

Modeling Complex Behavior

Verilog Module 1 Introduction and Combinational Logic

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

Introduction to VHDL. Main language concepts

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

Control and Datapath 8

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

VHDL VS VERILOG.

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

Mridula Allani Fall Fall

Concurrent Signal Assignment Statements (CSAs)

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

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

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

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 ;

JUNE, JULY 2013 Fundamentals of HDL (10EC45) PART A

Verilog. Verilog for Synthesis

VHDL Structural Modeling II

Chapter 2 Basic Logic Circuits and VHDL Description

Review. LIBRARY list of library names; USE library.package.object; ENTITY entity_name IS generic declarations PORT ( signal_name(s): mode signal_type;

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

Verilog Design Principles

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

CCE 3202 Advanced Digital System Design

Lattice VHDL Training

Lecture 12 VHDL Synthesis

Basic Language Concepts

Introduction to the VHDL language. VLSI Digital Design

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

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Digital Systems Design

! Initially developed under DOD auspices, later standardized as IEEE standards , , & (standard logic data type)

Writing VHDL for RTL Synthesis

Digital Design with SystemVerilog

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

VHDL Synthesis Reference

The VHDL Hardware Description Language

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

Transcription:

Hardware Description Language VHDL (1) Introduction Digital Radiation Measurement and Spectroscopy NE/RHP 537

Introduction Hardware description language (HDL) Intended to describe circuits textually, for a computer to read Evolved starting in the 1970s and 1980s Popular languages today include: VHDL Defined in 1980s by U.S. military; Ada-like language (Pascal) Verilog Defined in 1980s by a company; C-like language SystemC Defined in 2000s by several companies; consists of libraries in C++ VHDL stands for: Very High Speed Integrated Circuit Hardware Description Language

Introduction (Cont.) VHDL can describe a digital system at several levels: Behavioral Example: a binary adder, in terms of function of adding two binary numbers without giving any implementation detail Structural Example: a binary adder, by specifying the interconnections of the gates that comprise the adder (instantiation of several components)

VHDL Syntax In VHDL, a design consists of three sections: 1. Library and use clause 2. An entity which describes the interface. The entity declaration represents the external interface to the design entity. 3. An architecture which contains the actual implementation. The architecture body represents the internal description of the design entity

VHDL Syntax Example 1: AND gate library IEEE; use IEEE.STD_LOGIC_1164.ALL; library clause entity and_gate is Port ( in_1 : in STD_LOGIC; in_2 : in STD_LOGIC; gate_out : out STD_LOGIC); end and_gate; Entity architecture Behavioral of and_gate is Begin gate_out <= in_1 and in_2; end Behavioral; Architecture

Data types identify a set of values an object may assume and the operations that may be performed on it. Type declarations are used through constructs called packages. We will use the package called std_logic_1164. It contains the common types, procedures and functions we normally need. In our class, we will use these two data types: STD_LOGIC is a data type for a single bit STD_LOGIC_VECTOR(11 downto 0) is a data type for a12-bit bus The std_logic types are defined in std_logic_1164 package.

The package std_logic_1164 is the package standardized by the IEEE that represents a nine-state logic value system known as MVL9. Three of the values, 0, 1 and Z, which stand for logical 0, logical 1, and high impedance, can be synthesized. Two values, U and X ( uninitialized and unknown, e.g. when signals with 0 and 1 values are tied together), may be encountered in simulation. The other four values are not used in our application. To use the package we say: LIBRARY ieee; USE ieee.std_logic_1164.all;

Multiplying Operators: *, /, MOD (modulo), REM (reminder) Sign operators: +, - Adding Operators: +, -, & (concatenation) Shift Operators: ROL, ROR, SLA, SLL, SRA, SRL Relational Operators: =, /=, <, <=, >, >= Logical Operators: AND, OR, NAND, NOR, XOR, XNOR Miscellaneous: **, ABS, NOT

Shift Operators: ROL, ROR, SLA, SLL, SRA, SRL Example: Let A = 10010101 A SLL 2 = 01010100 --shift left logical, filled with 0 A SRL 3 = 00010010 --shift right logical, filled with 0 A SLA 3 = 10101111 --shift left arithmetic, filled with right bit A SRA 2 = 11100101 --shift right arithmetic, filled with left bit A ROL 3 = 10101100 --rotate left by 3 A ROR 5 = 10101100 --rotate right by 5

The symbol <= is the signal assignment operator Example: C <= A+B; K <= not H ; A signal must be assigned after begin in the architecture body The symbol => is the signal association operator used in instantiation (you will see it later)

An internal signal must be declared before usage. A signal declaration has a form of: Signal signal_name : type_name [ := initial_value]; A signal must be declared before begin in the architecture body Every line must be terminated with a semicolon ; Use -- for your comments. The text after it is ignored. Example: -- this is a comment

entity FullAdder is Port ( a : in STD_LOGIC; b : in STD_LOGIC; cin : in STD_LOGIC; cout : out STD_LOGIC; s : out STD_LOGIC); end FullAdder; architecture Equations of FullAdder is begin s <= (a xor b) xor cin; cout <= (a and b) or (a and cin) or (b and cin); end Equations;

Design Hierarchy Provide easier and faster verification and simulation Allow several engineers to work on one design at the same time Speed up design compilation Produce designs that are easier to understand Manage the design flow efficiently

Design Hierarchy Example 3: 4-bit Full Adder library IEEE; use IEEE.STD_LOGIC_1164.ALL; Y X entity Adder4 is Port ( x : in STD_LOGIC_VECTOR(3 downto 0); y : in STD_LOGIC_VECTOR(3 downto 0); ci : in STD_LOGIC; co : out STD_LOGIC; s : out STD_LOGIC_VECTOR(3 downto 0)); end Adder4; C o a b FA S C i C o a b FA S C i C o a b FA S C i C o a b FA S C i architecture Structure of Adder4 is component FullAdder --declare FullAdder component port (a : in STD_LOGIC; b : in STD_LOGIC; cin : in STD_LOGIC; cout : out STD_LOGIC; sum : out STD_LOGIC); end component; S signal c_int: STD_LOGIC_VECTOR(3 downto 1); --declare internal signal

Design Hierarchy Example 3: 4-bit Full Adder begin --instantiate four copies of the FullAdder FA0: FullAdder port map(a => x(0), b => y(0), cin => ci, cout => c_int(1), sum => s(0)); FA1: FullAdder port map(a => x(1), b => y(1), cin => c_int(1), cout => c_int(2), sum => s(1)); FA2: FullAdder port map(a => x(2), b => y(2), cin => c_int(2), cout => c_int(3), sum => s(2)); FA3: FullAdder port map(a => x(3), b => y(3), cin => c_int(3), cout => co, sum => s(3)); end Structure;

if Statement in VHDL The basic statement has the form: if condition then sequential statements_1; else sequential statements_2; end if; The condition is a Boolean expression, which evaluates to TRUE or FALSE. If it is TRUE, sequential statements_1 are executed; otherwise, sequential statements_2 are executed.

In a MUX, the control inputs select which one of the data inputs is transmitted to the output 4-to-1 Multiplexer case Sel is when 00 => F <= I0; when 01 => F <= I1; when 10 => F <= I3; when 11 => F <= I4; I0 I1 I2 I3 MUX F end case; Sel (1 downto 0)

process and Modeling Sequential logic A process may have the form: process (sensitivity-list) begin sequential-statements end process; Whenever one of the signals in the sensitivity list changes, the sequential statements in the process body are executed.

Modeling a D Flip-Flop Using Process process (clock) begin if clock'event and clock = '1' then if reset = '1' then Q <= '0'; else Q <= D; end if; end if; end process; D Flip-Flop with Synchronous Reset D Clock D Flip-Flop Reset Q

Modeling a Counter Using Process process_name: -- optional process (clock) begin if clock='1' and clock'event then if reset='1' then count <= (others => '0'); elsif clock_enable='1' then count <= count + 1; end if; end if; end process; Counter with Reset and Clock Enable clock_enable clock Counter reset count

Modeling a State Machine (Moore) in VHDL Using three processes 1 Define your states 2 Set initial state and Go to the next state

Modeling a State Machine (Moore) in VHDL Using three processes 3 Set outputs based on state only 4 Set the next state based on some conditions