CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
Decoders and Encoders Lecture L4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 3 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s 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.
HDL-Based Digital Design Part I: Introduction to VHDL (I) Dr. Yingtao Jiang Department Electrical and Computer Engineering University of Nevada Las Vegas.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
Introduction to VHDL Multiplexers Discussion D1.1.
1 Lecture 11 Chap 13: Test Benches Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Introduction to VHDL (part 2)
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
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.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
1 ECE 545—Digital System Design with VHDL Lecture 6 Behavioral VHDL Coding (for Synthesis): Finite State Machines and ASMs 9/30/08.
陳慶瀚 機器智慧與自動化技術 (MIAT) 實驗室 國立中央大學資工系 2009 年 10 月 8 日 ESD-04 VHDL 硬體描述語言概論 VHDL Hardware Description Language.
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
CPE 626 Advanced VLSI Design Lecture 4: VHDL Recapitulation (Part 2) Aleksandar Milenkovic
1 ECE 545 – Introduction to VHDL Dataflow Modeling of Combinational Logic Simple Testbenches ECE 656. Lecture 2.
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.
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
VHDL for Finite State Machines. Sorry – no standard way One way –Use TYPE and SIGNAL ARCHITECTURE Behavior OF two_ones_fsm IS TYPE State_type IS ( A,
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
8-Jan-16EE5141 Chapter 6 Subprograms & Packages Subprogram declaration Subprogram body Package declaration Package body Resolution function Subprogram.
Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Sequential Statements Multi-valued logic systems Bus example Case Statement Looping statement Assert statement Finite State machines.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Sequential statements (1) process
Combinational logic circuit
Figure 7.1 Control of an alarm system
Part II A workshop by Dr. Junaid Ahmed Zubairi
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Dataflow Style Combinational Design with VHDL
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
ECE 4110–5110 Digital System Design
CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
CPE 626 Advanced VLSI Design Lecture 2: VHDL Recapitulation Aleksandar Milenkovic
ECE 434 Advanced Digital System L17
ECE 434 Advanced Digital System L15
CPE/EE 422/522 Advanced Logic Design L06
ECE 434 Advanced Digital System L08
CPE/EE 422/522 Advanced Logic Design L04
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
CPE 528: Lecture #4 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
VHDL (VHSIC Hardware Description Language)
CPE/EE 422/522 Advanced Logic Design L11
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
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.
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville

Review: IEEE 1164 Standard Logic Generics Generate Statements Outline Review: IEEE 1164 Standard Logic Generics Generate Statements Wait Statement Combinational Network Models Writing Test-benches Sequential Network Models 03/01/2019 UAH-CPE528

IEEE 1164 Standard Logic 9-valued logic system ‘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 If forcing and weak signal are tied together, the forcing signal dominates. Useful in modeling the internal operation of certain types of ICs. 03/01/2019 UAH-CPE528

Resolution Function for IEEE 9-valued 03/01/2019 UAH-CPE528

AND Table for IEEE 9-valued 03/01/2019 UAH-CPE528

AND Function for std_logic_vectors 03/01/2019 UAH-CPE528

Example: rise/fall time modeling Generics Used to specify parameters for a component in such a way that the parameter values must be specified when the component is instantiated Example: rise/fall time modeling 03/01/2019 UAH-CPE528

Rise/Fall Time Modeling Using Generics 03/01/2019 UAH-CPE528

Generate Statements Provides an easy way of instantiating components when we have an iterative array of identical components Example: 4-bit RCA 03/01/2019 UAH-CPE528

4-bit Adder 03/01/2019 UAH-CPE528

4-bit Adder using Generate 03/01/2019 UAH-CPE528

How wait statements work? ... an alternative to a sensitivity list Note: a process cannot have both wait statement(s) and a sensitivity list Generic form of a process with wait statement(s) How wait statements work? Execute seq. statement until a wait statement is encountered. Wait until the specified condition is satisfied. Then execute the next set of sequential statements until the next wait statement is encountered. ... When the end of the process is reached start over again at the beginning. process begin sequential-statements wait statement wait-statement ... end process; 03/01/2019 UAH-CPE528

Forms of Wait Statements wait on sensitivity-list; wait for time-expression; wait until boolean-expression; Wait on until one of the signals in the sensitivity list changes Wait for waits until the time specified by the time expression has elapsed What is this: wait for 0 ns; Wait until the boolean expression is evaluated whenever one of the signals in the expression changes, and the process continues execution when the expression evaluates to TRUE 03/01/2019 UAH-CPE528

MUX 16/1 Models library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity SELECTOR is port ( A : in std_logic_vector(15 downto 0); SEL : in std_logic_vector( 3 downto 0); Y : out std_logic); end SELECTOR; architecture RTL1 of SELECTOR is begin p0 : process (A, SEL) if (SEL = "0000") then Y <= A(0); elsif (SEL = "0001") then Y <= A(1); elsif (SEL = "0010") then Y <= A(2); elsif (SEL = "0011") then Y <= A(3); elsif (SEL = "0100") then Y <= A(4); elsif (SEL = "0101") then Y <= A(5); elsif (SEL = "0110") then Y <= A(6); elsif (SEL = "0111") then Y <= A(7); elsif (SEL = "1000") then Y <= A(8); elsif (SEL = "1001") then Y <= A(9); elsif (SEL = "1010") then Y <= A(10); elsif (SEL = "1011") then Y <= A(11); elsif (SEL = "1100") then Y <= A(12); elsif (SEL = "1101") then Y <= A(13); elsif (SEL = "1110") then Y <= A(14); else Y <= A(15); end if; end process; end RTL1; 03/01/2019 UAH-CPE528

MUX Models (cont’d) library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity SELECTOR is port ( A : in std_logic_vector(15 downto 0); SEL : in std_logic_vector( 3 downto 0); Y : out std_logic); end SELECTOR; architecture RTL3 of SELECTOR is begin with SEL select Y <= A(0) when "0000", A(1) when "0001", A(2) when "0010", A(3) when "0011", A(4) when "0100", A(5) when "0101", A(6) when "0110", A(7) when "0111", A(8) when "1000", A(9) when "1001", A(10) when "1010", A(11) when "1011", A(12) when "1100", A(13) when "1101", A(14) when "1110", A(15) when others; end RTL3; 03/01/2019 UAH-CPE528

MUX Models (cont’d) library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity SELECTOR is port ( A : in std_logic_vector(15 downto 0); SEL : in std_logic_vector( 3 downto 0); Y : out std_logic); end SELECTOR; architecture RTL2 of SELECTOR is begin p1 : process (A, SEL) case SEL is when "0000" => Y <= A(0); when "0001" => Y <= A(1); when "0010" => Y <= A(2); when "0011" => Y <= A(3); when "0100" => Y <= A(4); when "0101" => Y <= A(5); when "0110" => Y <= A(6); when "0111" => Y <= A(7); when "1000" => Y <= A(8); when "1001" => Y <= A(9); when "1010" => Y <= A(10); when "1011" => Y <= A(11); when "1100" => Y <= A(12); when "1101" => Y <= A(13); when "1110" => Y <= A(14); when others => Y <= A(15); end case; end process; end RTL2; 03/01/2019 UAH-CPE528

MUX Models (cont’d) library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity SELECTOR is port ( A : in std_logic_vector(15 downto 0); SEL : in std_logic_vector( 3 downto 0); Y : out std_logic); end SELECTOR; architecture RTL4 of SELECTOR is begin Y <= A(conv_integer(SEL)); end RTL4; 03/01/2019 UAH-CPE528

Assert Statement Checks to see if a certain condition is true, and if not causes an (error) message to be displayed Four possible severity levels NOTE WARNING ERROR FAILURE Action taken for a severity level depends on the simulator assert boolean-expression report string-expression severity severity-level; 03/01/2019 UAH-CPE528

Writing Test Benches - MUX 16:1 library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; entity TBSELECTOR is end TBSELECTOR; architecture BEH of TBSELECTOR is component SELECTOR port( A: in std_logic_vector(15 downto 0); SEL: in std_logic_vector(3 downto 0); Y: out std_logic); end component; signal TA : std_logic_vector(15 downto 0); signal TSEL : std_logic_vector(3 downto 0); signal TY, Y : std_logic; constant PERIOD : time := 50 ns; constant STROBE : time := 45 ns; 03/01/2019 UAH-CPE528

Writing Test Benches (cont’d) begin P0: process variable cnt : std_logic_vector(4 downto 0); for j in 0 to 31 loop cnt := conv_std_logic_vector(j, 5); TSEL <= cnt(3 downto 0); Y <= cnt(4); A <= (A’range => not cnt(4)); A(conv_integer(cnt(3 downto 0))) <= cnt(4); wait for PERIOD; end loop; wait; end process; 03/01/2019 UAH-CPE528

Writing Test Benches (cont’d) check: process variable err_cnt : integer := 0; begin wait for STROBE; for j in 0 to 31 loop assert FALSE report “comparing” severity NOTE; if (Y /= TY) then assert FALSE report “not compared” severity WARNING; err_cnt := err_cnt + 1; end if; wait for PERIOD; end loop; assert (err_cnt = 0) report “test failed” severity ERROR; assert (err_cnt /= 0) report “test passed” severity NOTE; wait; end process; sel1: SELECTOR port map (A => TA, SEL = TSEL, Y => TY); end BEH; 03/01/2019 UAH-CPE528

D-FFs library ieee; use ieee.std_logic_1164.all; entity flop is port(C, D : in std_logic; Q : out std_logic); end flop; architecture archi of flop is begin process (C) begin if (C'event and C='1') then Q <= D; end if; end process; end archi; library ieee; use ieee.std_logic_1164.all; entity flop is port(C, D, CLR : in std_logic; Q : out std_logic); end flop; architecture archi of flop is begin process (C, CLR) begin if (CLR = '1')then Q <= '0'; elsif (C'event and C='0')then Q <= D; end if; end process; end archi; 03/01/2019 UAH-CPE528

Latches library ieee; use ieee.std_logic_1164.all; entity latch is port(G, D : in std_logic; Q : out std_logic); end latch; architecture archi of latch is begin process (G, D) begin if (G='1') then Q <= D; end if; end process; end archi;   library ieee; use ieee.std_logic_1164.all; entity latch is port(G, D, CLR : in std_logic; Q : out std_logic); end latch; architecture archi of latch is begin process (CLR, D, G) begin if (CLR='1') then Q <= '0'; elsif (G='1') then Q <= D; end if; end process; end archi; 03/01/2019 UAH-CPE528

4-bit Register library ieee; use ieee.std_logic_1164.all; entity flop is port(C, CE, PRE : in std_logic; D : in std_logic_vector (3 downto 0); Q : out std_logic_vector (3 downto 0)); end flop; architecture archi of flop is begin process (C, PRE) begin if (PRE='1') then Q <= "1111"; elsif (C'event and C='1')then if (CE='1') then Q <= D; end if; end if; end process; end archi; 03/01/2019 UAH-CPE528

4-bit Unsigned Up Counter library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity counter is port(C, CLR : in std_logic; Q : out std_logic_vector(3 downto 0)); end counter; architecture archi of counter is signal tmp: std_logic_vector(3 downto 0); begin process (C, CLR) begin if (CLR='1') then tmp <= "0000"; elsif (C'event and C='1') then tmp <= tmp + 1; end if; end process; Q <= tmp; end archi; 03/01/2019 UAH-CPE528

General Form of a Sequential Network Combinational Combinational Flip-flops Z circuit circuit Q Clock 03/01/2019 UAH-CPE528

General Form of a Sequential Network Combinational Combinational Flip-flops Z circuit circuit Q Clock 03/01/2019 UAH-CPE528

An Example ¤ ¤ ¤ Reset w = 1 w = A z = B z = w = w = w = 1 C z = 1 w = A ¤ z = B ¤ z = w = w = w = 1 C ¤ z = 1 w = 1 03/01/2019 UAH-CPE528

VHDL Model USE ieee.std_logic_1164.all ; ENTITY simple IS PORT (Clock, Resetn, w : IN STD_LOGIC ; z : OUT STD_LOGIC ) ; END simple ; ARCHITECTURE Behavior OF simple IS TYPE State_type IS (A, B, C) ; SIGNAL y : State_type ; BEGIN PROCESS ( Resetn, Clock ) IF Resetn = '0' THEN y <= A ; ELSIF (Clock'EVENT AND Clock = '1') THEN -- cont’d ... 03/01/2019 UAH-CPE528

VHDL Model (cont’d) CASE y IS WHEN A => IF w = '0' THEN y <= A ; ELSE y <= B ; END IF ; WHEN B => y <= C ; WHEN C => END CASE ; END PROCESS ; z <= '1' WHEN y = C ELSE '0' ; END Behavior ; 03/01/2019 UAH-CPE528

VHDL Model – Alternative Style -- same as before ARCHITECTURE Behavior OF simple IS TYPE State_type IS (A, B, C) ; SIGNAL y_present, y_next : State_type ; BEGIN PROCESS ( w, y_present ) CASE y IS WHEN A => IF w = '0' THEN y_next <= A ; ELSE y_next <= B ; END IF ; WHEN B => ELSE y_next <= C ; WHEN C => END CASE ; END PROCESS ; 03/01/2019 UAH-CPE528

VHDL Model – Alternative Style (cont’d) PROCESS ( Clock, Resetn ) BEGIN IF Resetn = '0' THEN y_present <= A ; ELSIF (Clock'EVENT AND Clock = '1') THEN y_present <= y_next ; ENDIF; END PROCESS ; z <= ‘1’ WHEN y_present = C ELSE ‘0’; END Behavior ; 03/01/2019 UAH-CPE528