Introduction to VHDL #3

Similar documents
Lecture 4. VHDL Fundamentals. George Mason University

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

[VARIABLE declaration] BEGIN. sequential statements

Digital Systems Design

Hardware Description Language VHDL (1) Introduction

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

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

Sequential Logic - Module 5

Lattice VHDL Training

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

Lecture 12 VHDL Synthesis

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

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

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

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

Introduction to VHDL #1

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

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

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

Very High Speed Integrated Circuit Har dware Description Language

Introduction to VHDL #2

Chapter 6 Combinational-Circuit Building Blocks

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Hardware Description Languages. Modeling Complex Systems

Computer-Aided Digital System Design VHDL

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

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Sequential VHDL. Katarzyna Radecka. DSD COEN 313

Nanosistemų programavimo kalbos 4 paskaita. Nuosekliai vykdomi sakiniai

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

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

Concurrent Signal Assignment Statements (CSAs)

ELCT 501: Digital System Design

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

Concurrent & Sequential Stmts. (Review)

VHDL And Synthesis Review

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

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Digital Systems Design

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

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

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 3

Control and Datapath 8

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

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

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

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

FPGA BASED SYSTEM DESIGN. Dr. Tayab Din Memon Lecture 9 & 10 : Combinational and Sequential Logic

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Sequential Statements

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

Summary of FPGA & VHDL

Parallel- and sequential data processing

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

Digital Systems Design

Basic Language Concepts

In our case Dr. Johnson is setting the best practices

Review of Digital Design with VHDL

Constructing VHDL Models with CSA

Lecture 3. VHDL Design Units and Methods. Entity, Architecture, and Components Examples of Combinational Logic Hands-on in the Laboratory

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

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

Modeling Complex Behavior

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

Experiment 8 Introduction to VHDL

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

VHDL in 1h. Martin Schöberl

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

VHDL for FPGA Design. by : Mohamed Samy

Inferring Storage Elements

VHDL Sample Slides Rev Sample Slides from the 2-day and 4-day VHDL Training Courses

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

VHDL simulation and synthesis

Getting Started with VHDL

VHDL. Chapter 1 Introduction to VHDL. Course Objectives Affected. Outline

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. Behavioral Design Style: Registers & Counters.

SRI SUKHMANI INSTITUTE OF ENGINEERING AND TECHNOLOGY, DERA BASSI (MOHALI)

VHDL: RTL Synthesis Basics. 1 of 59

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

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

ENGIN 241 Digital Systems with Lab

Used to perform operations many times. See previous Parallel to Serial Example

VHDL. Chapter 7. Behavioral Modeling. Outline. Behavioral Modeling. Process Statement

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

Test Benches - Module 8

CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis. Register File: An Example. Register File: An Example (cont d) Aleksandar Milenkovic

Lecture 3. VHDL Design Units and Methods. Notes. Notes. Notes

EITF35: Introduction to Structured VLSI Design

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

8 Register, Multiplexer and

Hardware Description Languages (HDLs) Verilog

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

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

EEL 4783: Hardware/Software Co-design with FPGAs

Transcription:

ECE 322 Digital Design with VHDL Introduction to VHDL #3 Lecture 7 & 8

VHDL Modeling Styles VHDL Modeling Styles Dataflow Concurrent statements Structural Components and interconnects Behavioral (sequential) Sequential statements Registers State machines Decoders

VHDL Modeling Styles-Dataflow Modeling Dataflow modeling- describes how data moves through the system and the various processing steps. Dataflow uses series of concurrent statements Dataflow is the most useful style to describe combinational logic Dataflow code also called concurrent code Concurrent statements are evaluated at the same time; thus, the order of these statements doesn t matter. This is not true for sequential/behavioral statements!

VHDL Modeling Styles-Dataflow Modeling Example: XOR3 These two orders are the same U1 <= A XOR B; Result <= U1 XOR C; Result <= U1 XOR C; U1 <= A XOR B;

VHDL Modeling Styles-Dataflow Modeling Example: XOR3 LIBRARY ieee; USE ieee.std_logic_1164.all; entity xor3_gate is port( A,B,C : in std_logic; Result : out std_logic); end xor3_gate; Architecture dataflow of xor3_gate is signal U1 : std_logic; begin U1 <= A xor B; Results <= U1 xor C; end dataflow;

VHDL Modeling Styles-Structural Modeling Structural design is the simplest to understand. This style is the closest to schematic capture and utilizes simple building blocks to compose logic functions. Components are interconnected in a hierarchical manner. Structural descriptions may connect simple gates or complex, abstract components. Structural style is useful when expressing a design that is naturally composed of sub-blocks.

VHDL Modeling Styles-Behavioral Modeling Behavioral modeling describes the function or expected behavioral of the design in an algorithmic manner This style is the closest to a natural language description of the circuit functionality Usually described using process block statements which encapsulate collections of actions executed in sequence

VHDL Modeling Styles-Behavioral Modeling Process block Syntax Process_label : process (sensitivity list) -- declarations Begin -- sequential statements The first line of the process statement includes a label, the keyword process, and an optional list of signals, known as the sensitivity list.

VHDL Modeling Styles-Behavioral Modeling A process with a sensitivity list is evaluated during simulation whenever an event occurs on any of the signals in the sensitivity list (and only then). If a process has no sensitivity list then it is evaluated when an event occurs on any signal. Process_label : process (sensitivity list) -- declarations Begin -- sequential statements

VHDL Modeling Styles-Behavioral Modeling Sensitivity lists are only used for speeding up simulations. They are ignored by synthesis programs. Why? Hardware synthesis needs to know about all signals, not just the active ones. Simulation, on the other hand, only needs to know about active signals.

VHDL Modeling Styles-Behavioral Modeling In a typical circuit application, a process will include in its sensitivity list all inputs that have asynchronous behavior. These asynchronous inputs may include: clock signal(s) reset signals inputs to blocks of combinational logic Synchronous inputs should not be listed in the sensitivity list! count or register load enable signals external control input signals

VHDL Modeling Styles-Behavioral Modeling Example of a sensitivity list: 3-input AND gate AND3_1 : process (A,B,C) In purely combinational circuits, all inputs are considered to be asynchronous and should therefore appear in the sensitivity list. Note: Outputs do not show up in sensitivity lists.

VHDL Modeling Styles-Behavioral Modeling The main part of the process block involves a set of sequential statements, delimited by begin and end Process_label : process (sensitivity list) -- declarations Begin -- sequential statements The order of the sequential statements is important! Statements inside a process block are evaluated in sequence from first to last.

VHDL Modeling Styles-Behavioral Modeling Types of sequential statements that can be used in process blocks: simple signal assignment statements if/then/else case for loop while loop Note: the last 4 structures can be used only inside process blocks

VHDL Modeling Styles-Behavioral Modeling NOTE!!! You cannot have Component instantiations Selected Signal assignments Conditional Signal assignments in process blocks!

If/Then/Else statements if first_condition then --statements elsif second_condition then --statements else --statements end if; The elsif and else are optional. The conditions specified in an if-then-else construct must evaluate to a Boolean signal type.

If/Then/Else statements Example: 3_input OR gate OR3_1 : process(a,b,c) begin F <= 0 ; if A = 1 then F <= 1 ; elsif B = 1 then F <= 1 ; elsif C = 1 then F <= 1 ; end if;

If/Then/Else statements Notice that there are multiple assignments to the signal F. This is allowed! multiple signal assignments OR3_1 : process(a,b,c) begin F <= 0 ; if A = 1 then F <= 1 ; elsif B = 1 then F <= 1 ; elsif C = 1 then F <= 1 ; end if;

If/Then/Else statements Multiple signal assignments are permitted within a process block (and only within a process block) The last assignment to be evaluated in the sequential evaluation of the statements in the process block is the one that takes effect.

If/Then/Else statements The first statement in the process block of the example is there to prevent the occurrence of implied memory. if not present, the circuit would hold the value of F when A=B=C=0 OR3_1 : process(a,b,c) begin F <= 0 ; if A = 1 then F <= 1 ; elsif B = 1 then F <= 1 ; elsif C = 1 then F <= 1 ; end if;

If/Then/Else statements It is better to provide default values for combinational outputs rather than using an ending else clause as it is easier to read and less prone to error. OR3_1 : process(a,b,c) begin if A = 1 then F <= 1 ; elsif B = 1 then F <= 1 ; elsif C = 1 then F <= 1 ; else F <= 0 ; end if; Not a good approach!

VHDL Modeling Styles-Behavioral Modeling You can have multiple process blocks, so - Divide your circuit into a number of functional blocks (like components) and use a separate process block to describe each one. A B C blk1 blk2 Z X blk3 Y Q

VHDL Modeling Styles-Behavioral Modeling blk1 : process(a,b,c) -- 2 input OR and AND gates begin X <= A or B; Y <= C and B; blk2 : process(x,y,a) -- 3 input OR gate begin Z <= X or Y or A; blk3 : process(z,b) -- implement a latch begin if Z = 1 then Q <= B; end if;

VHDL Modeling Styles-Behavioral Modeling The following VHDL code is incorrect. WHY? Architecture EX1 of DSD is Signal A,B,X,Y,Z : std_logic; Begin process(x,y,a) begin Z <= X or Y or A; Y <= X and A; process(z,b) begin if Z = 1 then Y <= B; end if;

VHDL Modeling Styles-Behavioral Modeling The code on the previous slide is in error because there is more than 1 assignment to the signal Y outside of a process block! process(x,y,a) multiple signal assignments begin Z <= X or Y or A; Y <= X and A; blk3 : process(z,b) begin if Z = 1 then Y <= B; end if;

VHDL Modeling Styles-Behavioral Modeling You can have multiple assignments to a signal within a process block, since only one assignment actually takes effect. This is not true outside of a process block! In effect, the multiple assignments in a process count as a single concurrent assignment statement.

Case Statements Case statements are a type of control statement that can be used as alternatives to if-then-else constructs. case control_expression is when test_expression1 => -- statements when test_expression2 => -- statements when others -- statements end case; The two test expressions are allowed to be true at the same time. Case statements must also include all possible conditions of the control expression. (The others expression can be used to guarantee that all conditions are covered.)

Case Statements The case statement is much like the selected signal assignment statement. Their syntax is different however, so be careful to use the appropriate one. Inside process block - case statements Outside process block - selected assignment

Case Statements entity MUX4_1 is port ( i0,i1,i2,i3 : in std_logic; sel : in std_logic_vector(1 downto 0); bitout : out std_logic); end MUX4_1; architecture Behavioral of MUX4_1 is begin process(i0,i1,i2,i3,sel) begin case sel is when "00" => bitout <= i0; when "01" => bitout <= i1; when "10" => bitout <= i2; when others => bitout <= i3; end case; end Behavioral;