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

Similar documents
Hardware Description Language VHDL (1) Introduction

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

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

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

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

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

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

VHDL: RTL Synthesis Basics. 1 of 59

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

VHDL And Synthesis Review

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

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

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

Introduction to VHDL. Main language concepts

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

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

VHDL Packages for Synthesis Base Types Standard bit types may be used Typically IEEE 1164 Std. types are used. CPE 528: Session #9

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

COVER SHEET: Total: Regrade Info: 1 (8 points) 2 ( 8 points) 3 (16 points) 4 (16 points) 5 (16 points) 6 (16 points) 7 (16 points) 8 (8 points)

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Review of Digital Design with VHDL

VHDL BASIC ELEMENTS INTRODUCTION

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

ECE 3401 Lecture 10. More on VHDL

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

Contents. Appendix D VHDL Summary Page 1 of 23

COE 405 Design Methodology Based on VHDL

A bird s eye view on VHDL!

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

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

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

Introduction to VHDL

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

Summary of basic structures

Design units can NOT be split across different files

Sequential Logic - Module 5

Basic Language Concepts

Lecture 12 VHDL Synthesis

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

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

Embedded Systems CS - ES

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

EEL 4783: Hardware/Software Co-design with FPGAs

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

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

Very High Speed Integrated Circuit Har dware Description Language

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

Control and Datapath 8

C-Based Hardware Design

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

Introduction to VHDL #1

Hardware Description Languages. Modeling Complex Systems

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

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

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

HDL. Hardware Description Languages extensively used for:

VHDL for Synthesis. Course Description. Course Duration. Goals

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

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

Inthis lecture we will cover the following material:

ELCT 501: Digital System Design

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

VHDL Essentials Simulation & Synthesis

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

Test Benches - Module 8

Computer-Aided Digital System Design VHDL

ECOM4311 Digital Systems Design

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

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

Subprograms, Packages, and Libraries

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

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

Getting Started with VHDL

VHDL: Code Structure. 1

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

VHDL for FPGA Design. by : Mohamed Samy

Timing in synchronous systems

VHDL simulation and synthesis

CprE 583 Reconfigurable Computing

VHDL. Douglas L. Perry. Third Edition

EITF35: Introduction to Structured VLSI Design

Outline of this Introduction to VHDL

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

VHDL Synthesis Reference

VHDL is a hardware description language. The code describes the behavior or structure of an electronic circuit.

V1 - VHDL Language. FPGA Programming with VHDL and Simulation (through the training Xilinx, Lattice or Actel FPGA are targeted) Objectives

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

CprE 583 Reconfigurable Computing

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

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

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

Data types defined in the standard package

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

8 Register, Multiplexer and

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

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

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

ECOM 4311 Digital System Design using VHDL. Chapter 7

Architecture des Ordinateurs I

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

Transcription:

Synthesis from VHDL Krzysztof Kuchcinski Krzysztof.Kuchcinski@cs.lth.se Department of Computer Science Lund Institute of Technology Sweden March 23, 2006 Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 1 / 37 Outline 1 General assumptions 2 IEEE Standard logic package (Std_logic_1164) 3 Synthesis Combinational logic Sequential logic Finite State Machines (FSMs) Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 2 / 37 General assumptions only subset of VHDL is synthesizable, selected data types are supported, RTL and HLS synthesis (we concentrate mostly on RTL synthesis), description style has usually quite a big impact on the synthesized hardware, differences between different vendors. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 3 / 37

IEEE Standard logic package VHDL defines only basic features to model digital devices, such as, simple BIT type, two types of a delay, etc. more complex data types for signals must be defined for realistic simulation. An Example: entity nand_2 is port (I1, I2: in bit; O: out bit); interface description for two input nand gate end nand_2; architecture standard of nand_2 is O <= NOT (I1 AND I2) after 2.5 ns; end standard; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 4 / 37 IEEE Standard logic package Why we need more complex logic definition than BIT: we want to get more accurate simulation results, we use different technology and we want to simulate the same design in different technologies, real world is more complex than 0 and 1, more complex delays than standard VHDL models inputs, output delays, rising edge, falling edge delays, min, max and typical delays, Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 5 / 37 Std_logic_1164 Requirements: support for more realistic signal modeling, technology independence, allowing extensions for the future and providing support for all current technologies, provide consistent features which facilitate logic level modeling, hide the complexity of the package from the designer as much as possible, make models readable, provide for the timing accuracy continuum, giving the modeler flexibility to choose the appropriate level of model accuracy. Intended use of the packages: access standard logic facilities use ieee.std_logic_1164.all; VHDL entity declaration Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 6 / 37

Std_logic_1164 Requirements: modeling signals with 0 and 1 simplifies the real circuit, because it only consider signal voltage without signals current, many simulators introduce, so called, signal strength related to the signal s current, in std_logic_1164 we will introduce the following strengths of signals: unknown, forced (connected directly to ground or Vcc), weak (connected to ground or Vcc through high resistive connection, high impedance, don t care. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 7 / 37 Std_logic_1164 library IEEE; PACKAGE Std_logic_1164 is Logic State System (unresolved) TYPE std_ulogic is ( 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 ); Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 8 / 37 Std_logic_1164 Unconstrained array of std_ulogic for use with the resolution function TYPE std_ulogic_vector IS ARRAY ( NATURAL RANGE <> ) of std_ulogic; Resolution function FUNCTION resolved ( s : std_ulogic_vector ) RETURN std_ulogic; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 9 / 37

Std_logic_1164 *** Industry Standard Logic Type *** SUBTYPE std_logic IS resolved std_ulogic; Unconstrained array of std_logic for use in declaring signal arrays TYPE std_logic_vector IS ARRAY ( NATURAL RANGE <> ) of std_logic; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 10 / 37 Std_logic_1164 Basic states + Test SUBTYPE X01 is resolved std_ulogic range X to 1 ; ( X, 0, 1 ) SUBTYPE X01Z is resolved std_ulogic range X to Z ; ( X, 0, 1, Z ) SUBTYPE UX01 is resolved std_ulogic range U to 1 ; ( U, X, 0, 1 ) SUBTYPE UX01Z is resolved std_ulogic range U to Z ; ( U, X, 0, 1, Z ) Overloaded Logical Operators FUNCTION "and" ( l : std_ulogic; r : std_ulogic ) RETURN UX01; : FUNCTION "not" ( l : std_ulogic ) RETURN UX01; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 11 / 37 Use of Std_logic_1164 Example: entity nand_2 is port (I1, I2: in std_logic; O: out std_logic); interface description for two input nand gate using std_logic_1164 end nand_2; architecture standard of nand_2 is O <= NOT (I1 AND I2) after 2.5 ns; end standard; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 12 / 37

Synthesis different synthesis levels (behavioral, RTL, logic), differnet tools have different assumptions on specification styles, distinction between combinational logic and sequential logic. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 13 / 37 Synthesis Supported VHDL Language Constructs: Entity, Architecture and Package design units. Function and Procedure sub-programs IEEE Libraries - Std_Logic_1164, Std_Logic_Unsigned, Std_Logic_Signed, Numeric_Std and Numeric_Bit Ports of mode in, out, inout and buffer Signals, Constants and Variables (the latter should be restricted to sub-programs and processes) Composite types - Arrays and Records Integer and subtypes Natural and Positive (Integer types should have a range constraint unless a 32-bit word is required) Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 14 / 37 Synthesis (cont d) Supported VHDL Language Constructs: User defined enumeration types (eg. type State_type is (s0, s1, s2, s3);). Operators - +, -, *, /, **, mod, rem, abs, not, =, /=, <, >, <=, >=, and, or, nand, nor, xor, xnor, sll, srl, sla, sra, rol, ror, &. (Notes: /, mod and rem are usually supported for compile-time constants or when the right-hand argument is a power of 2. The shifting operators are usually supported for compile-time constant shift values) Sequential statements - signal and variable assignments, wait, if, case, loop, for, while, return, null, function and procedure call. (Note: only a single wait statement is allowed in a process) Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 15 / 37

Synthesis (cont d) Supported VHDL Language Constructs: Concurrent statements - signal assignment, process, block, component instantiation, sub-program call, generate. Generic ports in entities. Predefined attributes - range, event Aggregates and others clause. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 16 / 37 Synthesis (cont d) Unsupported VHDL Language Constructs: Access and File types - the former are similar to C s pointers and files have no direct correspondence to hardware. Register and Bus kind signals - very rarely used VHDL constructs. Guarded blocks - as above, rarely used. Next and Exit loop control statements - A synthesis tool creates logic from a loop by unwinding the loop into a series of iterations, often resulting in iterative circuits. Prematurely terminating a loop prevents this unwinding process. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 17 / 37 Synthesis (cont d) Unsupported VHDL Language Constructs: Objects of type Real - floating point numbers cannot be mapped to hardware and therefore are not supported. User defined resolution functions - prior to IEEE Standard 1164, designers made up their own multi-valued logic systems and resolution functions to support technology related aspects of simulation. None of these custom solutions is standard, and therefore none are supported by synthesis. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 18 / 37

Synthesis (cont d) Ignored Constructs: Assert and report statements - these are included in a design to send messages to the console window relaying information about what is happening during a simulation. As such, they have nothing to do with the hardware of the design. After clause - this is used to specify inertial and transport hardware delays in a design, or alternatively in a test-bench to produce clocks and other control waveforms. Synthesis tools have no way of creating a specific delay time, unless it is created by means of counting clock pulses in hardware. Delays may be included in the pre-synthesis RTL design. However, they will be ignored during the synthesis process. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 19 / 37 Combinational process comb_process:process(a, B) C <= not(a and B) after 20 ns; D <= not B after 20 ns; end process comb_process; A B Process C D Difference with comb_process:process(a) C <= not(a and B) after 20 ns; D <= not B after 20 ns; end process comb_process; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 20 / 37 Sequential process A_process:process wait until clk= 0 C <= not(a and B); D <= not B after 10 ns; end process A_process; CLK A B Process A C D B_process:process wait until clk= 0 E <= not(d and G); F <= not G; end process B_process; G Process B E F Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 21 / 37

Sequential process Clocked processes lead to all signals, assigned inside the process, in a flip-flop. example:process wait until clk= 1 dout <= din; DIN CLK D CLK FD Q DOUT end process example; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 22 / 37 If statement A if sel = 1 c <= b else B MUX C c <= a; SEL Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 23 / 37 Asynchronous reset process(clk, reset) if reset = 1 then data <= 00 ; elseif clk event and clk = 1 then data <= in_data; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 24 / 37

Synchronous reset process(clk) if clk event and clk= 1 then if reset = 1 then data <= 00 ; else data <= in_data; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 25 / 37 Finite State Machines (FSMs) exist two types of FSMs, Moore and Mealy, contain register(s) for keeping FSM state, have logic for computing next state and output, can be modeled with combinational and sequential processes. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 26 / 37 Moore machine entity demo is port(clk, in1, reset: in std_logic: out1:out std_logic_vector(3 downto 0); end demo; architecture moore of demo is type state_type is (s0, s1, s2, s3); signal state: state_type; S0 0000 1 S1 1001 state_process: process(clk, reset) : S3 1111 0 1 0 S2 1100 output_process: process(state) : end moore; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 27 / 37

Moore machine (cont d) state_process: process(clk, reset) if reset = 1 then state <= s0; elseif clk event and clk = 1 then case state is when s0 => if in1 = 1 then state <= s1; when s1 => if in1 = 0 then state <= s2; when s2 => if in1 = 1 then state <= s3; when s3 => if in1 = 0 then state <= s0; end case; end if Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 28 / 37 Moore machine (cont d) output_process: process(state) case state is when s0 => out1 <= 0000 ; when s1 => out1 <= 1001 ; when s2 => out1 <= 1100 ; when s3 => out1 <= 1111 ; end case; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 29 / 37 Mealy machine rest/0000 S0 0/0000 S3 rest/1111 1/1001 1/1111 rest/1001 S1 0/1100 S2 rest/1100 Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 30 / 37

Mealy machine (cont d) state process the same as for Moore machine output process output_process: process(state) case state is when s0 => if in1 = 1 then out1 <= 1001 ; else out1 <= 0000 ; : Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 31 / 37 Incompletely defined combinational processes architecture bad is process(state) if a > b then q <= 0 ; elseif a < b then q <= 1 ; end process end; architecture good is process(state) if a > b then q <= 0 ; else q <= 1 ; end process end; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 32 / 37 Bad synthesis Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 33 / 37

Good synthesis Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 34 / 37 High-level synthesis High-level synthesis (behavioral, algorithm, architectural synthesis) means going from an algorithm specification to an RT level which implements the behavior. variables are allocated into registers or memory elements (sharing of registers is possible)- resource allocation, operators are allocated to functional units (several operators can be implemented by one functional unit, for example ALU)- resource allocation, operations are assigned to time slots for their execution in a synchronous implementation- scheduling. additional register are added if operations take more than one clock cycle. Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 35 / 37 High-level synthesis example Synthesis of the following code (inner loop of differential equation integrator) while c do x1 := x + dx; u1 := u (3*x*u*dx); y1 := y + u*dx; c := x < a; x := x1; y := y1; u := u1; end; Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 36 / 37

High-level synthesis example data-flow graph scheduled data-flow graph register allocation Kris Kuchcinski (LTH) Synthesis from VHDL March 23, 2006 37 / 37