RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.

Slides:



Advertisements
Similar presentations
VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Advertisements

ECE C03 Lecture 18ECE C03 Lecture 61 Lecture 18 VHDL Modeling of Sequential Machines Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
Acknowledgements: LRS - UNI Erlangen-Nuremberg
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
Synthesis Presented by: Ms. Sangeeta L. Mahaddalkar ME(Microelectronics) Sem II Subject: Subject:ASIC Design and FPGA.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
Copyright © 1997 Altera Corporation & 提供 What is VHDL Very high speed integrated Hardware Description Language (VHDL) –is.
ENG241 Digital Design Week #8 Registers and Counters.
Copyright © 1997 Altera Corporation 11/20/2015 P.1 Beginner VHDL Training Class Danny Mok Altera HK FAE
Copyright © 1997 Altera Corporation & 提供 Beginner VHDL Training Class Danny Mok Altera HK FAE
Lecture 7 Chap 9: Registers Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
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.
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.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
Apr. 3, 2000Systems Architecture I1 Introduction to VHDL (CS 570) Jeremy R. Johnson Wed. Nov. 8, 2000.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
VHDL 7: use of signals v.5a1 VHDL 7 Use of signals In processes and concurrent statements.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
Overview Logistics Last lecture Today HW5 due today
Sequential statements (1) process
Combinational logic circuit
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Week #7 Sequential Circuits (Part B)
Basic Language Concepts
Systems Architecture Lab: Introduction to VHDL
Registers and Counters
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
B e h a v i o r a l to R T L Coding
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.
Custom Designed Integrated Circuits
ECE 4110–5110 Digital System Design
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
In processes and concurrent statements
IAS 0600 Digital Systems Design
Sequential-Circuit Building Blocks
ECE 434 Advanced Digital System L08
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
SYNTHESIS OF SEQUENTIAL LOGIC
Non-synthesizable VHDL Poor Design Practices
VHDL (VHSIC Hardware Description Language)
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
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.
Data Flow Description of Combinational-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
Data Flow Description of Combinational-Circuit Building Blocks
Modeling Complex Behavior
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).
EEL4712 Digital Design (Midterm 1 Review).
Presentation transcript:

RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب الزماني

Combinational Process: Sensitivity List Library IEEE; use IEEE.Std_Logic_1164.all;   entity IF_EXAMPLE is port (A, B, C, X : in std_ulogic_vector(3 downto 0);           Z                : out std_ulogic_vector(3 downto 0)); end IF_EXAMPLE;     architecture A of IF_EXAMPLE is begin      process (A, B, C, X)      begin         if ( X = "1110" ) then            Z <= A;         elsif (X = "0101") then            Z <= B;         else            Z <= C;         end if;      end process; end A; مرتضي صاحب الزماني

Combinational Process: Sensitivity List process (A, B, SEL) begin   if SEL = `1` then     Z <= A;   else     Z <= B;   end if; end process; If SEL is missing in the sensitivity list, what will the behaviour (simulation) be? Sensitivity list is usually ignored during synthesis.  All signals which are read are entered into the sensitivity list. May result in non-equivalent behavior of simulation model and hardware مرتضي صاحب الزماني

WAIT Statement <-> Sensitivity List process begin   if SEL = `1` then     Z <= A;   else     Z <= B;   end if; WAIT ON A,B,SEL; end process; Equivalent Processes Mutually exclusive: Either sensitivity list or wait statement. process (A, B, SEL) begin   if SEL = `1` then     Z <= A;   else     Z <= B;   end if; end process; مرتضي صاحب الزماني

Combinational Process: Incomplete Assignments Library IEEE; use IEEE.Std_Logic_1164.all;     entity INCOMP_IF is port (A, B, SEL :in std_ulogic;          Z              : out std_ulogic); end INCOMP_IF;     architecture RTL of INCOMP_IF is begin process (A, B, SEL) begin        if SEL = `1` then            Z <= A;        end if; end process; end RTL; What is the value of Z, if SEL = `0` ? What hardware would be generated during synthesis? Latchي كه هنگام SEL = ‘1’ شفاف است (Transparent latch). هم احتمالاٌ ناخواسته است هم در مدارهاي سنكرون FFها بهترند چون قبل از پايداري مدار تركيبي از ثبت مقادير سيگنالهاي مياني غير مجاز جلوگيري مي كنند. مرتضي صاحب الزماني

Modeling of Flip-Flops Library IEEE; use IEEE.Std_Logic_1164.all;    entity FLOP is port (D, CLK        : in std_ulogic;          Q                  : out std_ulogic); end FLOP;    architecture A of FLOP is begin       process       begin           wait until CLK`event and CLK=`1`;           Q <= D;       end process; end A; مرتضي صاحب الزماني

Description of Rising Clock Edge for Synthesis براي عناصرحافظه: if يا wait until به صورت خاص Standard for synthesis: IEEE 1076.6 ... if condition RISING_EDGE (CLK) (not always supported) CLK‘event and CLK='1' CLK='1' and CLK‘event not CLK‘stable and CLK='1' CLK='1' and NOT CLK‘stable مرتضي صاحب الزماني

Description of Rising Clock Edge for Synthesis ... wait until condition RISING_EDGE (CLK) CLK‘event and CLK='1' CLK='1' and CLK‘event not CLK‘stable and CLK='1' CLK='1' and not CLK‘stable CLK='1' You should refer to the documents of your synthesis tool. مرتضي صاحب الزماني

Description of Rising Clock Edge for Synthesis In Std_Logic_1164 package process begin    wait until RISING_EDGE(CLK);    Q <= D; end process; function RISING_EDGE (signal CLK : std_ulogic)              return boolean is begin      if (  CLK`event and CLK =`1`                              and CLK`last_value=`0`) then          return true;      else          return false;      end if; end RISING_EDGE; مرتضي صاحب الزماني

Gated Clock Designers avoid using gated clocks because of problematic timing behavior of the circuit (adds skew). Low power designs deliberately disable clocks to reduce or eliminate power waste by useless switching of transistors. process begin    wait until RISING_EDGE(CLK); if (DGATE) then     Q <= D; end process; mux D Q DFF DGATE CLK For clock gating, use another signal for FF clock input مرتضي صاحب الزماني

Register Inference One-digit BCD counter Library IEEE; use IEEE.Std_Logic_1164.all;    entity COUNTER is port ( CLK    : in std_ulogic;            Q    : out integer  range 0 to 15 ); end COUNTER;    architecture A of COUNTER is   signal COUNT  : integer  range 0 to 15 ; begin    process (CLK)    begin       if CLK`event and CLK = `1` then          if (COUNT >= 9) then             COUNT <= 0;          else             COUNT <= COUNT +1;          end if;       end if;    end process;     Q <= COUNT; end A; One-digit BCD counter For all signals which receive an assignment in clocked processes, memory is synthesized. COUNT: 4 FF (constrained integer) Q not used in clocked process. Problem: doesn’t have power-on reset مرتضي صاحب الزماني

Asynchronous Set/Reset Library IEEE; use IEEE.Std_Logic_1164.all;    entity ASYNC_FF is port (    D, CLK, SET, RST : in std_ulogic;             Q                            : out std_ulogic); end ASYNC_FF;    architecture A of ASYNC_FF is begin     process  (CLK, RST, SET)     begin        if (RST = `1`) then           Q <= `0`;        elsif SET ='1' then           Q <= '1';        elsif (CLK`event and CLK = `1`) then           Q <= D;        end if;     end process; end A; if/elsif - structure The last elsif has an edge No else براي set/reset سنكرون فقط clk در ليست حساسيت قرار مي گيرد (مي توان با wait until هم مدلسازي كرد). اما براي آسنكرون فقط با ليست حساسيت مي توان مدلسازي كرد حتماً همة وروديهاي آسنكرون در ليست حساسيت وارد شوند والا نتيجة شبيه سازي با سنتز متفاوت مي شود. مرتضي صاحب الزماني

Summary: Clocked Processes process begin     wait until CLK'event and CLK='1';     if RESET = '1' then   -- synchron RESET     -- Register reset   else      -- combinational   end if; end process; Wait-form: no sensitivity list process(CLK, RST) begin   if (RST = `1`) then    -- asynchron RESET     -- Register reset   elsif (CLK`event and CLK=`1`) then     -- combinatorics   end if; end process; If-form: Only Clock and Reset  in sensitivity list (and all the other asynchronous signals) Registers for all driven signals All registers should be resetable مرتضي صاحب الزماني

Combinational Logic مرتضي صاحب الزماني

Feedback Loops architecture EXAMPLE of FEEDBACK is    signal B,X : integer range 0 to 99; begin    process (X, B)    begin       X <= X + B;    end process;   . . . end EXAMPLE; Do not create combinational feedback loops! افزايش X تا out-of-range error (حتي قبل از آنكه پا را فراتر از 0 ns بگذارد). سنتز كننده ها معمولاً سنتز مي كنند اما اين سخت افزار قابل استفاده نيست. مرتضي صاحب الزماني

Coding Style Influence EXAMPLE1: process (SEL,A,B) begin    if SEL = `1` then       Z <= A + B;    else       Z <= A + C;    end if; end process EXAMPLE1; Direct implementation Manual resource sharing EXAMPLE2: process (SEL,A,B)     variable  TMP : bit; begin    if SEL = `1` then        TMP  := B;    else        TMP  := C;    end if;    Z <= A + TMP; end process EXAMPLE2; فقط يك جمع كننده نياز دارد. اگر SEL ديرتر مي رسد مدار بالايي سريعتر عمل مي كند. مرتضي صاحب الزماني

Source Code Optimization An operation can be described very efficiently for synthesis, e.g.: Some optimization tools automatically change the description according to the given constraints. مرتضي صاحب الزماني

Source Code Optimization If one of the inputs arrives later than others, it can be chosen for IN2 in the left implementation. If power is a consideration, IN6 could be used for the signal that changes more frequently in the left implementation since it passes through only one adder. (?) مرتضي صاحب الزماني

Example: Multiplier 2 x 2 bit multiplier inputs: A1, A0, B1, B0 : 2 bit outputs: C3, C2, C1, C0 : 4 bit   One entity for 3 different VHDL implementations Function table Synthesis "by hand" (boolean functions for the outputs) Use of VHDL integer types and operators entity MULTIPLIER is    port (          A0 : in  bit;          A1 : in  bit;          B0 : in  bit;          B1 : in  bit;          C0 : out bit;          C1 : out bit;          C2 : out bit;          C3 : out bit); end MULTIPLIER; مرتضي صاحب الزماني

Multiplier Function Table 1 مرتضي صاحب الزماني

VHDL Using Function Table architecture RTL_TABLE of MULTIPLIER is    signal A_B : bit_vector (3 downto 0); begin    A_B <=  A1 & A0 & B1 & B0;     MULTIPLY : process (A_B)    begin       case A_B is             when "0000" => (C3,C2,C1,C0) <=  "0000";             when "0001" => (C3,C2,C1,C0) <=  "0000";             when "0010" => (C3,C2,C1,C0) <=  "0000";             when "0011" => (C3,C2,C1,C0) <=  "0000";             when "0100" => (C3,C2,C1,C0) <=  "0000";             when "0101" => (C3,C2,C1,C0) <=  "0001";             when "0110" => (C3,C2,C1,C0) <=  "0010";             when "0111" => (C3,C2,C1,C0) <=  "0011";             . . .             when "1100" => (C3,C2,C1,C0) <=  "0000";             when "1101" => (C3,C2,C1,C0) <=  "0011";             when "1110" => (C3,C2,C1,C0) <=  "0110";             when "1111" => (C3,C2,C1,C0) <=  "1001";       end case;    end process MULTIPLY; end RTL_TABLE; همة حالات پوشش داده شده اند  از case-when استفاده مي كنيم. An internal signal is used that combines all input signals The internal signal is generated concurrently, i.e. it is updated whenever the input changes The function table is realized as case statement and thus has to be placed within a process. مرتضي صاحب الزماني

Multiplier Minterms -- Karnaugh Diagram مرتضي صاحب الزماني

VHDL Using Minterm Functions architecture RTL_MINTERM of MULTIPLIER is begin      C0 <= A0 and B0;      C1 <= (A0 and not A1 and B1) or                   (A0 and not B0 and B1) or                   (not A0 and A1 and B0) or                   (A1 and B0 and not B1);      C2 <= (A1 and B1 and not B0) or                    (A1 and not A0 and B1);      C3 <= A1 and A0 and B1 and B0; end RTL_MINTERM; The minterm functions are realized directly as concurrent statements. توصيف بر اساس مينترمها مشكل است. ازطرفي سنتز كننده ها خود مي توانند اين مينترمها را مستقيماً از جدول به دست آورند. مرتضي صاحب الزماني

Multiplier: Integer Realization The NUMERIC_BIT package provides all necessary functions to convert bit vectors to integer values and vice versa The multiplication is realized via the standard VHDL operator The size of the target vector must be specified when converting integers back to bit vectors library IEEE; use IEEE.NUMERIC_BIT.all; architecture RTL_INTEGER of MULTIPLIER is      signal A_VEC, B_VEC: unsigned(1 downto 0);      signal A_INT, B_INT:     integer range 0 to 3;      signal C_VEC: unsigned (3 downto 0);      signal C_INT:   integer range 0 to 9; begin      A_VEC <= A1 & A0;      A_INT <= TO_INTEGER(A_VEC);      B_VEC <= B1 & B0;      B_INT <= TO_INTEGER(B_VEC);      C_INT <= A_INT * B_INT;      C_VEC <= TO_UNSIGNED(C_INT, 4);      (C3, C2, C1, C0) <= C_VEC; end RTL_INTEGER; مرتضي صاحب الزماني

Multiplier (Conclusion) بهترين حالت: توصيف بر اساس عملگر * و عملوندهاي integer است: كد خيلي گوياست و لابلاي توابع بولين يا جدول درستي پنهان نيست. براي پورتها بهتر است به جاي bit از unsigned يا integer استفاده كنيد  نيازي به تبديل type هم نيست چون * براي unsigned overload شده. اما اگر نيازمندي هاي طراحي برآورده نشده باشد، بهترين راه دخالت طراح در جزئيات طراحي است. نتيجة سنتز اين سه حالت (جدول، عبارات بولين و کد RTL) چندان تفاوتي با هم ندارند. مرتضي صاحب الزماني

Example: Adder entity ADD is    port (A, B  : in integer range 0 to 7;            Z       : out integer range 0 to 15); end ADD; architecture ARITHMETIC of ADD is begin     Z <= A + B; end ARITHMETIC; Notice: Advantages of a range declaration with integer types:    a) During simulation: check for "out of range..."    b) During synthesis: only 4 bit bus width مرتضي صاحب الزماني

IF Structure <-> CASE Structure Different descriptions may be synthesized differently · · · case IN is    when 0 to 16 =>           OUT <= B ;    when 17 =>           OUT <= C ;    when others =>           OUT <= A ; end case ; · · · · · · if (IN > 17) then     OUT <= A ; elsif (IN < 17) then    OUT <= B ; else    OUT <=  C ; end if ; · · · سنتزكننده ها ممكن است optimize كنند. مرتضي صاحب الزماني

Implementation of a Data Bus architecture RTL1 of TRISTATE is begin    process (DATA1, EN1)    begin          if EN1 = '1' then             DATA_BUS <= DATA1;          else             DATA_BUS <= 'Z';          end if;    end process;    process (DATA2, EN2)    begin          if EN2 = '1' then             DATA_BUS <= DATA2;          else             DATA_BUS <= 'Z';          end if;    end process; end RTL1; architecture RTL2 of TRISTATE is begin    DATA_BUS <= DATA1 when EN1 = '1' else 'Z';    DATA_BUS <= DATA2 when EN2 = '1' else 'Z'; end RTL2; entity TRISTATE is    port(DATA1, DATA2 : in   std_ulogic;           EN1, EN2         : in   std_ulogic;           DATA_BUS       : out std_logic ); end TRISTATE; مرتضي صاحب الزماني

Problems with Internal Bus Structures Bus with tristate drivers Different propagation delays: ممكن است غيرفعال كردن اولي بيشتر از فعال كردن دومي طول بكشد. A bus controller has to guarantee that at most one driver is active on the bus. ممكن است IC بسوزد. حتي اگر الآن درست كار كند در انتقال به تكنولوژي ديگر ممكن است اشكال پيدا كند. مرتضي صاحب الزماني

Portable and Safe Bus Structure Multiplexer instead of tristate driver guarantees one driver per signal. Bidirectional I/O pad Benefit Safe circuit Portable مرتضي صاحب الزماني

Variables in Clocked Processes Registers are generated for all variables that might be read before they are updated VAR_1: process(CLK)    variable TEMP : integer; begin        if (CLK'event and CLK = '1') then       TEMP := INPUT * 2;       OUTPUT_A <= TEMP + 1;       OUTPUT_B <= TEMP + 2;    end if; end process VAR_1; VAR_2: process(CLK)    variable TEMP : integer; begin        if (CLK'event and CLK = '1') then       OUTPUT <= TEMP + 1;       TEMP := INPUT * 2;    end if; end process VAR_2; How many registers are generated? مرتضي صاحب الزماني

ELSE for Clock Checking   ELSE for Clock Checking در بيشتر سنتز كننده ها اگر براي آشكارسازي كلاك, else به كار برده باشيم انجام نمي دهند (نمي دانند چطور بايد آن را سنتز كرد). process(CLK) begin   if (CLK`event and CLK=`1`) then     Q <= D; else Q <= A;   end if; end process; مرتضي صاحب الزماني

Don’t Care   در سنتز كننده ها مقايسه با ‘-’ در شرطها عموماً نتيجة FALSE مي دهد (هيچگاه مقدار سيگنال = ‘-’ نمي شود): when (a = “1---”) …. اگر مثلاً a = “1000” شود شرط TRUE نمي شود. براي اين منظور مي توان از stdmatch(s1, s2) (در پکيج numeric_std) استفاده كرد: when (std_match(a, “1---”)) …. همة حالات ‘-’ را آزمايش مي كند. راه بهتر (portable) : توصیف دقیق: when (a(3) = ‘1’) …. مرتضي صاحب الزماني