Concurrent & Sequential Stmts. (Review)

Similar documents
Sequential Logic - Module 5

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

[VARIABLE declaration] BEGIN. sequential statements

ELCT 501: Digital System Design

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

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

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

Introduction to VHDL #3

VHDL VS VERILOG.

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

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

Inferring Storage Elements

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

Sequential Statement

Lecture 12 VHDL Synthesis

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

ECEU530. Homework 4 due Wednesday Oct 25. ECE U530 Digital Hardware Synthesis. VHDL for Synthesis with Xilinx. Schedule

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

Summary of FPGA & VHDL

Lecture 5: State Machines, Arrays, Loops. EE 3610 Digital Systems

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

VHDL in 1h. Martin Schöberl

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

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

Timing in synchronous systems

CprE 583 Reconfigurable Computing

Hardware Description Language VHDL (1) Introduction

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

ECOM 4311 Digital Systems Design

Constructing VHDL Models with CSA

Reconfigurable Hardware Design (coursework)

VHDL simulation and synthesis

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

Contents. Chapter 9 Datapaths Page 1 of 28

8-1. Fig. 8-1 ASM Chart Elements 2001 Prentice Hall, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 2e, Updated.

Lattice VHDL Training

Introduction to VHDL

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

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

The VHDL Hardware Description Language

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

Control Unit: Binary Multiplier. Arturo Díaz-Pérez Departamento de Computación Laboratorio de Tecnologías de Información CINVESTAV-IPN

EEL 4712 Digital Design Test 2 Spring Semester 2008

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

VHDL Examples Mohamed Zaky

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

Modeling Complex Behavior

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

CSE 502: Computer Architecture

Pollard s Tutorial on Clocked Stuff in VHDL

Digital Systems Design

CS/EE Homework 7 Solutions

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

In our case Dr. Johnson is setting the best practices

Control and Datapath 8

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

VHDL: RTL Synthesis Basics. 1 of 59

ECE 545 Lecture 12. Datapath vs. Controller. Structure of a Typical Digital System Data Inputs. Required reading. Design of Controllers

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

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

EEE8076. Reconfigurable Hardware Design (coursework) Module Outline. Dr A. Bystrov Dr. E.G. Chester. Autumn

VHDL for Synthesis. Course Description. Course Duration. Goals

Lab 3. Advanced VHDL

EL 310 Hardware Description Languages Midterm

Lecture 6. Digital Design Laboratory. Copyright 2007, 2009, 2010, 2014 Thomas R. Collins, Kevin Johnson

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

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

VHDL And Synthesis Review

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

3 Designing Digital Systems with Algorithmic State Machine Charts

Writing VHDL for RTL Synthesis

EEL 4712 Digital Design Test 1 Spring Semester 2007

HDL. Hardware Description Languages extensively used for:

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

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

The University of Alabama in Huntsville ECE Department CPE Final Exam Solution Spring 2004

CprE 583 Reconfigurable Computing

Multiplication Simple Gradeschool Algorithm for 16 Bits (32 Bit Result)

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

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

Hardware Description Languages. Modeling Complex Systems

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2

Problem Set 10 Solutions

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

EITF35: Introduction to Structured VLSI Design

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

Designing with VHDL and FPGA

Digital Integrated Circuits

Contents. Appendix D VHDL Summary Page 1 of 23

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

Note: Closed book no notes or other material allowed, no calculators or other electronic devices.

COE 405 Design Methodology Based on VHDL

Counters. Counter Types. Variations. Modulo Gray Code BCD (Decimal) Decade Ring Johnson (twisted ring) LFSR

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

APPLICATION NOTE. A CPLD VHDL Introduction. Introduction. Overview. Entity. XAPP 105 January12, 1998 (Version 1.0) 0 4* Application Note

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

A bird s eye view on VHDL!

Transcription:

VHDL Introduction, Part II Figures in this lecture are from: Rapid Prototyping of Digital Systems, Second Edition James O. Hamblen & Michael D. Furman, Kluwer Academic Publishers, 2001, ISBN 0-7923-7439- Dr. Computer Science Department Kent State University Kent, OH 44242 USA http://www.cs.kent.edu/~walker Concurrent & Sequential Stmts. (Review) 2! Concurrent statements " Signal assignment " Conditional signal assignment (WHEN-) " Selected signal assignment (WITH-SELECT-WHEN) " Process! Statements inside a process are executed sequentially " Variables, arrays, queues " Variable assignments (no delay) " IF-THEN-,CASE-WHEN, LOOP " WAIT UNTIL, WAIT FOR, WAIT ON " WARNING not everything you do in a process may be synthesizable by your synthesis tools!

Four Multiplexers (Review) ENTITY multiplexer IS -- Input Signals and Mux Control Mux_Out3, Mux_Out4 : OUT STD_LOGIC ); END multiplexer; PORT( A, B, Mux_Control : IN STD_LOGIC; Mux_Out1, Mux_Out2, A Mux_Control 0 B 1 Mux_Outx ARCHITECTURE behavior OF multiplexer IS -- selected signal assignment statement Mux_Out1 <= A WHEN Mux_Control = '0' B; -- with Select Statement WITH mux_control SELECT Mux_Out2 <= A WHEN '0', B WHEN '1', A WHEN OTHERS; -- OTHERS case required since STD_LOGIC -- has values other than "0" or "1" PROCESS ( A, B, Mux_Contro l) -- Statements inside a process IF Mux_Control = '0' THEN -- execute sequentially. Mux_Out3 <= A; Mux_out3 <= B; 3 CASE Mux_Control IS WHEN '0' => Mux_Out4 <= A; WHEN '1' => Mux_Out4 <= B; WHEN OTHERS => Mux_Out4 <= A; END CASE; Four Flip-Flops (Slide 1 of 2) ENTITY DFFs IS PORT( D, Clock, Reset, Enable : IN STD_LOGIC; Q1, Q2, Q3, Q4 : OUT STD_LOGIC ); END DFFs; ARCHITECTURE behavior OF DFFs IS PROCESS -- If WAIT is used no sensitivity list is used WAIT UNTIL ( Clock 'EVENT AND Clock = '1' ); Q1 <= D; D D Q Q 1 4

Four Flip-Flops (Slide 2 of 2) PROCESS -- with synchronous reset WAIT UNTIL ( Clock 'EVENT AND Clock = '1' ); Q2 <= '0'; D 0 Q2 <= D; 0 1 D Q Q 2 5 PROCESS (Reset,Clock) -- with asynchronous reset Q3 <= '0'; ELSIF ( clock 'EVENT AND clock = '1' ) THEN Q3 <= D; D PROCESS (Reset,Clock) -- with asynchronous reset and -- enable Q4 <= '0'; E n a b l e ELSIF ( clock 'EVENT AND clock = '1' ) THEN IF Enable = '1' THEN Q4 <= D; Q 4 D 0 1 D Q Q 3 D Q Q 4 Unassigned Outputs => Inferred Latches! If an output is assigned a value in some paths through an IF or CASE statement, but is unassigned in at least one path, then a latch is added ( inferred )! This is a common mistake " Make sure all outputs are assigned a value, no matter what path is taken through the code, or give the signal a default value before the IF or CASE! If no (new) value is assigned, the synthesis tools will assume you want the old value " A latch (register) will be placed on that output " Latches add delay, different paths may take different amounts of time, etc. 6

(Accidentally) Inferred Latches ENTITY ilatch IS PORT( A, B : IN STD_LOGIC; Output1, Output2 : OUT STD_LOGIC ); END ilatch; ARCHITECTURE behavior OF ilatch IS PROCESS ( A, B ) IF A = '0' THEN Output1 <= '0'; Output2 <= '0'; D Q Output2 Clock IF B = '1' THEN Output1 <= '1'; Output2 <= '1'; -- Latch inferred since no value is assigned Output1 <= '0'; -- to output2 in the else clause! 7 -Bit Counter USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY Counter IS PORT( Clock, Reset : IN STD_LOGIC; Max_count : IN STD_LOGIC_VECTOR( 7 DOWNTO 0 ); Count : OUT STD_LOGIC_VECTOR( 7 DOWNTO 0 ) ); END Counter; ARCHITECTURE behavior OF Counter IS -- Declare signal(s) internal to module SIGNAL internal_count : STD_LOGIC_VECTOR( 7 DOWNTO 0 ); count <= internal_count; PROCESS ( Reset,Clock ) -- Reset counter internal_count <= "00000000"; ELSIF ( clock 'EVENT AND clock = '1' ) THEN IF internal_count < Max_count THEN -- Check for maximum count internal_count <= internal_count + 1; -- Increment Counter -- Count >= Max_Count internal_count <= "00000000"; -- reset Counter

ALU with Shifter (Slide 1 of 2) USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY ALU IS PORT( Op_code : IN STD_LOGIC_VECTOR( 2 DOWNTO 0 ); A_input, B_input : IN STD_LOGIC_VECTOR( 7 DOWNTO 0 ); ALU_output : OUT STD_LOGIC_VECTOR( 7 DOWNTO 0 ) ); END ALU; ARCHITECTURE behavior OF ALU IS -- Declare signal(s) internal to module here SIGNAL temp_output : STD_LOGIC_VECTOR( 7 DOWNTO 0 ); PROCESS ( Op_code, A_input, B_input ) 9 ALU with Shifter (Slide 2 of 2) CASE Op_Code ( 2 DOWNTO 1 ) IS -- Select Arithmetic/Logical Operation WHEN "00" => temp_output <= A_input + B_input; A_input WHEN "01" => temp_output <= A_input - B_input; WHEN "10" => temp_output <= A_input AND B_input; WHEN "11" => temp_output <= A_input WHEN OTHERS => temp_output <= "00000000"; END CASE; OR B_input; -- Select Shift Operation: Shift bits left with zero fill using concatenation operator -- Can also use VHDL 1076-1993 shift operator such as SLL IF Op_Code( 0 ) = '1' THEN Alu_output <= temp_output( 6 DOWNTO 0 ) & '0'; Alu_output <= temp_output; Op_co de ALU (2 downto 1) Op_code (0 ) +, -, AND, OR Shift ALU_output B_input Temp_ output 10

State Machine Example (Slide 1 of 2) ENTITY st_mach IS PORT( clk, reset : IN STD_LOGIC; Input1, Input2 : IN STD_LOGIC; Output1 : OUT STD_LOGIC); END st_mach; 0 X B O u t p u t 1 A X 1 1 X C X 0 ARCHITECTURE A OF st_mach IS -- Enumerated Data Type for State TYPE STATE_TYPE IS ( state_a, state_b, state_c ); SIGNAL state: STATE_TYPE; PROCESS ( reset, clk ) -- Reset State state <= state_a; ELSIF clk 'EVENT AND clk = '1' THEN 11 State Machine Example (Slide 2 of 2) CASE state IS -- Define Next State Transitions using a Case -- Statement based on the Current State WHEN state_a => IF Input1 = '0' THEN state <= state_b; state <= state_c; A WHEN state_b => state <= state_c; 0 X WHEN state_c => IF Input2 = '1' THEN state <= state_a; WHEN OTHERS => state <= state_a; END CASE; B O u t p u t 1 WITH state SELECT -- Define State Machine Outputs Output1 <= '0' WHEN state_a, '1' WHEN state_b, '0' WHEN state_c; X 1 1 X C X 0 12 END a;