© Dr. Alaaeldin Amin 1 Behavioral Modeling in VHDL Dr. Alaaeldin Amin.

Slides:



Advertisements
Similar presentations
Mridula Allani Fall 2010 (Refer to the comments if required) ELEC Fall 2010, Nov 21(Adopted from Profs. Nelson and Stroud)
Advertisements

Integer Square Root.
6/27/20061 Sequence Detectors Lecture Notes – Lab 5 Sequence detection is the act of recognizing a predefined series of inputs A sequence detector is a.
Week 6.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 6 VHDL Programming [Adapted from Dave Patterson’s UCB CS152.
ECE C03 Lecture 18ECE C03 Lecture 61 Lecture 18 VHDL Modeling of Sequential Machines Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Sistemas Digitais I LESI - 2º ano Lesson 5 - VHDL U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes Dept.
Why Behavioral Wait statement Signal Timing Examples of Behavioral Descriptions –ROM.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
Topics of Lecture Structural Model Procedures Functions Overloading.
Topics Entity DeclarationsEntity Declarations Port ClausePort Clause Component DeclarationComponent Declaration Configuration DeclarationConfiguration.
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.
Finite State Machines Discussion D8.1 Example 36.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Introduction to VHDL (part 2)
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
1 H ardware D escription L anguages Modeling Complex Systems.
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.
7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
2-Jun-16EE5141 Chapter 3 ä The concept of the signal ä Process concurrency ä Delta time ä Concurrent and sequential statements ä Process activation by.
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.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
Timing Model VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals Execute.
(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.
Lecture 7 Chap 9: Registers Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
16/11/2006DSD,USIT,GGSIPU1 Packages The primary purpose of a package is to encapsulate elements that can be shared (globally) among two or more design.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
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.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
ECE DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Joal 2006 HT:1 Em3 Digital Electronics Design 1 Lecture 3-4 Sequential VHDLChap 4.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
1 - CPRE 583 (Reconfigurable Computing): VHDL overview 1 Iowa State University (Ames) CPRE 583 Reconfigurable Computing Lecture 2: 8/26/2011 (VHDL Overview.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Sequential statements (1) process
Basic Language Concepts
B e h a v i o r a l to R T L Coding
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
Some VHDL Details 10/8/08 ECE Lecture 8.
CPE/EE 422/522 Advanced Logic Design L06
ECE 434 Advanced Digital System L08
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
ELEC 5200/6200 Computer Architecture and Design Review of VHDL
VHDL (VHSIC Hardware Description Language)
VHDL Discussion Subprograms
Behavioral Modeling of Sequential-Circuit Building Blocks
VHDL Discussion Subprograms
Figure 8.1. The general form of a sequential circuit.
RASSP Education & Facilitation
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

© Dr. Alaaeldin Amin 1 Behavioral Modeling in VHDL Dr. Alaaeldin Amin

© Dr. Alaaeldin Amin 2 HW5

© Dr. Alaaeldin Amin 3 Process Statement Main Construct for Behavioral Modeling. Other Concurrent Statements Can Be Modeled By an Equivalent Process. Process Statement is a Concurrent Construct which Performs a Set of Consecutive (Sequential) Actions once it is Activated. Thus, Only Sequential Statements Are Allowed within the Process Body. OptionalOptional Process_Label: PROCESS(Sensitivity_List) Process_Declarations; Begin Sequential Statements; END Process; Whenever a SIGNAL in the Sensitivity_List of the Process Changes, The Process is Activated. After Executing the Last Statement, the Process is SUSPENDED Until one (or more) Signal in the Process Sensitivity_List Changes Value where it will be REACTIVATED. Constant/Variables No Signal Declarations Allowed

© Dr. Alaaeldin Amin 4 A Process Statement Without a Sensitivity_List is ALWAYS ACTIVE, i.e. After the Last Statement is Executed, Execution returns to the First Statement and Continues (Infinite Looping). It is ILLEGAL to Use WAIT-Statement Inside a Process Which Has a Sensitivity_List. In case no Sensitivity_List exists, a Process may be activated or suspended Using the WAIT-Statement : Syntax : WAIT; -- Process Suspended Indefinitely WAIT ON Signal_List; -- Waits for Events on one of the -- Signals in the List Equiv. To Process With Sensitivity_List. WAIT UNTIL Condition; -- Event Makes Condition True WAIT FOR Time_Out_Expression; Notes : When a WAIT-Statement is Executed, The process Suspends and Conditions for its Reactivation Are Set. Process Reactivation conditions may be Mixed as follows WAIT ON Signal_List UNTIL Condition FOR Time_Expression ; Process Reactivated IF: –Event Occurred on the Signal_List while the Condition is True, OR – Wait Period Exceeds ``Time_Expression `` UNLESS SUSPENDED, Process Execution –(1) Takes Zero Real Time (Process Executed in one Simulation Cycle  Delta Time). –(2) Repeats Forever (Infinite Loop)

© Dr. Alaaeldin Amin 5 Example: Process Begin A<= `1`; B <= `0`; End Process; __________________________________________________________________________________________________ Sequential Processing: –First A is Scheduled to Have a Value `1` –Second B is Scheduled to Have a Value `0` –A & B Get their New Values At the SAME TIME (1 Delta Time Later) __________________________________________________________________________________________________ Example: Process Begin A<= `1`; IF (A= `1`) Then Action1; Else Action2; End IF; End Process; Assuming a `0` Initial Value of A, –First A is Scheduled to Have a Value `1` One Delta Time Later –Thus, Upon Execution of IF_Statement, A Has a Value of `0` and Action 2 will be Taken. –If A was Declared as a Process Variable, Action1 Would Have Been Taken

© Dr. Alaaeldin Amin 6 Example- Delayed Clock Library ieee; Use ieee.STd_Logic_1164.ALL; Entity Delayed_Clk is Generic(TDel, T1: Time :=20 NS; TPer :Time := 100 NS; Initial: STd_Logic:='0'); Port( DClk : out STd_Logic); End Delayed_Clk ; Architecture Behave of Delayed_Clk is Signal Delay: Bit:='0'; Begin Delay <= '1' after Tdel; -- Flag Signal osc: Process Variable Tinitial : Time:=TPer-T1; Begin DClk <= Initial; If Initial = '1' Then Tinitial := T1; End If; If Delay='0' Then wait for TDel+Tinitial ; Else wait for Tinitial ; End if; Dclk <= not Initial; wait for TPer - Tinitial; End Process ; End Behave ; --____________________________________

© Dr. Alaaeldin Amin 7 Examples : An Edge-Triggered D-FF D_FF: PROCESS(CLK) Begin IF (CLK`Event and CLK = `1`) Then Q <= D After TDelay; END IF; END Process; D_FF: PROCESS -- No Sensitivity_List Begin WAIT UNTIL CLK = `1`; Q <= D After TDelay; END Process; D_FF: PROCESS(Clk, Clr) -- FF With Asynchronous Clear Begin IF Clr= `1` Then Q <= `0` After TD0; ELSIF (CLK`Event and CLK = `1`) Then Q <= D After TD1; END IF; END Process; wait on X,Y until (Z = 0) for 70 NS; -- Process Resumes After 70 NS OR (in Case X or Y Changes Value and Z=0 is True) Whichever Occurs First

© Dr. Alaaeldin Amin 8 Hand Shaking Protocol A prepares 4 bit data words, B needs 16 bit data word Interface system I Assembles 4-Data words from A and Pass them to B. Talk to A to get data, talk to B to put data ________________________________________________________________________________________________ ENTITY system_i IS PORT (in_data : In Bit_vector (3 Downto 0); Out_data : Out Bit_vector (15 Downto 0); In_ready, Out_received : In Bit; In_received, Out_ready : out Bit); END system_i; --

© Dr. Alaaeldin Amin 9 ARCHITECTURE waiting OF system_i IS SIGNAL buffer_full, buffer_picked : BIT := '0'; SIGNAL word_buffer : Bit_vector (15 Downto 0); BEGIN a_talk: PROCESS BEGIN... …………… -- Talk to A, collect 4 4-bit data, keep a count -- When ready, pass 16-bit data to b_talk... …………… END PROCESS a_talk; _______________________________________________________________________________________ ________ b_talk: PROCESS BEGIN ………… Wait for 16-bit data from a_talk -- When data is received, send to B using proper handshaking... END PROCESS b_talk; _______________________________________________________________________________________ ________ END waiting; a_talk process & b_talk process also talk to each other Use buffer_full, buffer_picked, and word_buffer for a_talk and b_talk communication a_talk gets data from A and talks to b_talk b_talk talks to a_talk and sends data to B

© Dr. Alaaeldin Amin 10 a_talk: PROCESS VARIABLE Count : INTEGER RANGE 0 TO 4 := 0; BEGIN Wait Until in_ready = '1'; count := count + 1; CASE count IS When 0 => NULL; When 1 => Word_buffer (03 DOWNTO 00) Word_buffer (07 DOWNTO 04) <= In_data; When 3 => Word_buffer (11 Downto 08) <= In_data; When 4 => word_buffer (15 DOWNTO 12) <= in_data; buffer_full <= '1'; -- Setting Wait UNTIL buffer_picked = '1'; buffer_full <= '0'; -- Resetting count := 0; -- Reset Counter END CASE; in_received <= '1'; WAIT UNTIL in_ready = '0'; in_received <= '0'; END PROCESS a_talk;

© Dr. Alaaeldin Amin 11 b_talk: PROCESS BEGIN If Buffer_full = '0' Then Wait Until Buffer_full = '1‘ ; End If; Out_data <= Word_buffer; buffer_picked <= '1'; Wait Until buffer_full = '0'; buffer_picked <= '0'; out_ready <= '1'; Wait Until out_received = '1'; out_ready <= '0'; END PROCESS b_talk; _____________________________________________________________________________

© Dr. Alaaeldin Amin 12 Generalized VHDL Mealy Model X F2 F1 Z Register Y D Architecture Mealy of fsm is Signal D, Y: Std_Logic_Vector(...); -- Local Signals Begin FFs: Process( Clk) Begin IF (Clk`EVENT and Clk = `1`) Then Y <= D; End IF; End Process; Transitions: Process(X, Y) Begin D <= F1(X, Y); End Process; Output: Process(X, Y) Begin Z <= F2(X, Y); End Process; End Mealy; Can Be One Process

© Dr. Alaaeldin Amin 13 Generalized VHDL MOORE Model Architecture Moore of fsm is Signal D, Y: Std_Logic_Vector(...); -- Local Signals Begin FFs: Process( Clk) Begin IF (Clk`EVENT and Clk = `1`) Then Y <= D; End IF; End Process; Transitions: Process(X, Y) Begin D <= F1(X, Y); End Process; Output: Process(Y) Begin Z <= F2(Y); End Process; End Moore; X F2 F1 Z Register Y D

© Dr. Alaaeldin Amin 14 FSM example entity fsm is port ( Clk, Reset : in Std_Logic; X : in Std_Logic_Vector(0 to 1); Z : out Std_Logic_Vector(1 downto 0)); end fsm; Architecture behavior of fsm is Type States is (st0, st1, st2, st3); Signal Present_State, Next_State : States ; Begin register : Process(Reset, Clk) Begin IF Reset = `1` Then Present_State <= st0; -- Machine -- Reset to st0 1st. Process elsIF (Clk`EVENT and Clk = `1`) Then Present_State <= Next_state; End IF; End Process;

© Dr. Alaaeldin Amin 15 Transitions: Process(Present_State, X) Begin CASE Present_State is when st0 => Z <= ``00``; IF X = ``11`` Then Next_State <= st0; else Next_State <= st1; End IF; when st1 => Z <= ``01``; IF X = ``11`` Then Next_State <= st0; else Next_State <= st2; End IF; when st2 => Z <= ``10``; IF X = ``11`` Then Next_State <= st2; else Next_State <= st3; End IF; when st3 => Z <= ``11``; IF X = ``11`` Then Next_State <= st3; else Next_State <= st0; End IF; End CASE; End Process; End behavior;

© Dr. Alaaeldin Amin 16 Behvioral Modeling of Combinational Logic Modeling Strategy 1. Put All Input Signals (X) in the Process Sensitivity List. 2. Define Local Process Variables (Zvar) Corresponding To the Output Signals Z 3. In the Process Body, Compute The Local Output Variables (Zvar) as Function of the Inputs X. 4. Circuit delay is modeled by assigning ZVAR to the Signals Z After Delay DEL. Process(X) -- Declare Process Variables Variable ZVAR: Bit; Begin -- Compute ZVAR=F(X) Z <= ZVAR After Del; End Process ; CL X Z Z = F(X)

© Dr. Alaaeldin Amin 17 Behvioral Modeling of Sequential Logic Modeling Strategy 1. Put Both the Input Signals (X) AND the Feedback Signals (Y) in the Process Sensitivity List. 2. Define Local Process Variables (Yvar and Zvar) Corresponding To the Feedback Signals (Y) and Output Signals Z Respectively. 3. In the Process Body, Compute The Local Variables (Yvar and Zvar) as Function of X and Yvar. 4. Circuit delay is modeled by assigning Yvar and Zvar to the Signals Y and Z After the Corresponding Delays. Process(X, Y) -- Declare Process Variables Variable Yvar, Zvar: Bit; Begin -- Compute YVAR and Zvar=F(X, Y) Z <= Zvar After Delz; Y <= Yvar After Dely; End Process ; SL X Z Z = F(X, Y) Y Y = F(X, Y)

© Dr. Alaaeldin Amin 18 Postponed Processes (VHDL-93) Ex:Process (a, b, c) Begin... End Process; IF a, b, c Change in Zero-Time but with one  -Delay from one another  –Multiple Process Activation (within  -Delay of Each other) –The final Activation Signal Transactions will Dominate –Unnecessary Execution of Processes result in Slower Operation Postponed Processes Activate Only After All Sensitivity List Signals Stabilize. Activates 3 Times Once Per Sensitivity List Signal Change

© Dr. Alaaeldin Amin 19 Postponed Process (VHDL-93) Ex:Postponed Process (a, b, c) Begin... End Process; Concurrent Statements, e.g. Signal Assignment, Are Also Sensitive to Changes in Signals on Their Right Hand Side  Postponed Keyword Can Be Used in This Case As Well. Example Concurrent1:Postponed a <= b AND c OR d ; Activates Only After All Sensitivity List Signals Stabilize (c in this case).

© Dr. Alaaeldin Amin 20 Passive Process A Process Which Assigns No Value to Any Signal Object is a Passive Process A Concurrent Procedure Call which Assigns No Value to Any Signal Object is also Passive. Passive Processes and Procedure Calls May be included in the Entity Specification. BASIC Declarations 1. Type Declarations 2. SubType Declarations 3. Constant Declarations 4. File Declarations 4. Alias Declarations 5. Subprogram Declarations 6. Use Clause Declarations Allowed After Port Statement in Entity: 1.Basic Declarations 2.Signal Declarations 3.Subprogram Body 4.Disconnection Specification 5.Attribute Declarations & Specifications

© Dr. Alaaeldin Amin 21 Entity Specifications The Following May be Included After A Begin Statement in an Entity Body 1. A Passive Process 2. A Passive Procedure Call 3. Concurrent Assert Statement Syntax: ENTITY Entity_Name IS [ Generic ( Component Parameters)] [PORT ( Definition of Input/Output Connectors )] [ Allowed Entity Declarations] [ Begin Passive Process, Passive Procedure Call or Assert Statements ] END Entity _Name ; END Entity ; is Also allowed in VHDL-93

© Dr. Alaaeldin Amin 22 Example: Assert Statements Placed in the Entity Declaration Example +ive Edge Triggered Register Design Entity Entity Register IS Generic (Ts, Th, TPW : Time ; En_Del, Out_Del, Clk_Del: Time n : in Positive) ; -- n = Number of Register Bits Port ( Din : in Bit_Vector(n-1 DownTo 0) ; Dout: Out Bit_Vector(n-1 DownTo 0) ; En, Clk : in Bit); Begin --Set-Up Time Check Assert (Clk=`0`) or Clk`Stable or Din`Stable(Ts) Report ``Setup Time Violation`` Severity Note; --Hold Time Check Assert (Clk`Delayed(Th)=`0`) or Clk`Delayed(HT)`Stable or Din`Stable(Th) Report ``Hold Time Violation`` Severity Note; --Check for Minimum Pulse Width Assert (Clk=`1`) or Clk`Stable or Clk`Delayed`Stable(TPW) Report ``Min Clock Pulse Width Violation`` Severity Note; END Register;