7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design.

Slides:



Advertisements
Similar presentations
Lecture 6 Chap 8: Sequential VHDL Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Advertisements

Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
Sequential Statements Module F3.2. Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements.
Week 6.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 6 VHDL Programming [Adapted from Dave Patterson’s UCB CS152.
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.
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.
Introduction to VHDL (part 2)
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
Data Flow Modeling of Combinational Logic Simple Testbenches
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.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
IAY 0600 Digital Systems Design VHDL discussion Dataflow&Behavioral Styles Combinational Design Alexander Sudnitson Tallinn University of Technology.
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
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.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
Generate Statement A generate statement provides a mechanism for iterative or conditional elaboration of a portion of description. The iterative elaboration.
(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.
IAY 0600 Digital Systems Design VHDL discussion Dataflow Style Combinational Design Alexander Sudnitson Tallinn University of Technology.
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
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.
2/10/07DSD,USIT,GGSIPU1 BCD adder KB3B2B1B0CD3D2D1D
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
9/9/2006DSD,USIT,GGSIPU1 Concurrent vs Sequential Combinational vs Sequential logic –Combinational logic is that in which the output of the circuit depends.
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)
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Subprograms Lecture 6. Subprograms A subprogram defines a sequential algorithm that performs some computations. Subprograms can be: –1. functions –2.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
Relational Operators Result is boolean: greater than (>) less than (=) less than or equal to (
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.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
Dataflow modelling Lecture 4. Dataflow modelling Specifies the functioning of a circuit without explicitly refer to its structure Functioning is described.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
Combinational logic circuit
Basic Language Concepts
Behavioral Style Combinational Design with VHDL
IAY 0600 Digital Systems Design
Dataflow Style Combinational Design with VHDL
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Behavioral Style Combinational Design with VHDL
Sequential Design.
IAS 0600 Digital Systems Design
Sequential-Circuit Building Blocks
ECE 434 Advanced Digital System L08
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Sequential Statements
IAS 0600 Digital Systems Design
ECE 448 Lecture 6 Modeling of Circuits with a Regular Structure Aliases, Constants, Packages Mixing Design Styles ECE 448 – FPGA and ASIC Design with.
Data Flow Modeling of Combinational Logic
VHDL (VHSIC Hardware Description Language)
VHDL Discussion Subprograms
Concurrent vs Sequential
Behavioral Modeling of Sequential-Circuit Building Blocks
VHDL Discussion Subprograms
Data Flow Description of Combinational-Circuit Building Blocks
IAS 0600 Digital Systems Design
Data Flow Description of Combinational-Circuit Building Blocks
Single bit comparator Single bit comparator 4/10/2007 DSD,USIT,GGSIPU
CprE / ComS 583 Reconfigurable Computing
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
Presentation transcript:

7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design

7/10/2007DSD,USIT,GGSIPU2 Sequential code Code written within the following statements execute sequentially. Process Functions Procedures

7/10/2007DSD,USIT,GGSIPU3 Process A process is a sequential section of VHDL code. It is characterized by the presence of following statements: If Statements Case Statements Null Statements Loop Statements –Exit Statements –Next Statements –While loops –For loops

7/10/2007DSD,USIT,GGSIPU4 Process (cont..) A Process must be installed in the main code, and is executed every time a signal in the sensitivity list changes (or the condition related to WAIT is fulfilled). Syntax: [label:] Process (sensitivity list) [variable name type [range] [:=initial value;]] Begin (sequential code) End Process [label];

7/10/2007DSD,USIT,GGSIPU5 Process Statements Label: process (sensitivity_signal_list) -- constant_declaration -- variable_declaration --Subprogram declaration -- signal declaration are not permitted here Begin --Sequential statements End process LABEL;

7/10/2007DSD,USIT,GGSIPU6 Used in architectures Every process statement within an architecture is executed once at the beginning of simulation, and thereafter, only when a signal in its sensitivity list changes value (I.e., when there is an event on one or more of the signal in the sensitivity list). The statements within processes must be sequential statements.

7/10/2007DSD,USIT,GGSIPU7 Variables declared within processes are static. They are initialized only once at the beginning of simulation and retain their values between process activations. The other form of process statements as no sensitivity list.

7/10/2007DSD,USIT,GGSIPU8 If Statements If_statement <= [if_label:] if Boolean_expression then {sequential statement} elsif Boolean_expression then {sequential statement} else {sequential statement} end if [if_label];

7/10/2007DSD,USIT,GGSIPU9 Caution for using if…..else statement Avoid using more than three levels of if…else……end if statements. If more than three levels are required, encapsulate the inner nested levels with procedure calls. Indent each level of if statement. When defining the condition, use parentheses levels of operations on the condition. Group the operations in a logical and readable order.

7/10/2007DSD,USIT,GGSIPU10 Single bit comparator A(1) A(0) gr: a(1) >a(0) sm: a(1) <a(0) eq: a(1)=a(0)

7/10/2007DSD,USIT,GGSIPU11 Truth table A(1)A(0)GrSmEq

7/10/2007DSD,USIT,GGSIPU12 Boolean equation Gr <= a(1) and (not a(0)) Le <= a

7/10/2007DSD,USIT,GGSIPU13 VHDL Code entity singlebitcomparator is Port ( a : in std_logic_vector(1 downto 0); en: in std_logic; gt : out std_logic; sm : out std_logic; eq : out std_logic); end singlebitcomparator; architecture Behavioral of singlebitcomparator is begin process (en,a) begin if (a(1)>a(0)) then gt <= '1'; sm <= '0'; eq <= '0'; elsif (a(1) < a(0)) then gt <= '0'; sm <= '1'; eq <= '0'; else gt <= '0'; sm <= '0'; eq <= '1'; end if; end process; end Behavioral;

7/10/2007DSD,USIT,GGSIPU14 Waveform of single bit comparator

7/10/2007DSD,USIT,GGSIPU15 4-bit comparator 1-bit comp A B

7/10/2007DSD,USIT,GGSIPU16 Boolean equation for 4-bit comparator Let A=a3a2a1a0 Let B=b3b2b1b0 Intermediate signal : i3,i2,i1 and i0 AeqB= i3i2i1i0 AgtB = a3(b3bar)+i3a2(b2bar)+i3i2a1(b1bar)+i3i2i1a0(b0bar) AltB = Not(AeqB+AgtB)

7/10/2007DSD,USIT,GGSIPU17 VHDL code of 4-bit comp entity comp4bit is Port ( x : in std_logic_vector(3 downto 0); y : in std_logic_vector(3 downto 0); en: in std_logic; greater : out std_logic; smaller : out std_logic; equal : out std_logic); end comp4bit; architecture Behavioral of comp4bit is component singlebitcomparator is Port ( a : in std_logic_vector(1 downto 0); en: in std_logic; gt : out std_logic; sm : out std_logic; eq : out std_logic); end component singlebitcomparator; signal temp : std_logic_vector(10 downto 0);

7/10/2007DSD,USIT,GGSIPU18 begin u1: singlebitcomparator port map(a(1)=>x(3),a(0)=>y(3),en=>en,gt=>temp(0),sm=>temp(1),eq=>temp(2)); u2: singlebitcomparator port map(a(1)=>x(2),a(0)=>y(2),en=>temp(2),gt=>temp(3),sm=>temp(4),eq=>temp(5)); u3: singlebitcomparator port map(a(1)=>x(1),a(0)=>y(1),en=>temp(5),gt=>temp(6),sm=>temp(7),eq=>temp(8)); u4: singlebitcomparator port map(a(1)=>x(0),a(0)=>y(0),en=>temp(8),gt=>temp(9),sm=>temp(10),eq=>equal); greater <= temp(0) or temp(3) or temp(6) or temp(9); smaller <= temp(1) or temp(4) or temp(7) or temp(10); end Behavioral;

7/10/2007DSD,USIT,GGSIPU19 Waveform of 4-bit comparator

7/10/2007DSD,USIT,GGSIPU20 4x1 Multiplexer library ieee; use ieee.std_logic_1164.all; entity mux4_1_if is port (a: in std_logic_vector(3 downto 0); s: in std_logic_vector(1 downto 0); y: out std_logic ); end mux4_1_if; architecture mux_behave of mux4_1_if is begin process (s) begin if s = "00" then y <= a(0); elsif s = "01" then y <= a(1); elsif s = "10" then y <= a(2); else y <= a(3); end if; end process; end mux_behave;

7/10/2007DSD,USIT,GGSIPU21 Case statements A case statement selects for execution one of a number of alternative sequences of statements. The syntax for a case statement is as follows: case expression is when value => assignments; end case;

7/10/2007DSD,USIT,GGSIPU22 Rule for the Case statement The case expression must be discrete type. Every possible value of the case expression must be covered in one and only one when clause (I.e cannot duplicate a value in another “when” clause). If the when others clause is used, it must appear as a single choice at the end of the case statement. NULL may be used, when no action is required to take place. e.g. When OTHERS => NULL;

7/10/2007DSD,USIT,GGSIPU23 Case choice must be a locally static expression. Array case expression must have a static subtype. Thus, the type of the case expression must not be based on generics. Rule for the Case statement….

7/10/2007DSD,USIT,GGSIPU24 Tips for programming using CASE Choices in a case statement should be separated by one blank line and should be indented. The sequence of statements should be immediately follow the case alternative specification and be indented by at least two spaces. Keep the expression for the case statement SIMPLE.

7/10/2007DSD,USIT,GGSIPU25 Example 4:1 Mux using Case statement library ieee; use ieee.std_logic_1164.all; entity mux4_1_case is port (a: in std_logic_vector(3 downto 0); s: in std_logic_vector(1 downto 0); y: out std_logic ); end mux4_1_case; architecture mux_behave of mux4_1_case is begin process (s) begin case s is when "00" => y<=a(0); when "01" => y <= a(1); when "10" => y <= a(2); when others => y <= a(3); end case; end process; end mux_behave;

7/10/2007DSD,USIT,GGSIPU26 Comparing “if” and “case” statements “if” statement produces priority-encoded logic “case” statement produces parallel logic Corresponds to “with---select” in concurrent statements. “case” statement does not result in prioritized logic structure unlike the if statement.

7/10/2007DSD,USIT,GGSIPU27 Loop Loop statement are used to execute a sequence of statements zero or more times. Loop is intended exclusively for sequential code. For/loop: The loop is repeated a fixed number of times. [label:] FOR identifier IN range LOOP (sequential statements) END LOOP [label];

7/10/2007DSD,USIT,GGSIPU28 Loop Statement Three forms of loop statements: –The simple loop –The while loop –The for loop Loop_statement::= [loop_label:][iteration_scheme] loop sequence_of_statements End loop [loop_label];

7/10/2007DSD,USIT,GGSIPU29 The Simple Loop The simple loop does not have an explicit iteration scheme. The implicit iteration scheme is while true, thus looping forever. The usual way to exit an infinite loop is to use the exit statement. The simple loop is not synthesizable.

7/10/2007DSD,USIT,GGSIPU30 The while loop The while loop iterates as long as the condition expressed in the while statement is true. This is often used to execute a set of sequential statements while a signal or a variable meets a certain criteria. The while loop is not synthesizable.

7/10/2007DSD,USIT,GGSIPU31 The for loop The loop parameter type for the for iteration loop scheme is the base type of the discrete range, and is not explicitly defined as a type. The type is implicitly defined from the range. Syntax: [label:] FOR identifier IN range LOOP (sequential statements) END LOOP [label];

7/10/2007DSD,USIT,GGSIPU32 1.The loop parameter is not explicitly defined, but implicitly defined. 2.The loop parameter’s range is tested at the beginning of the loop, not at the end. 3.The loop parameter is an object whose type is the base type of the discrete range. 4.Inside the loop, the loop parameter is a constant. Thus, it may be used but not altered.

7/10/2007DSD,USIT,GGSIPU33 5. The loop parameter’s discrete range may be dynamic. 6. The discrete range of the loop is evaluated before the loop is first executed. 7. The loop counter only exists within the loop Rules of for loop(cont..)

7/10/2007DSD,USIT,GGSIPU34 Example of For/loop FOR I in 0 to 5 loop x (i) <= enable AND w(i+2); y(0,i) <= w(i); End LOOP; NOTE: Range must be static.

7/10/2007DSD,USIT,GGSIPU35 Loop (cont.) WHILE/LOOP: The loop is repeated until a condition no longer holds. [label:] WHILE condition LOOP (sequential statements); end LOOP [label];

7/10/2007DSD,USIT,GGSIPU36 Example WHILE/Loop While (I <10) Loop wait until clk’event and clk=‘1’; (other statement) End loop;

7/10/2007DSD,USIT,GGSIPU37 Exit Statement Exit statement:is a sequential statement that can be used only inside a loop Syntax: exit [loop-label] [when condition]; Example: SUM:= 1; J := 0; L3: loop J:= J + 21; SUM := SUM * 10; if SUM > 100 then exit L3; --only exit is also possible --if no loop label is specified, the innermost loop is exited end if; end loop L3;

7/10/2007DSD,USIT,GGSIPU38 Next Statement Next Statement: skipping the remaining statements in the current iteration of the specified loop; - execution resumes with the first statement in the next iteration of this loop, if one exists - can be used only inside a loop - sequential statement - if no loop label is specified, the innermost loop is assumed Syntax next [loop-label] [When condition];

7/10/2007DSD,USIT,GGSIPU39 Next Statement (Example-1) Next statement can also cause an inner loop to be exited example: L4: for K in10 downto1 loop ……. L5:loop ………. next L4 when WR_Done := ‘ 1 ’ ; ………… end loop L5; …….. end loop L4;

7/10/2007DSD,USIT,GGSIPU40 Example (exit and Next) For I in data’range loop case data(I) is when ‘0’ => count:= count +1; when others => exit; end case; End loop;

7/10/2007DSD,USIT,GGSIPU41 Example (next) For I in 0 to 15 loop next when I= skip; -- jump to next iteration