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

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

EITF35: Introduction to Structured VLSI Design

Hardware Description Language VHDL (1) Introduction

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

Control and Datapath 8

VHDL for Synthesis. Course Description. Course Duration. Goals

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

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

In our case Dr. Johnson is setting the best practices

Summary of FPGA & VHDL

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

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

VHDL: A Crash Course

Lecture 12 VHDL Synthesis

Synthesizable Verilog

Motivation for Lecture. Market for Memories. Example: FFT Design. Sequential Circuits & D flip-flop. Latches and Registers.

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

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

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

Lecture 32: SystemVerilog

Sequential Logic - Module 5

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Overview. Ram vs Register. Register File. Introduction to Structured VLSI Design. Recap Operator Sharing FSMD Counters.

Synthesis of Combinational and Sequential Circuits with Verilog

HDL. Hardware Description Languages extensively used for:

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

VHDL simulation and synthesis

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

Lecture 2 Hardware Description Language (HDL): VHSIC HDL (VHDL)

A Brief Introduction to Verilog Hardware Definition Language (HDL)

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

Hardware Description Languages. Modeling Complex Systems

RTL Implementation. Introduction to Structured VLSI Design. Concurrent Statements and Processes. Combinational and Sequential Logic.

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

VHDL: RTL Synthesis Basics. 1 of 59

Chapter 2 Basic Logic Circuits and VHDL Description

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

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

Computer-Aided Digital System Design VHDL

ECE 3401 Lecture 10. More on VHDL

VHDL for Logic Synthesis

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

Introduction to VHDL #3

קורס VHDL for High Performance. VHDL

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

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

VHDL in 1h. Martin Schöberl

EITF35: Introduction to Structured VLSI Design

Using ModelSim to Simulate Logic Circuits in VHDL Designs. 1 Introduction. For Quartus II 13.0

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

Designing with VHDL and FPGA

EECS150 - Digital Design Lecture 7 - Computer Aided Design (CAD) - Part II (Logic Simulation) Finite State Machine Review

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

Digital Design with SystemVerilog

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

CS232 VHDL Lecture. Types

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

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

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

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

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

A bird s eye view on VHDL!

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

EECS150 - Digital Design Lecture 10 Logic Synthesis

VHDL for Logic Synthesis

Lecture 3 Introduction to VHDL

Programming with HDLs

EITF35: Introduction to Structured VLSI Design

ENGIN 241 Digital Systems with Lab

Concurrent & Sequential Stmts. (Review)

Verilog for High Performance

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

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Timing in synchronous systems

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

Introduction to VHDL #1

EEL 4783: Hardware/Software Co-design with FPGAs

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

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

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

Lecture #1: Introduction

Introduction To HDL. Verilog HDL. Debdeep Mukhopadhyay Dept of CSE, IIT Madras 1

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

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

ECE 459/559 Secure & Trustworthy Computer Hardware Design

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

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

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

EECS150 - Digital Design Lecture 10 Logic Synthesis

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

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

VHDL And Synthesis Review

Verilog for Synthesis Ing. Pullini Antonio

Lattice VHDL Training

[VARIABLE declaration] BEGIN. sequential statements

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

Digital Integrated Circuits

Lecture 4. VHDL Basics. Simple Testbenches

Digital Systems Design

Transcription:

Two HDLs used today Introduction to Structured VLSI Design VHDL I VHDL and Verilog Syntax and ``appearance'' of the two languages are very different Capabilities and scopes are quite similar Both are industrial standards and are supported by most software tools Joachim Rodrigues VHDL Why VHDL? Very High Speed Integrated Circuit (VHSIC) Hardware Description Language A Technology Independent, Standard Hardware description Language (HDL), used for digital system modeling, simulation, and synthesis There are several hardware description languages available; VHDL (Europe), Verilog (USA), and System C are the most common. Advantages of VHDL IEEE standard. Supported by all CAD Tools. Technology independent. Common Specially in Europe. Flexible Delay modeling, Matrices, etc. Supports easy modeling of various abstraction levels.

VHDL History VHDL History VHDL was developed as a language for modeling and simulation. 1981 VHSIC Initiated (US DoD) 1985 VHDL version 7.2 (IBM and TI) 1987 IEEE standard, VHDL 1076 1987 1993 Revised standard, VHDL 1164 1993 (std_logic_1164) 2008 Accellera approved VHDL 4.0 also informally known as VHDL 2008 Consequence: Mismatch between simulation and synthesis Most constructs in VHDL are fine for simulation, but cannot be synthesized, e.g., after, time, etc. With restrictions, VHDL can be used for synthesis. VHDL vs Software Design of Digital Systems VHDL allows the description of a concurrent system. VHDL is a dataflow language, unlike procedural computing languages s (C, C++, assembly code) which all run sequentially, one instruction at a time. key advantage of VHDL: allows the behavior of the required system to be described (modeled) and verified (simulated) before synthesis tools translate the design into real hardware (gates and wires). VHDL is used to design digital systems Simulation Synthesis Goal Reliable design process, with minimum cost and time Minimal design errors Synthesizable code Joachim Rodrigues, Informatik og Matematisk Modellering, jnr@imm.dtu.dk

Basic Design Methodology A Digital Design in VHDL Requirements A digital design in VHDL requires RTL Model Simulate Definition of required packages (libraries), e.g., std_logic_1164. An ENTITY (corresponds to the interface of a component). An ARCHITECTURE (describes its behavior). Synthesize An entity may have several architectures Gate level Model Simulate Test Bench Optional: A CONFIGURATION that connects an ARCHITECTURE to an ENTITY. Entity Adder library IEEE; use IEEE.std_logic_1164.all; entity Adder is A generic (N: integer); port( A : in std_logic_vector (N-1 downto 0); B : in std_logic_vector (N-1 downto 0); S : out std_logic_vector (N-1 downto 0) ); end Adder; B The ENTITY is the interface of a component. It contains all IO ports (port map) and possibly generics. N N Adder + N S Packages Datatypes Recommended types: integer, std_logic, and std_logic_vector. Integer to model generics or constants std_logic for one bit signals std_logic_vector A bus of std_logic, e.g., counters, addresses, etc. A std_logic may have ONE out of nine values, of which five are important here. U uninitialized when the simulator starts X forced unknown two signals driving the same output, short circuit 0 forced logic zero 1 forced logic one Z high impedance

Entity Port Declaration Examples of declarations 1 bit input port clk: in std_logic; 8 bit input port, MSB left (commonly used!!) a : in std_logic_vector (7 downto 0); 8 bit output port S : out std_logic_vector (7 downto 0); Possible values of std_logic are: 'U', '0', '1', ' ', 'Z', 'X Entity Generics Used to pass certain properties into a design to make it more general. Typically: Bus widths Delays The value can be set in the entity declaration (default value), component declaration, or component instantiation. clk port is special for clock pins and no in or out for signal names Architecture An architecture is: a pattern, a template, a way of doing it Architecture Basically two types of architectures: Behavioral: using sequential processes Structural: top level, component instantiation, concurrent processes Developing a good architecture involves: Coordination and optimization across many levels of abstraction....under a large set of constraints and requirements (that is changing over time). An iterative process involving design and analysis. Exploring the design space. Be. Behavioral Beh. Behavioral Behav. Be. Behav. Fully behavioral Partially beh. & struct. Pipelined structural

Architecture behavioral Architecture behavioral architecture behavioral of ADDER is add_a_b : process (A,B) s <= A+B; end process add_a_b; end architecture behavioral; A B N N Adder + N S Behavioral architecture Describes the algorithm performed by the module, FSM May contain Process statements Sequential statements Signal assignment statements Wait statements (not synthesizable) Architecture defines behavior of the circuit Architecture Structural Structural description Structural architecture Implements a module as a composition of components (modules) contains signal declarations, for internal interconnections the entity ports are also treated as signals component instances instances of previously declared entity/architecture pairs port maps in component instances connect signals to component ports In structural view, a circuit is constructed by smaller parts. Structural description specifies the types of parts and connections. Essentially a textual description of a schematic Done by using component in VHDL First declared (make known) Then instantiated (used)

Example Structural description Mixing Behavioral and Structural An architecture may contain both behavioral and structural parts process statements and component instances collectively called concurrent statements processes can read and assign to signals Ex: Register Transfer Logic (RTL) model data path described structurally control section described behaviorally Example: Structural Architecture Combinational and Sequential Parts

Concurrent Statements and Processes Process Example I Concurrent statements (simple processes): a <= b; c <= a + b; d <= a And B; Process statements: namelabel: process (a, b, sensitivity list) variable declarations All processes are executed in parallel (think of gates and sequential statements wires, not variables) if then [else elsif ] for n in 0 to 7 loop case b is s := z sll shamt; i := a + b; variable assignment, only in processes c <= i; concurrent signal assignment! end process namelabel; Process Example I (cont d) Process Example II Enable register with synchrounus reset process (clk, reset) if clk event and clk= 1 then if (Reset = '0') then Q <= '0'; elseif enable= 1 then Q <= D; end process ;

Case command Example: Multiplexer I2 architecture behv1 of Mux is I3 process(i3,i2,i1,i0,s) --nested in process -- use case statement S case S is when "00" => Op <= I0; --sequential statements when "01" => Op <= I1; when "10" => Op <= I2; when "11" => Op <= I3; when others => Op <= "ZZZ"; -- end case; end process; end behv1; I0 I1 IF vs. CASE statements If and case statements generate different HW a b c Mux c Case statement Case c is when 01 => q <= a; when 10 => q <= b; when others => q <= c; End case; q Use case if you have more than 3 inputs If statement If (c1= 1 ) then q <= a; Elseif (c2 = 1 ) then q <= b; Else q <= c; End if; b c Mux c2 a Mux c1 q Finite State Machines Basic State Machine Why FSMs? Models different behavoiur at different times (states) A state machine requires: An initial state (Reset) Transitions with stable states Default values (Case statement) St0 St1 Output of a Mealy machine is state and input dependent Realizes: Datapath Controller Datapath+Controller St3 A Typical state machine St2

Transforming a State Machine into HW Realization of FSMs St0 St1 St0 St3 Typical FSM St1 St2 Input d State r Behavioural Logic Combinatonial part D Clock Sequential part Generic Architecture for FSMs Output q next state rin Entity declaration library IEEE;use IEEE.STD_LOGIC_1164.all; entity state_machine is port (clk : in STD_LOGIC; reset : in STD_LOGIC; input : in STD_LOGIC_VECTOR(1 downto 0); output : out STD_LOGIC_VECTOR(1 downto 0) ); end state_machine; St3 St2 Realization of FSMs cont d Realization of FSMs cont d Architecture declaration (combinatonial part) architecture implementation of state_machine is type state_type is (st0, st1,st2, st3); -- defines states; signal state, next_state : state_type; signal next_output STD_LOGIC_VECTOR (m-1 downto 0); combinatonial : process (input,state,state) case (state) is -- Current state and input dependent when st0 => if (input = 01 ) then next_state <= st1; output <= 01 when... when others => next_state <= next_state; -- Default output <= 00 ; end case; end process; St0 01 / St1 01 St3 St2 Sequential part: synchronous : process (clk,reset) if clk event and clk = 1 then if reset = 1 then state <= st0; output <= 00 ; else state <= next_state; end process; end architecture; St0 St1 St3 St2

FSM Structure Summary A FSM can be split in three parts: State Transition Logic block State Memory block (register) Output logic Signals have a delta delay if not other delay is specified Variables are updated instantaneously Statements in an architecture body are concurrent a process are sequential Components need to be declared before instantiation FSMs are implemented using CASE statements Inferred Latches In case a process does not assign an output signal value: The old value is retained This is an inferred latch and the circuit is no longer combinational The latch is not explicit but is inferred from the VHDL code Normally caused by failure to consider all combinations Bad programming practice Bad1: process(sa,sb,a,b) if sa= 1 then Bad2: process(sa,a,b) z<=a; if sa= 1 then elsif sb= 1 then f<=a; z<=b; end process Bad2; end process Bad1; good: process(select,a,b) if select= 1 then z<=a; else z<=b; end process Mux; Simulation / Synthesis mismatch? For all combinational processes (no clock): All process input signals must be in the sensitivity list. Synthesis tools usually ignore the sensitivity list, but simulators don t! Wrong sensitivity list will cause mismatch in behavior between functional simulation and the synthesized circuit. Wrong: process (select,b) if select= 1 then z<=a; else z<=b; end process Wrong; Mux: process (select,a,b) if select= 1 then z<=a; else z<=b; end process Mux; a b sa sb L OR z a b select z a b L select z a b select z Both versions synthesize to the circuit to the right.

Summary The knowledge you have gained today is sufficient to implement a simple combinational or structural architecture. Testbench and Simulation Testing: Testbench and Circuit The testbench models the environment our circuit is situated in. Provides stimuli (input to circuit) during simulation. May verify the output of our circuit against test vectors. The testbench (VHDL) consists of: A top level entity connecting the circuit to the testbench One or more behavioral architectures (matching the refined level of our circuit). Testing is done at every abstraction level. Circuit Testbench Testbench and Simulation Testing larger circuits Testbench and Simulation Testing larger circuits Divide and conquer circuit testbench 3 subcomponents > 3 subtests: Test (simulation) fails! What then? How can I find the bug? Test strategy > documentation of design correctness. Good design = easy to test > a good design is a wellstructured well partitioned hierarchical design. Tip: Do not overdo it with too many entities! Design and test of pipelined circuits Pipelined-circuit One stage testbench A testbench B testbench C This will localize the problem or problems! Repeat the procedure if a faulty component consists of subcomponents, etc. testbench testbench With a good testbench it is also easy to verify that the final synthesized design works as specified.

Testbench Example Component declaration of the circuit being tested Clock generator Reset signal generator Component instantiation of the circuit being tested entity testbench is end testbench; architecture test of testbench is component circuit is port(clk,reset,inputs,outputs); end circuit; signal inputs,outputs,clk,reset : type; clk_gen: process if clk= 1 then clk<= 0 ; else clk<= 1 ; wait for clk_period/2; end process; reset <= 1, 0 after 57 ns; device: circuit port map (clk,reset,inputs,outputs); tester: process(clk,reset) The tester, which generates stimuli (inputs) and verifies the response. (outputs) end process; The tester could also be a end testbench; separate component. Testbench and Simulation Circuit Verification Input driver and output verification: Test vectors Testvector file Testvector: Input stimuli circuit Correct circuit output actual circuit output clk Equal? Simulation and Verification Functional simulation Simulation and Timing Verification Your initial specification: While designing a digital system you will rely on functional simulation to verify that your VHDL specification works. Cycle accurate RTL: After refining your VHDL specification to the synthesizable RTL abstraction level, you need to re verify, using the same testbench. After synthesis: This testbench is again used to simulate the post synthesis VHDL netlist (output of the synthesis tool), to verify that it actually works like your VHDL specification. After synthesis and place & route: Just after synthesis, the simulation is still only functional, we need to simulate the electrical timings of your circuit: Clock to output delay, contamination delay, propagation delay, wire delay, setup time, hold time, clock skew, The implementation tools (Synthesis + Place & Route) can generate a detailed timing model of your circuit which includes all the above parameters! The tools can also calculate maximum operating frequency Timing simulations with added test vectors are required to find bugs in the VHDL code, which were not caught by functional simulation or by the synthesis tool. Such bugs usually reflect bad design practices such as: improper use of latches, unintended glitches, metastable flip flops, reset/clock skew.

What s next? Continue sequence detector Find a lab buddy 2 nd VHDL presentation Monday next week First Deadline: Preparation of sequence detector Tuesday 7th