EITF35: Introduction to Structured VLSI Design

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

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

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

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

In our case Dr. Johnson is setting the best practices

Control and Datapath 8

Lecture 12 VHDL Synthesis

Computer-Aided Digital System Design VHDL

Hardware Description Language VHDL (1) Introduction

Summary of FPGA & VHDL

C-Based Hardware Design

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

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

Hardware Description Languages. Modeling Complex Systems

HDL. Hardware Description Languages extensively used for:

Basic Language Concepts

Digital Design with SystemVerilog

EITF35: Introduction to Structured VLSI Design

EEL 4783: Hardware/Software Co-design with FPGAs

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

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

A bird s eye view on VHDL!

VHDL simulation and synthesis

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

Concurrent Signal Assignment Statements (CSAs)

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

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

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

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

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

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

Modeling Complex Behavior

Lecture 3 Introduction to VHDL

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it.

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

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

Sequential Logic - Module 5

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

Introduction to VHDL #3

VHDL Examples Mohamed Zaky

VHDL in 1h. Martin Schöberl

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

Synthesizable Verilog

N-input EX-NOR gate. N-output inverter. N-input NOR gate

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

VHDL for Logic Synthesis

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

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

VHDL: A Crash Course

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Lecture 32: SystemVerilog

Mridula Allani Fall Fall

Programming with HDLs

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

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

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

Tutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy

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

CprE 583 Reconfigurable Computing

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

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

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

Introduction to VHDL #1

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

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

VHDL for Synthesis. Course Description. Course Duration. Goals

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

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

ECE 3401 Lecture 10. More on VHDL

VHDL for FPGA Design. by : Mohamed Samy

ENGIN 241 Digital Systems with Lab

3 Designing Digital Systems with Algorithmic State Machine Charts

A Tutorial Introduction 1

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

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

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

ELCT 501: Digital System Design

VHDL for Logic Synthesis

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

Embedded Systems CS - ES

Fundamental Design Concepts. Fundamental Concepts. Modeling Domains. Basic Definitions. New terminology and overloaded use of common words

Declarations of Components and Entities are similar Components are virtual design entities entity OR_3 is

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

EITF35: Introduction to Structured VLSI Design

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

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

EECS150 - Digital Design Lecture 10 Logic Synthesis

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

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

Outline of this Introduction to VHDL

EITF35: Introduction to Structured VLSI Design

What Is VHDL? VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE 1076 standard (1987, 1993)

Reconfigurable Hardware Design (coursework)

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

Synthesis of Digital Systems CS 411N / CSL 719. Part 3: Hardware Description Languages - VHDL

VHDL: RTL Synthesis Basics. 1 of 59

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

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

Lecture 15: System Modeling and Verilog

Transcription:

EITF35: Introduction to Structured VLSI Design Part 1.2.2: VHDL-1 Liang Liu liang.liu@eit.lth.se 1

Outline VHDL Background Basic VHDL Component An example FSM Design with VHDL Simulation & TestBench 2

What is VHDL? Very high speed integrated circuit Hardware Description Language 3

Why use an HDL? 4

Not really in all cases 5

Why use an HDL? Advantages of VHDL Supports easy modeling of various abstraction levels from the gate level to the system level Supported by all CAD Tools Technology independent easy to move VHDL code between different commercial platforms Used by industry and academia worldwide Specially in Europe 6

VHDL vs. Verilog Equivalent for RTL modeling Both are industrial standards and are supported by most software tools VHDL more popular in Europe/Verilog in US & Asian VHDL is more flexible in syntax and usage 7

VHDL vs. Verilog System Modeling For high level behavioral modeling, VHDL is better VHDL had packedge and library concept Verilog has built-in gate level and transistor level primitives Verilog is better than VHDL at below the RTL level. Data Type Verilog does not have ability to define new data types VHDL has more data types but is strick and NOT ALL data types can be used for hardware. Back annotation SDF (Standard Delay Format) for Verilog 8

Other HDLs SystemVerilog (*) a superset of Verilog, with enhancements to address system-level design and verification Verilog/VHDL-AMS a standardized language for mixed analog/digital simulation SystemC a standardized class of C++ libraries for high-level behavioral and transaction modeling of digital hardware at a high level of abstraction High-level synthesis Fast prototyping and proof of concept Catapult C (DSP Design) Vivado HLS Suggestion: Do NOT use it before you can handle traditional HDL 9

Outline VHDL Background What is VHDL? Why VHDL? Basic VHDL Component An example FSM Design with VHDL Simulation & TestBench 10

Simple Tutorial to VHDL For all C/C++/Matlab guys Forget everything you know! Do NOT code if you don t know what HARDWARE will be generated 11

Traditional PL v.s. VHDL Traditional PL Operations performed in a sequential order Help human s thinking process to develop an algorithm step by step (dangous in HDL) Resemble the operations of a basic computer model HDL Characteristics of digital VLSI Connectiosn of parts Concurrent operations Concept of propagation delay and timing 12

Design Flow 1. Text description (spec.) 2. Pseudocode (algorithms) 3. Block diagrams (datapath, controller, and interface) 4. ASM chart of the controller 5. RTL (VHDL/Verilog) code 6. Testbench, functional simulation and debugging 7. Synthesis and post-synthesis simulation 8. Implementation and timing simulation 9. Experimental testing 13

Sample Design Flow Design Target (Spec.) Design a single bit half adder with carry and enable Performance? Detailed Functionality Passes results only on enable high and zero on enable low Result gets x plus y Carry gets any carry of x plus y x y enable Half Adder carry result 14

Step1: Behavioral Design Starting with an algorithm, a high level description of the adder is created. IF enable = 1 THEN result = x XOR y carry = x AND y ELSE carry = 0 result = 0 X y enable Half Adder carry result The model can (MUST) be simulated at this high level description to verify correct understanding of the problem, e.g., Matlab 15

Step2: Circuit Design A structural description is created at the module level, circuit design IF enable = 1 THEN result = x XOR y carry = x AND y ELSE carry = 0 result = 0 x y enable Components in the library (x AND y) AND enable (x'y OR xy') AND enable carry result 16

Step2: Circuit Design A structural description is created at the module level, circuit design These modules should be pulled from a library of parts Suggestion: Always draw block diagram before coding 17

Step3: VHDL Coding Entity Declaration An entity declaration describes the interface of the component PORT clause indicates input and output ports An entity can be thought of as a symbol for a component x y enable Half Adder carry result library IEEE; use IEEE.std_logic_1164.all; ENTITY half_adder IS PORT (x, y, enable: IN bit; carry, result: OUT bit); END half_adder; ARCHITECTURE data_flow OF half_adder IS BEGIN carry <= (x AND y) AND enable; result <= (x XOR y) AND enable; END data_flow; LIBRARY DECLARATION ENTITY DECLARATION ARCHITECTURE BODY See Packages in IEEE liabrary: http://www.csee.umbc.edu/portal/help/vhdl/stdpkg.html 18

VHDL Entity entity my_ckt is port ( A: in bit; B: in bit; S: in bit; X: out bit; Y: out bit ); end my_ckt; A B S my_ckt Name of the circuit User-defined One entity per file Filename same as circuit name. Example: Circuit name: my_ckt Filename: my_ckt.vhd X Y 19

VHDL Entity entity my_ckt is port ( A: in bit; B: in bit; S: in bit; X: out bit; Y: out bit ); end my_ckt; A B S my_ckt X Y Port names or Signal names i_clk_r, i_rst_n 20

VHDL Entity entity my_ckt is port ( A: in bit; B: in bit; S: in bit; X: out bit; Y: out bit ); end my_ckt; A B S my_ckt X Y Direction of port 3 main types: in: Input out: Output inout: Bidirectional 21

VHDL Entity entity my_ckt is port ( A: in bit; B: in bit; S: in bit; X: out bit; Y: out bit ); end my_ckt; A B S my_ckt Datatypes: bit, bit_vector integer std_logic, std_logic_vector User-defined X Y 22

VHDL Entity entity my_ckt is port ( A: in bit; B: in bit; S: in bit; X: out bit; Y: out bit ); end my_ckt; A B S my_ckt X Y Note the absence of semicolon ; at the end of the last signal and the presence at the end of the closing bracket 23

VHDL Coding Architecture A pattern, a template, a way of doing it Architecture declarations describe the operation of the component Many architectures may exist for one entity library IEEE; use IEEE.std_logic_1164.all; ENTITY half_adder IS PORT (x, y, enable: IN bit; carry, result: OUT bit); END half_adder; ARCHITECTURE data_flow OF half_adder IS BEGIN carry <= (x AND y) AND enable; result <= (x XOR y) AND enable; END data_flow; 24

Architecture Basically three types of architectures: Dataflow: how is the data transmitted from input to output Behavioral: using sequential processes Structural: top level, component instantiation, concurrent processes Be. Behavioral Behavioral Beh. Behav. Fully behavioral Pipelined structural 25

Architecture Body # 1 Behavioral Architecture: Describes the algorithm performed by the module, e.g., FSM May contain Process statements Sequential statements Signal assignment statements ARCHITECTURE behavior1 OF half_adder IS BEGIN PROCESS (enable, x, y) BEGIN IF (enable = '1') THEN result <= x XOR y; carry <= x AND y; ELSE carry <= '0'; Not all behavioral model can be translated to hardware result <= '0'; END PROCESS; END behavior1; 26

Architecture Body # 2 Structural architecture: Implements a module as a composition of components (modules), a textual description of a schematic Contains Component, Signal declarations define the components (gates) and wires to be used entity ports are treated as signals Component instances instances of previously declared entity/architecture pairs Port maps in component instances connect signals to component ports 27

Architecture Body # 2 (cntd.) ENTITY not_1 IS PORT (a: IN bit; output: OUT bit); END not_1; ARCHITECTURE data_flow OF not_1 IS BEGIN output <= NOT(a); x x y enable carry END data_flow; ENTITY and_2 IS y result PORT (a,b: IN bit; output: OUT bit); END and_2; ARCHITECTURE data_flow OF and_2 IS BEGIN output <= a AND b; END data_flow; 28

Architecture Body # 2 (cntd.) ENTITY or_2 IS PORT (a,b: IN bit; output: OUT bit); END or_2; ARCHITECTURE data_flow OF or_2 IS BEGIN output <= a OR b; END data_flow; ENTITY and_3 IS PORT (a,b,c: IN bit; output: OUT bit); END and_3; x y x y enable carry result ARCHITECTURE data_flow OF and_3 IS BEGIN output <= a AND b AND c; END data_flow; 29

Architecture Body # 2 (cntd.) ARCHITECTURE structural OF half_adder IS COMPONENT and2 PORT(a,b: IN bit; output: OUT bit); END COMPONENT; COMPONENT and3 PORT(a,b,c: IN bit; output: OUT bit); END COMPONENT; COMPONENT or2 PORT(a,b: IN bit; output: OUT bit); END COMPONENT; COMPONENT not1 PORT(a: IN bit; output: OUT bit); END COMPONENT; SIGNAL v,w,z,nx,nz: BIT; BEGIN c1: not1 PORT MAP (a=>x,output=>nx); c2: not1 PORT MAP (y,ny); c3: and2 PORT MAP (nx,y,v); c4: and2 PORT MAP (x,ny,w); c5: or2 PORT MAP (v,w,z); c6: and2 PORT MAP (enable,z,result); c7: and3 PORT MAP (x,y,enable,carry); END structural; x y c3 c4 v w x y enable z c6 carry result 30

Advantages of Structural description Hierarchy Allows for the simplification of the design Component Reusability Allows the re-use of specific components of the design (Latch, Flip-flops, half-adders, etc) Design Independent Allows for replacing and testing components without redesigning the circuit 31

Architecture - Mixing Behavioral and Structural An architecture may contain both behavioral and structural parts Process statements and component instances Example: Register-Transfer-Level (RTL) model data path described structurally (component) control section described behaviorally Be. Partially behavioral. & structural. Behav. 32

Summary 33

VHDL Process Contains a set of sequential statements to be executed sequentially Can be interpreted as a circuit part enclosed inside a black box Model a circuit s abstract behaviror Not ALL process can be mapped to hardware Process statements: name_label: process (sensitivity list) variable declarations begin sequential statements if then [else elsif ] end if; for n in 0 to 7 loop case b is i := a + b; --variable assignment, only in processes c <= i; --signal assignment! end process namelabel; 34

VHDL Process: Example 1 A process is activated when a signal in the sensitivity list changes its value 35

VHDL Process: Example 2 if rising_edge(clk) then if falling_edge(clk) then Enable register with synchrounus reset process (clk) begin if (clk event and clk= 1 ) then if (Reset = '0') then Q <= '0'; elseif enable= 1 then Q <= D; end if; end if; end process ; 36

Case Statment Example: Multiplexer architecture behv1 of Mux is begin I2 process(i3,i2,i1,i0,s) --inputs to process I3 begin -- use case statement case S is when "00" => Op <= I0; --sequential statements when "01" => Op <= I1; when "10" => Op <= I2; when "11" => Op <= I3; when others => Op <= I0; end case; end process; end behv1; I0 I1 S Op 37

Sequential Signal Assignment Signal assignment in process Actual value of an expression will NOT be assigned to a signal until the END of the process No intermediate value process(a,b,c,d) begin y <= a or c; y <= a and b; y <= c and d; end process; process(a,b,c,d) begin y <= c and d; end process; Avoid assigning a signal multiple times! 38

Outline VHDL Background What is VHDL? Why VHDL? Basic VHDL Component A example FSM Design with VHDL Simulation & TestBench 39

Finite State Machine (FSM) 00 / 00 St0 01 / 01 01 / 01 St1 00 / 00 00 / 11 Output of a Mealy machine is state and input dependent 01 / 10 St3 01 / 10 St2 00 / 11 A Typical state machine 40

Transforming a State Diagram into HW d q 00 / 00 01 / 01 St0 00 / 00 St3 01 / 10 Typical FSM 01 / 01 01 / 10 St1 r 00 / 11 St2 00 / 11 Input d State r_out Next state Logic Output Logic Combinatonial part D Clock Sequential part Output q next state r_in Generic architecture for FSMs 41

VHDL Realization of FSMs 00 / 00 St0 01 / 01 01 / 01 St1 Entity declaration 00 / 00 00 / 11 library IEEE; use IEEE.STD_LOGIC_1164.all; entity state_machine is port (clk : in STD_LOGIC; reset : in STD_LOGIC; St3 01 / 10 01 / 10 input : in STD_LOGIC_VECTOR(1 downto 0); output : out STD_LOGIC_VECTOR(1 downto 0) ); end state_machine; St2 00 / 11 42

VHDL Realization of FSMs (cont d) Architecture declaration (combinational part) architecture implementation of state_machine is type state_type is (st0,st1,st2,st3); -- Defines states; signal state, next_state : state_type; begin combinatonial : process (input,state) begin case (state) is -- Current state and input dependent when st0 => if (input = 01 ) then next_state <= st1; output <= 01 else... end if; when... when others => next_state <= st0; -- Default end case; end process; end implementation; 43 output <= 00 ; Suggestion: Use enumerate data type for states Input d State r_out Next state Logic Output Logic Combinatonial part D Clock Sequential part Output q next state r_in

VHDL Realization of FSMs (cont d) Architecture declaration (sequential part) synchronous : process (clk) begin if (clk event and clk = 1 ) then if reset = 1 then else state <= st0; state <= next_state; end if; end if; end process; end architecture; Input State Behavioural Logic Combinatonial part D Clock Sequential part Output next state Generic Architecture for FSMs Suggestion: Separate the processes of Comb. And Seq. 44

Outline VHDL Background What is VHDL? Why VHDL? How to code VHDL? Basic VHDL Component A example FSM Design with VHDL Simulation & TestBench 45

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. Verification should be conducted at ALL design levels. Circuit 30% Testbench 70% 46

Testbench Example 47 Top level entity connecting the circuit to the testbench Component declaration of the circuit being tested Clock generator Reset signal generator Component instantiation of the circuit being tested The tester, which generates stimuli (inputs) and verifies the response (outputs) The tester could also be a separate component. 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; begin clk_gen: process begin if clk= 1 then clk<= 0 ; else clk<= 1 ; end if; 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) begin. end process; end testbench;

Testbench and Simulation: Testing larger circuits Divide and conquer circuit Test (simulation) fails! What then? testbench How can I find the bug? 3 subcomponents -> 3 subtests: testbench A testbench B testbench C This will localize the problem or problems! Repeat the procedure if a faulty component consists of subcomponents, etc. Overall Test is still needed!!! 48

Recommendation Readings Mujtaba Hamid, Writing Efficient Testbenches, Xilinx Application Note http://www.xilinx.com/support/documentation/application_n otes/xapp199.pdf VHDL Test Bench Tutorial, University of Pennsylvania http://www.seas.upenn.edu/~ese171/vhdl/vhdltestbench. pdf 49

Questions? 57