Modeling & Simulating ASIC Designs with VHDL Reference: Smith text: Chapters 10 & 12.

Slides:



Advertisements
Similar presentations
History TTL-logic PAL (Programmable Array Logic)
Advertisements

Mridula Allani Fall 2010 (Refer to the comments if required) ELEC Fall 2010, Nov 21(Adopted from Profs. Nelson and Stroud)
VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
ECE C03 Lecture 18ECE C03 Lecture 61 Lecture 18 VHDL Modeling of Sequential Machines Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
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.
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.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 2 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
Introduction to VHDL By Mr. Fazrul Faiz Zakaria School of Computer and Communication Engineering UniMAP.
Introduction to VHDL (part 2)
1 H ardware D escription L anguages Basic Language Concepts.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Data Flow Modeling of Combinational Logic Simple Testbenches
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
VHDL TUTORIAL Preetha Thulasiraman ECE 223 Winter 2007.
1 H ardware D escription L anguages Modeling Complex Systems.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #17 – Introduction.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
Fall 09, Aug 19 ELEC / Lecture 2 (from Prof. Nelson's and Prof. Stroud's course material) 1 ELEC / Computer Architecture.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
ELEC / Computer Architecture and Design Fall 2009 ELEC / Computer Architecture and Design Fall 2009 Modeling for Synthesis.
RTL Hardware Design by P. Chu Chapter Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators RTL Hardware.
陳慶瀚 機器智慧與自動化技術 (MIAT) 實驗室 國立中央大學資工系 2009 年 10 月 8 日 ESD-04 VHDL 硬體描述語言概論 VHDL Hardware Description Language.
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
HARDWARE DESCRIPTION LANGUAGE (HDL). What is HDL? A type of programming language for sampling and modeling of electronic & logic circuit designs It can.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Introduction to ASIC flow and Verilog HDL
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
VHDL Programming Fundamentals Presented By Dr. Pradyut Kumar Biswal Department of Electronics, IIIT Bhubaneswar.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
Modeling & Simulating ASIC Designs with VHDL Reference: Smith text: Chapters 10 & 12.
Unit 4 Structural Descriptions SYLLABUS Highlights of Structural descriptions Organization of the Structural descriptions Binding State Machines Generate(HDL),Generic(VHDL),
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Data Flow and Behavioral Modeling in VHDL 1 MS EMBEDDED SYSTEMS.
An Introduction to V.H.D.L.. Need of a Compiler… main( ) { int x=10,y=20,z; z = x + y ; printf ( “ %d “, z ); getch( ) ; } What’s That ? Give me only.
Sequential statements (1) process
Basic Language Concepts
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
ECE 434 Advanced Digital System L08
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
VHDL VHSIC Hardware Description Language VHSIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
ELEC 5200/6200 Computer Architecture and Design Review of VHDL
VHDL (VHSIC Hardware Description Language)
VHDL Discussion Subprograms
VHDL Introduction.
Behavioral Modeling of Sequential-Circuit Building Blocks
VHDL Discussion Subprograms
Figure 8.1. The general form of a sequential circuit.
Modeling Complex Behavior
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
(Sequential-Circuit Building Blocks)
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

Modeling & Simulating ASIC Designs with VHDL Reference: Smith text: Chapters 10 & 12

HDLs in Digital System Design  Model and document digital systems  Hierarchical models  System, RTL (Register Transfer Level), Gates  Different levels of abstraction  Behavior, structure  Verify circuit/system design via simulation  Automated synthesis of circuits from HDL models  using a technology library  output is primitive cell-level netlist (gates, flip flops, etc.)

Anatomy of a VHDL model  “Entity” describes the external view of a component  “Architecture” describes the internal behavior and/or structure of the component  Example: 1-bit full adder A B Cin Sum Cout Full Adder

Example: 1-Bit Full Adder entity full_add1 is port (-- I/O ports a: in bit;-- addend input b: in bit;-- augend input cin: in bit;-- carry input sum: out bit;-- sum output cout: out bit);-- carry output end full_add1 ; Comments follow double-dash Type of signal Signal direction (mode)Signal name I/O Port Declarations

Port: Identifier: Mode Data_type;  Identifier (naming) rules:  Can consist of alphabet characters (a-z), numbers (0-9), and underscore (_)  First character must be a letter (a-z)  Last character cannot be an underscore  Consecutive underscores are not allowed  Upper and lower case are equivalent (case insensitive)  VHDL keywords cannot be used as identifiers 1 of 3

Port: Identifier: Mode Data_type;  Mode  in - driven into the entity from an external source (can read, but not update within architecture)  out - driven from within the entity (can drive but not read within architecture)  inout – bidirectional; drivers both within the entity and external (can read or write within architecture)  buffer – like “out” but can read and write 2 of 3

Port: Identifier: Mode Data_type;  Data_type : = scalar or aggregate signal type  Scalar (single-value) signal types:  bit – values are ‘0’ or ‘1’  std_logic – same as bit, but for standard simulation/synthesis (IEEE standard 1164)  integer - values [-2 31 … +( )] on 32-bit host  Aggregate (multi-value) signal types:  bit_vector – array of bits  std_logic_vector – array of std_logic (IEEE 1164)  All vectors must have a range specified: Ex. bit_vector(3 downto 0) or std_logic_vector(0 to 3) 3 of 3

-- For simulation and synthesis, std_logic preferred over bit. -- Provides additional logic states as data values type STD_LOGIC 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); You must include the library and package declarations in the VHDL model before the entity. (Example on next slide) IEEE std_logic_1164 package

Example: 8-bit full adder -- Adder with 8-bit inputs/outputs library ieee; --supplied library use ieee.std_logic_1164.all; --package of definitions entity full_add8 is port ( a: in std_logic_vector(7 downto 0); b: in std_logic_vector(7 downto 0); cin: in std_logic; sum: out std_logic _vector(7 downto 0); cout: out std_logic); end full_add8 ;

Format for Architecture body architecture architecture_name of entity_name is -- data type definitions (ie, states, arrays, etc.) -- internal signal declarations signal signal_name: signal_type; : signal signal_name: signal_type; -- component declarations – see format below -- function and procedure declarations begin -- behavior of the model is described here and consists of concurrent interconnecting: -- component instantiations -- processes -- concurrent statements including: Signal Assignment statements When-Else statements With-Select-When statements end architecture architecture_name; Note: entity and architecture in the end statement is optional.

Architecture defines function/structure -- behavioral model (no circuit structure implied) architecture dataflow of full_add1 is signal x1: std_logic; -- internal signal begin x1 <= a xor b after 1 ns; sum <= x1 xor cin after 1 ns; cout <= (a and b) or (a and cin) or (b and cin) after 1 ns; end;

Structural architecture example (no “behavior” specified) architecture structure of full_add1 is component xor-- declare component to be used port (x,y: in bit; z: out bit); end component; for all: xor use entity work.xor(eqns); -- if multiple arch’s signal x1: bit;-- signal internal to this component begin G1: xor port map (a, b, x1); -- instantiate 1 st xor gate G2: xor port map (x1, cin, sum); -- instantiate 2 nd xor gate …add circuit for carry output… end;

Associating signals with formal ports component AndGate port (Ain_1, Ain_2 : in BIT; -- formal parameters Aout : out BIT); end component; -- positional association: A1:AndGate port map (X, Y, Z1); -- named association: A2:AndGate port map (Ain_2=>Y, Aout=>Z2, Ain_1=>X); -- both (positional must begin from leftmost formal): A3:AndGate port map (X, Aout => Z3, Ain_2 => Y);

Example: D flip-flop entity DFF is port (Preset: in bit; Clear: in bit; Clock: in bit; Data: in bit; Q: out bit; Qbar: out bit); end DFF; Data Clock Q Qbar Preset Clear

7474 D flip-flop equations architecture eqns of DFF is signal A,B,C,D: bit; signal QInt, QBarInt: bit; begin A <= not (Preset and D and B) after 1 ns; B <= not (A and Clear and Clock) after 1 ns; C <= not (B and Clock and D) after 1 ns; D <= not (C and Clear and Data) after 1 ns; Qint <= not (Preset and B and QbarInt) after 1 ns; QBarInt <= not (QInt and Clear and C) after 1 ns; Q <= QInt; -- Can drive but not read “outs” QBar <= QBarInt; -- Can read & drive “internals” end;

4-bit Register (Structural Model) entity Register4 is port ( D: in bit_vector(0 to 3); Q: out bit_vector(0 to 3); Clk: in bit; Clr: in bit; Pre: in bit); end Register4; D(3) Q(3) D(2)D(1)D(0) Q(2) Q(1) Q(0) CLK PRE CLR

Register Structure architecture structure of Register4 is component DFF-- declare library component to be used port (Preset: in bit; Clear: in bit; Clock: in bit; Data: in bit; Q: out bit; Qbar: out bit); end component; signal Qbar: bit_vector(0 to 3); -- dummy for unused FF outputs begin -- Signals connect to ports in order listed above F3: DFF port map (Pre, Clr, Clk, D(3), Q(3), Qbar(3)); F2: DFF port map (Pre, Clr, Clk, D(2), Q(2), Qbar(2)); F1: DFF port map (Pre, Clr, Clk, D(1), Q(1), Qbar(1)); F0: DFF port map (Pre, Clr, Clk, D(0), Q(0), Qbar(0)); end;

Conditional Signal Assignment signal a,b,c,d,y: std_logic; signal S: std_logic_vector(0 to 1); begin with S select y <= a after 1 ns when “00”, b after 1 ns when “01”, c after 1 ns when “10”, d after 1 ns when “11”; --Alternative “default”: d after 1 ns when others; abcdabcd S y 4-to-1 Mux

32-bit-wide 4-to-1 multiplexer signal a,b,c,d,y: bit_vector(0 to 31); signal S: bit_vector(0 to 1); begin with S select y <= a after 1 ns when “00”, b after 1 ns when “01”, c after 1 ns when “10”, d after 1 ns when “11”; --a,b,c,d,y can be any type, as long as they are the same abcdabcd S y 4-to-1 Mux

Conditional Signal Assignment – Alternate Format y <= a after 1 ns when (S=“00”) else b after 1 ns when (S=“01”) else c after 1 ns when (S=“10”) else d after 1 ns; Use any boolean expression for each condition: y <= a after 1 ns when (F=‘1’) and (G=‘0’) … abcdabcd S y 4-to-1 Mux

VHDL “Process” Construct [label:] process (sensitivity list) declarations begin sequential statements end process;  Process statements executed once at start of simulation  Process halts at “end” until an event occurs on a signal in the “sensitivity list”  Allows conventional programming language methods to describe circuit behavior

Modeling sequential behavior -- Edge-triggered flip flop/register entity DFF is port (D,CLK: in bit; Q: out bit); end DFF; architecture behave of DFF is begin process(clk) -- “process sensitivity list” begin if (clk’event and clk=‘1’) then Q <= D after 1 ns; end if; end process; end;  Process statements executed sequentially (sequential statements)  clk’event is an attribute of signal clk which is TRUE if an event has occurred on clk at the current simulation time D Q CLK

Edge-triggered flip-flop Alternative methods for specifying clock process (clk) begin if rising_edge(clk) then -- std_logic_1164 function Q <= D ; end if; end process; Leonardo also recognizes not clk’stable as equivalent to clk’event

Alternative to sensitivity list process -- no “sensitivity list” begin wait on clk; -- suspend process until event on clk if (clk=‘1’) then Q <= D after 1 ns; end if; end process;  Other “wait” formats: wait until (clk’event and clk=‘1’) wait for 20 ns;  This format does not allow for asynchronous controls  Process executes endlessly if no sensitivity list or wait statement! D Q CLK

Level-Sensitive D latch vs. D flip-flop entity Dlatch is port (D,CLK: in bit; Q: out bit); end Dlatch; architecture behave of Dlatch is begin process(D, clk) begin if (clk=‘1’) then Q <= D after 1 ns; end if; end process; end; Latch, Q changes whenever the latch is enabled by CLK=‘1’ (rather than edge-triggered) D Q CLK

Defining a “register” for an RTL model (not gate-level) entity Reg8 is port (D: in bit_vector(0 to 7); Q: out bit_vector(0 to 7); LD: in bit); end Reg8; architecture behave of Reg8 is begin process(LD) begin if (LD’event and LD=‘1’) then Q <= D after 1 ns; end if; end process; end; D and Q could be any abstract data type Reg8 D(0 to 7) Q(0 to 7) LD

Basic format for synchronous and asynchronous inputs process (clock, asynchronously_used_signals ) begin if (boolean_expression) then asynchronous signal_assignments elsif (boolean_expression) then asynchronous signal assignments elsif (clock’event and clock = contstant) then synchronous signal_assignments end if ; end process;

Synchronous vs. Asynchronous Flip-Flop Inputs entity DFF is port (D,CLK: in bit; PRE,CLR: in bit; Q: out bit); end DFF; architecture behave of DFF is begin process(clk,PRE,CLR) begin if (CLR=‘0’) then -- async CLR has precedence Q <= ‘0’ after 1 ns; elsif (PRE=‘0’) then -- then async PRE has precedence Q <= ‘1’ after 1 ns; elsif (clk’event and clk=‘1’) then Q <= D after 1 ns; -- sync operation only if CLR=PRE=‘1’ end if; end process; end; CLR D Q CLK PRE

Modeling Finite State Machines (Synchronous Sequential Circuits)  FSM design & synthesis process: 1. Design state diagram (behavior) 2. Derive state table 3. Reduce state table 4. Choose a state assignment 5. Derive output equations 6. Derive flip-flop excitation equations  Synthesis steps 2-6 can be automated, given the state diagram

Synchronous Sequential Circuit Model Comb. Logic FFs Inputs x Outputs z Next State Y Present State y Mealy Outputs z = f(x,y), Moore Outputs z = f(y) Next State Y = f(x,y) Clock

Synchronous Sequential Circuit (FSM) Example

FSM Example – entity definition entity seqckt is port ( x: in bit;-- FSM input z: out bit;-- FSM output clk: in bit );-- clock end seqckt;

FSM Example - behavioral model architecture behave of seqckt is type states is (A,B,C); -- symbolic state names (enumerate) signal curr_state,next_state: states; begin -- Model the memory elements of the FSM process (clk) begin if (clk’event and clk=‘1’) then pres_state <= next_state; end if; end process; (continue on next slide)

FSM Example - continued -- Model next-state and output functions of the FSM process (x, pres_state) -- function inputs begin case pres_state is -- describe each state when A => if (x = ‘0’) then z <= ‘0’; next_state <= A; else -- if (x = ‘1’) z <= ‘0’; next_state <= B; end if; (continue next slide for pres_state = B and C)

FSM Example (continued) when B => if (x=‘0’) then z <= ‘0’; next_state <= A; else z <= ‘1’; next_state <= C; end if; when C => if (x=‘0’) then z <= ‘0’; next_state <= C; else z <= ‘1’; next_state <= A; end if; end case; end process;

Alternative Format for Output and Next State Functions -- Output function z <= ‘1’ when ((curr_state = B) and (x = ‘1’)) or ((curr_state = C) and (x = ‘1’)) else ‘0’; -- Next state function next_state <= A when ((curr_state = A) and (x = ‘0’)) or ((curr_state = B) and (x = ‘0’)) or ((curr_state = C) and (x = ‘1’)) else B when ((curr_state = 1) and (x = ‘1’)) else C;

library IEEE; use IEEE.STD_LOGIC_1164.all; entity SM1 is port (aIn, clk : in Std_logic; yOut: out Std_logic); end SM1; architecture Moore of SM1 is type state is (s1, s2, s3, s4); signal pS, nS : state; begin process (aIn, pS) begin – next state and output functions case pS is when s1 => yOut <= '0'; nS <= s4; --Moore: yOut = f(pS) when s2 => yOut <= '1'; nS <= s3; when s3 => yOut <= '1'; nS <= s1; when s4 => yOut <= '1'; nS <= s2; end case; end process; process begin wait until clk = '1'; pS <= nS; -- update state variable on next clock end process; end Moore;

library IEEE; use IEEE.STD_LOGIC_1164.all; entity SM2 is port (aIn, clk : in Std_logic; yOut: out Std_logic); end SM2; architecture Mealy of SM2 is type state is (s1, s2, s3, s4); signal pS, nS : state; begin process(aIn, pS) begin -- Mealy: yOut & nS are functions of aIn and pS case pS is when s1 => if (aIn = '1') then yOut <= '0'; nS <= s4; else yOut <= '1'; nS <= s3; end if; when s2 => yOut <= '1'; nS <= s3; when s3 => yOut <= '1'; nS <= s1; when s4 => if (aIn = '1') then yOut <= '1'; nS <= s2; else yOut <= '0'; nS <= s1; end if; end case; end process; process begin wait until clk = '1' ; pS <= nS; end process; end Mealy;

when s1 => -- initiate row access ras <= ’0’ ; cas <= ’1’ ; ready <= ’0’ ; next_state <= s2 ; when s2 => -- initiate column access ras <= ’0’ ; cas <= ’0’ ; ready <= ’0’ ; if (cs = ’0’) then next_state <= s0 ; -- end of operation if cs = 0 else next_state <= s2 ; -- wait in s2 for cs = 0 end if ; when s3 => -- start cas-before-ras refresh ras <= ’1’ ; cas <= ’0’ ; ready <= ’0’ ; next_state <= s4 ; when s4 => -- complete cas-before-ras refresh ras <= ’0’ ; cas <= ’0’ ; ready <= ’0’ ; next_state <= s0 ; end case ; end process ; end rtl ;

Synthesizing arithmetic circuits (12.6.5, , )  Leonardo recognizes overloaded operators and generated corresponding circuits: “+”, “-”, “*”, and “abs”  Special operations: “+1”, “-1”, unary “-”  Relational Operators: “=“, “/=“, “ “, “ =“  Use “ranged integers” instead of unbound to minimize generated logic. signal i : integer range 0 to 15;