VHDL and HDL Designer Primer Instructor: Jason D. Bakos.

Slides:



Advertisements
Similar presentations
Verilog Intro: Part 1.
Advertisements

1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
History TTL-logic PAL (Programmable Array Logic)
COE 1502 MIPS Multicycle CPU Architecture Sequential Logic & Control
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Digital System Design by Verilog University of Maryland ENEE408C.
FPGAs and VHDL Lecture L12.1. FPGAs and VHDL Field Programmable Gate Arrays (FPGAs) VHDL –2 x 1 MUX –4 x 1 MUX –An Adder –Binary-to-BCD Converter –A Register.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
VHDL and HDL Designer Primer Instructor: Jason D. Bakos.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
Simple Testbenches Behavioral Modeling of Combinational Logic
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
Data Flow Modeling of Combinational Logic Simple Testbenches
ECE 2372 Modern Digital System Design
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Introduction to Design Tools COE Review: Tools, functions, design flow Four tools we will use in this course – HDL Designer Suite FPGA Advantage.
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
Computer Engineering 1502 Advanced Digital Design Professor Donald Chiarulli Computer Science Dept.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
Finite State Machines VHDL ET062G & ET063G Lecture 6 Najeem Lawal 2012.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
George Mason University Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code ECE 448 Lecture 6.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Hardware Description Languages Digital Logic Design Instructor: Kasım Sinan YILDIRIM.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
Introduction to ASIC flow and Verilog HDL
CS/EE 3700 : Fundamentals of Digital System Design
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
5-1 Logic System Design I VHDL Design Principles ECGR2181 Reading: Chapter 5.0, 5.1, 5.3 port ( I: in STD_LOGIC_VECTOR (1 to 9); EVEN, ODD: out STD_LOGIC.
VHDL Programming Fundamentals Presented By Dr. Pradyut Kumar Biswal Department of Electronics, IIIT Bhubaneswar.
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
George Mason University Data Flow Modeling of Combinational Logic ECE 545 Lecture 5.
Combinational logic circuit
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL VHSIC Hardware Description Language VHSIC
Hardware Description Languages
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Data Flow Modeling of Combinational Logic
VHDL (VHSIC Hardware Description Language)
Concurrent vs Sequential
VHDL Introduction.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Sequntial-Circuit Building Blocks
(Sequential-Circuit Building Blocks)
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

VHDL and HDL Designer Primer Instructor: Jason D. Bakos

Fund. of VLSI Chip Design 2 VHDL (Appendix B in Textbook) HDL => VHDL / Verilog VHDL more verbose, better for team projects Not case-sensitive VHDL => “VHSIC Hardware Description Language” VHSIC => “US DoD Very-High-Speed Integrated Circuit” DoD project –Document behavior of ASICs from suppliers –Alternative to manuals Used to describe behavior of digital logic –Extensions for analog High-level programming language, subset of Ada –Also looks like Pascal IEEE standards: 1987, 1993, 2000, 2002 First came the language… …next came simulators… …then came synthesizers (FPGA and ASIC)

Fund. of VLSI Chip Design 3 VHDL By its nature, VHDL is –Self-documenting –Allows for easy testbench design (simulators, instruments) Any VHDL code may be simulated Only some VHDL codes may be synthesized –Depends on packages, data types, and constructs VHDL descriptions (programs) have structure similar to C++ Each design (component) is made up of –Entity section Component interface (I/O) Analogous to C++ header (public methods only) –Architecture section Contains behavior (implementation) Can have multiple architectures for any entity Example: different types of adders with consistent interfaces

Fund. of VLSI Chip Design 4 VHDL Semantics VHDL is fundamentally based on the concurrent assignment statement Example: Z <= A or B when C = ‘0’ else ‘1’; ABCZ C A B 1 2 gate delays 3 gate delays

Fund. of VLSI Chip Design 5 Entity / Architecture library ieee; use ieee.std_logic_1164.all; entity buffer is port ( a:in std_logic_vector(3 downto 0); y:out std_logic_vector(3 downto 0) ); end; architecture my_hypernifty_buffer of buffer is signal int_a : std_logic_vector(3 downto 0); begin int_a <= not a; y <= not int_a; end;

Fund. of VLSI Chip Design 6 Data Types In this course, you will only use 2 data types –std_logic Represents a bit signal Enermerated type: (1, 0, X, U, Z, -) 1, 0 are logic values X is “don’t know” – unassigned or shorted (double-driven) signals U is “unassigned” – special for un-initialized FF/register/memory Z is “high-impendence” – for tristated/floating outputs - is “don’t care” – for outputs, helps synthesizer minimize logic Use ‘1’ to represent scaler –std_logic_vector Array of std_logic Represents a “bus” signal Use “11” to represent scaler

Fund. of VLSI Chip Design 7 Sequential vs. Concurrent Semantics Problem: –Programming languages with sequential semantics: Assume B=0, C=5 A = B + C print A (output is 5) print B (output is 0) B = C print A (output is 5) print B (output is 5) –Hardware is concurrent Each line of code executes concurrently (no ordering) A = B + C print A (output is 10) print B (output is 5) B = C print A (output is 10) print B (output is 5) Example: –A <= B OR C when D=‘1’ else C OR D; –E <= A + B; How is this synthesized?

Fund. of VLSI Chip Design 8 Structural vs. Behavioral VHDL Structural VHDL –Resembles a netlist Defines instantiated components Interconnects –May contain library subroutine calls, operators, mux behavior –Can be directly (and easily) synthesized Behavioral VHDL –Defines how outputs are computed as function of inputs –Use a “process” Looks like a programming language Internally has sequential semantics (but as a unit behaves like concurrent assignment statement) Sensitivity list Process block implements concurrent assignment May contain variables Constructs: if-then, for-loop, while-loop, inf-loop Difficult to synthesize Not synthesizable: timed waits, file I/O, some loop structures

Fund. of VLSI Chip Design 9 Constructs in Structural VHDL Concurrent assignment statement [output] <= [function of inputs] after [delay] when [condition] else [function of inputs] after [delay] when [condition] else … [function of inputs]; Example: out <= A and B when sel=“00” else A or B when sel=“01” else A nor B when sel=“10” else A xor B; sel <= “00” when (C or D)=“0101” else “10”;

Fund. of VLSI Chip Design 10 Priority out <= A and B when sel=“00” else A or B when sel=“01” else A nor B when sel(1)=‘1’ else A xor B; What’s the problem with the above statement?

Fund. of VLSI Chip Design 11 Constructs in Process VHDL if-statement if a=“01” then y <= b; elsif a=“11” then y <= not(b)+1; else y <= “0000”; end if; Loops loop end loop; for i in 0 to 15 loop end loop; while end loop;

Fund. of VLSI Chip Design 12 Example process -- right-shift arithmetic for 8-bit signed integer rsa: process (a, shamt) variable fill : std_logic_vector(1 downto 0); variable temp : std_logic_vector(4 downto 0); begin for i in 0 to 3 loop fill(i):=‘1’ and a(3); end loop; if shamt(0)=‘1’ then temp := fill(0) & a(7 downto 1); end if; if shamt(1)=‘1’ then temp := fill(1 downto 0) & temp(7 downto 2); end if; if shamt(2)=‘1’ then out <= fill(3 downto 0) & temp(7 downto 4); end if; end process;

Fund. of VLSI Chip Design 13 Memory Memory is inferred: -- 8-bit rising-edge register with asynchronous reset reg8 : process(d, clk, en, rst) begin if rst=‘1’ then q <= “ ”; elseif clk’event and clk=‘1’ then if en=‘1’ then q <= d; end if; end process;

Fund. of VLSI Chip Design 14 HDL Designer Allows for rapid VHDL development –graphical design entry –generated VHDL –automated design flows Views –Block diagram –State machine –Truth table –Flow chart –VHDL view (combined or architecture-only) –Symbol

Fund. of VLSI Chip Design 15 Libraries in HDL Designer A library is a collection of components –Components have one or more views (implementations) Block diagram, truth table, flow chart, state machine, VHDL architecture –Each view has representations: Graphics, VHDL, simulator netlist, synthesis netlist CPUcontrol_unit CPU_lib VHDL archstate diagram gen. VHDLsim. binarysynth. netlist library component view representation graphics block diagram 2block diagram 1 ALU

Fund. of VLSI Chip Design 16 Libraries in HDL Designer Libraries are stored in four subdirectories –For each library you use or create, library mappings to these directories must be specified –The mappings for your set of libraries are stored in your project file Lives in your group directory /libraries \ALU_lib \CPU_lib \hds \hdl \work \ls source directory HDL directory simulation directory synthesis directory

Fund. of VLSI Chip Design 17 Projects Projects are a collection of library mappings tutorial ALU_Lib ALU Src (hds) (graphical view) HDL (generated) Downstream (compiled for sim) Downstream (compiled for synth) Project Library Component

Fund. of VLSI Chip Design 18 Projects, Libraries, Files ALUCPU ALU_LibCOELibCPU_Lib Shared Project ieee src fileshdl filessim filessynth files

Fund. of VLSI Chip Design 19 HDL Designer GUI

Fund. of VLSI Chip Design 20 Block Diagram Editor

Fund. of VLSI Chip Design 21 Block Diagram Editor

Fund. of VLSI Chip Design 22 Flowchart Editor

Fund. of VLSI Chip Design 23 Lookup Table Editor

Fund. of VLSI Chip Design 24 State Machine Editor

Fund. of VLSI Chip Design 25 VHDL Editor

Fund. of VLSI Chip Design 26 Components Library components can be instantiated in other designs –Shown as green blocks For bottom-up design –Libraries also contain “blocks” Attached to the design they were created in Shown as blue blocks For top-down design –Embedded blocks – embedded into block diagram Shown as yellow blocks Embeds behavior into structure –ModuleWare Allows you to add integrated parameratized behaviors registers, memories, gates, muxes, decoders, etc.

Fund. of VLSI Chip Design 27 Sequential Logic Combinational logic –Output = f (input) Sequential logic –Output = f (input, input history) –Involves use of memory elements Registers

Fund. of VLSI Chip Design 28 Finite State Machines FSMs are made up of: –input set –output set –states (one is start state) –transitions FSMs are used for controllers No missile detected Standby Fire=no Target Fire = no missile detected Launch Fire= yes miss hit Locked on Input alphabet {missile detected, locked on, hit, miss} Output alphabet{fire} No locked on

Fund. of VLSI Chip Design 29 Finite State Machines Registers –Hold current state value Output logic –Encodes output of state machine Moore-style –Output = f(current state) »Output values associated with states Mealy-style –Output = f(current state, input) »Output values associated with state transitions »Outputs asynchronous Next-state logic –Encodes transitions from each state –Next state = f(current state, input) Synchronous state machines transition on clock edge RESET signal to return to start state (“sanity state”) Note that state machines are triggered out-of-phase from the input and any memory elements they control

Fund. of VLSI Chip Design 30 Example Design a coke machine controller –Releases a coke after 35 cents entered –Accepts nickels, dimes, and quarters, returns change –Inputs Driven for 1 clock cycle while coin is entered COIN = { 00 for none, 01 for nickel, 10 for dime, 11 for quarter} –Outputs Driven for 1 clock cycle RELEASE = { 1 for release coke } CHANGE releases change, encoded as COIN input

Fund. of VLSI Chip Design 31 Example We’ll design this controller as a state diagram view in FPGA Advantage Add new state (First is start state) Add new transition Add new hierarchical state Note: transitions into and out of a hierarchical state are implicitly ANDed with the internal entrance and exit conditions

Fund. of VLSI Chip Design 32 Example Go to state diagram properties to setup the state machine…

Fund. of VLSI Chip Design 33 Example Specify the output values for each state in the state properties

Fund. of VLSI Chip Design 34 Example Specify the transition conditions and priority in the transition properties

Fund. of VLSI Chip Design 35 Example

Fund. of VLSI Chip Design 36 Example

Fund. of VLSI Chip Design 37 State Machine VHDL Let’s take a look at the VHDL for the FSM –Enumerated type: STATE_TYPE for states –Internal signals, current_state and next_state –clocked process handles reset and state changes –nextstate process assigns next_state from current_state and inputs Implements next state logic Syntax is case statement –output process assigns output signals from current_state Might also use inputs here

Fund. of VLSI Chip Design 38 Types ARCHITECTURE fsm OF coke IS -- Architecture Declarations TYPE STATE_TYPE IS ( standby, e5, e10, e25, e30, e15, e20, e35, e50, e40, e55, e45 ); -- Declare current and next state signals SIGNAL current_state : STATE_TYPE ; SIGNAL next_state : STATE_TYPE ;

Fund. of VLSI Chip Design 39 “clocked” Process clocked : PROCESS( clk, rst ) BEGIN IF (rst = '1') THEN current_state <= standby; -- Reset Values ELSIF (clk'EVENT AND clk = '1') THEN current_state <= next_state; -- Default Assignment To Internals END IF; END PROCESS clocked;

Fund. of VLSI Chip Design 40 “nextstate” Process nextstate : PROCESS ( coin, current_state ) BEGIN CASE current_state IS WHEN standby => IF (coin = "01") THEN next_state <= e5; ELSIF (coin = "10") THEN next_state <= e10; ELSIF (coin = "11") THEN next_state <= e25; ELSE next_state <= standby; END IF; WHEN e5 => IF (coin = "10") THEN next_state <= e15; ELSIF (coin = "11") THEN next_state <= e30; ELSIF (coin = "01") THEN next_state <= e10; ELSE next_state <= e5; END IF; WHEN e10 => …

Fund. of VLSI Chip Design 41 “output” process output : PROCESS ( current_state ) BEGIN -- Default Assignment change <= "00"; release <= '0'; -- Default Assignment To Internals -- Combined Actions CASE current_state IS WHEN standby => change <= "00" ; release <= '0' ; WHEN e5 => change <= "00" ; release <= '0' ; WHEN e10 => change <= "00" ; release <= '0' ; WHEN e25 => change <= "00" ; release <= '0' ; WHEN e30 => change <= "00" ; release <= '0' ; WHEN e15 => change <= "00" ; release <= '0' ; …

Fund. of VLSI Chip Design 42 Hierarchical States hstate1

Fund. of VLSI Chip Design 43 Testbenches “Harness” for a component Interface matching –Inputs  Outputs Allows –Stimulation of input signals –Output signal checking ASSERTs Waiting/branching based on outputs –Debugging with waveforms Testbench component –Block diagram Tester component –Typically a flowchart

Fund. of VLSI Chip Design 44 Testbenches Advantage over ad hoc methods –Ex. do-files Allows simulation of inputs, but no output checking Testbench code reveals interface specification and functionality (“self documenting”) Reproducible –Can use same testbench for multiple implementations/generations of a component –Can generate or utilize data file to share tests between simulation and hardware testing

Fund. of VLSI Chip Design 45 Testbenches A test procedure is a methodology for testing a design –Sequence of steps –Testing aspects of a design’s functionality Example: ALU –Test each type of operation with different inputs –Along with asserting inputs/operations, can also verify correctness of output values –Also, use if-then-else semantics

Fund. of VLSI Chip Design 46 Testbenches Facilities in HDL Designer –Easy creation of tester/testbench –Flowchart view is natural choice for implementing a test bench Mirrors test procedure in a graphical representation –VHDL support for testbenches ASSERT/REPORT/SEVERITY clause –Can use boolean operators here Testbench operates in simulation

Fund. of VLSI Chip Design 47 Testbenches Simple testbench example Drive inputs Wait for combinational logic Wait for clock edges ASSERT/REPORT/SEVERITY Repeat