Pobieranie prezentacji. Proszę czekać

Pobieranie prezentacji. Proszę czekać

VHDL Ernest Jamro, Paweł Russek C3 p. 504

Podobne prezentacje


Prezentacja na temat: "VHDL Ernest Jamro, Paweł Russek C3 p. 504"— Zapis prezentacji:

1 VHDL Ernest Jamro, Paweł Russek C3 p. 504 jamro@agh.edu.pl russek@agh.edu.pl www.fpga.agh.edu.pl jamro@agh.edu.pl russek@agh.edu.pl

2

3 Potrzeba narzędzia: 1970 - INTEL 4004 4 projektantów 1 tys. tranzystorów 1982 - INTEL 80286 20 projektantów 100 tys. tranzystorów 1992 - INTEL PENTIUM 100 projektantów 3 mln tranzystorów 2008 1000 projektantów 150 mln tranzystorów 200??? ???? projektantów ???? mln tranzystorów Współczesne wymagania: hardware-software codesign !!! Języki Opisu Sprzętu – po co? E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

4 Języki Opisu Sprzętu – po co? E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

5 VHDL – co to jest? Definicja VHDL - V HSIC H ardware D escription L anguage V ery H igh S peed I ntegrated C ircuit It is "a formal notation intended for use in all phases of the creation of electronic systems.... it supports the development, verification, synthesis, and testing of hardware designs, the communication of hardware design data..." [IEEE Standard VHDL Language Reference Manual] E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

6 VHDL – jak, gdzie, kiedy? Zakres stosowania Modelowanie A=”01” ? A(1..0) Z Z <= ’1’ when A = ”01” else ’0’; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

7 VHDL – jak, gdzie, kiedy? Zakres stosowania Symulacja A(1) A(0) Z E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

8 VHDL – jak, gdzie, kiedy? Zakres stosowania Synteza (automatyczna) translacja opisu w języku HDL na strukturę w postaci listy połączeń elementarnych bloków funkcyjnych docelowej platformy sprzętowej (bramek, przerzutników, pamięci i innych) A(0) A(1) Z E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

9 entity name architecture style of name VHDL – jak, gdzie, kiedy? Jednostki projektowe entity COMPARE is port (A,B: in bit; C: out bit); end COMPARE; architecture BEHAVIORAL of COMPARE is begin C <=‘1’ when A=B else ‘0’; end behavioral; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

10 VHDL – przykłady Dekoder entity DECODER is port(D: in bit_vector (0 downto 3); ZERO: out bit; ONE: out bit; EIGHT: out bit; NINE: out bit); end DECODER; architecture FIRST of DECODER is begin NINE <= '1' when D="1001" else '0'; EIGHT <= '1' when D="1000" else '0'; ONE <= '1' when D="0001" else '0'; ZERO <= '1' when D="0001" else '0'; end FIRST; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

11 VHDL – przykłady Komparator entity COMPARE is port(A,B: in bit_vector (0 to 7); EQL: out bit_vector (0 to 7)); end COMPARE; architecture SECOND of COMPARE is begin EQL <= not (A xor B); end SECOND; Gdzie na tym schemacie jest błąd? E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

12 Multiplekser Mux 2:1 Mux 4:1

13 Multiplekser 2:1 na bramkach Sel\In1, In000011110 00110 10011 Out= Sel  In0 + Sel  In1 Y <= (not Sel and In0) or (Sel and In1); --VHDL

14 Multiplekser na bramkach – postać ogólna Mux 4:1 VHDL Seli <= conv_integer(Sel); Y <= X(Seli); -- Out i In słowa kluczowe

15 VHDL – przykłady Multiplekser entity MPLEXER is port(D: in std_logic_vector (7 downto 0); A: in std_logic_vector (2 downto 0); X: out std_logic); end MPLEXER; architecture MYARCH of MPLEXER is signal Ai: integer range 7 downto 0; begin Ai <= conv_integer(A); X <= D(Ai); end MYARCH; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

16 Multiplekser na buforach trójstanowych Aby uniknąć krótkotrwałego zwierania buforów stosuje się krótki czas martwy w którym wszystkie bufory są w stanie wysokiej impedancji. Wymaga to użycia automatu zamiast prostego dekodera kodu binarnego na 1 z n. VHDL (wewnątrz FPGA): Ch(1)<= In1 when Tn(1)=‘1’ else ‘Z’; Ch(2)<= In2 when Tn(2)=‘1’ else ‘Z’; VHDL (testbench): Y<= ch(1); Y<= ch(2);

17 Przykład: package STANDARD -- This is Package STANDARD as defined in the VHDL 1992 Language Reference Manual. package standard is type boolean is (false,true); type bit is ('0', '1'); type character is ( nul, soh, stx, etx, eot, enq, ack, bel, bs, ht, lf, vt, ff, cr, so, si, dle, dc1, dc2, dc3, dc4, nak, syn, etb,................ 'đ', 'ń', 'ň', 'ó', 'ô', 'ő', 'ö', '÷', 'ř', 'ů', 'ú', 'ű', 'ü', 'ý', 'ţ', '˙' ); type severity_level is (note, warning, error, failure); type integer is range -2147483647 to 2147483647; type real is range -1.0E308 to 1.0E308; type time is range -2147483647 to 2147483647 units fs; ps = 1000 fs; ns = 1000 ps; us = 1000 ns; ms = 1000 us; sec = 1000 ms; min = 60 sec; hr = 60 min; end units; subtype delay_length is time range 0 fs to time'high; impure function now return delay_length; subtype natural is integer range 0 to integer'high; subtype positive is integer range 1 to integer'high; type string is array (positive range <>) of character; type bit_vector is array (natural range <>) of bit; type file_open_kind is ( read_mode, write_mode, append_mode); type file_open_status is ( open_ok, status_error, name_error, mode_error); attribute foreign : string; end standard;

18 Pojęcia leksykalne - literały Literały pojedyncze (skalary) character - pojedynczy znak objęty apostrofami, np: ‘A’ lub ‘a’ bit - reprezentuje wartość binarną ‘1’ lub ‘0’ std_logic - reprezentuje wartość sygnałów wg. IEEE 1164: U niezainicjalizowany X nieznany (forcing an unknown) 0 silne zero (forcing 0) 1 silne jeden (forcing 1) Z wysoka impedancja W słaby nieznany (weak unknown) L słabe zero (weak 0) H słabe jeden (weak 1) - nieistotny (don’t care) Poza pakietem STANDARD Należy dodać przed entity: library IEEE; use IEEE.STD_LOGIC_1164.all; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

19 Biblioteka std_logic.vhd ----------------------------------------------------------------- -- resolution function ----------------------------------------------------------------- CONSTANT resolution_table : stdlogic_table := ( -- --------------------------------------------------------- -- | U X 0 1 Z W L H - | | -- --------------------------------------------------------- ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X | ( 'U', 'X', '0', 'X', '0', '0', '0', '0', 'X' ), -- | 0 | ( 'U', 'X', 'X', '1', '1', '1', '1', '1', 'X' ), -- | 1 | ( 'U', 'X', '0', '1', 'Z', 'W', 'L', 'H', 'X' ), -- | Z | ( 'U', 'X', '0', '1', 'W', 'W', 'W', 'W', 'X' ), -- | W | ( 'U', 'X', '0', '1', 'L', 'W', 'L', 'W', 'X' ), -- | L | ( 'U', 'X', '0', '1', 'H', 'W', 'W', 'H', 'X' ), -- | H | ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ) -- | - | ); E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

20 Pojęcia leksykalne – wyrażenia Operatory wyrażeń: logiczne andornandnorxornot relacji =/= >= połączenia & arytmetyczne +-*/ ** modremabs VHDL’92 sllsrlslasrarolrorxnor Typy argumentów: takie same: and or nand nor xor not = /= >= + - * / integer: mod rem integer exp: ** numeryczny: abs E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

21 VHDL – przykłady Sumator library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_UNSIGNED.all; entity SUM is port(A,B: in std_logic_vector (2 downto 0); Cin: in std_logic; S: out std_logic_vector (2 downto 0); Cout: out std_logic); end SUM; architecture FOURTH of SUM is signal V: std_logic_vector (3 downto 0); begin V <= A + B + Cin; S <= V(2 downto 2); Cout <= V(3); end FOURTH; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

22 Process Składnia: [etykieta : ] process [ ( lista sygnałów aktywujących ) ] [ is ] [podprogram] [typ] [stała] [zmienna] [inne deklaracje] begin instrukcje sekwencyjne end process [etykieta] ; Instrukcja przypisania wartości dla zmiennych zmienna := wyrażenie ; Instrukcja przypisania wartości dla sygnałów sygnał <= wyrażenie [ after delay] ; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

23 Process / brak process Powielanie logiki entity loop_stmt is port (a: bit_vector (3 downto 0); m: out bit_vector (3 downto 0)); end loop_stmt; architecture example1 of loop_stmt is signal b: bit_vector(3 downto 0); begin b(0)<= a(0); label: for i in 1 to 3 generate b(i)<= b(i-1) and a(3-i); end generate; m<= b; end example1; architecture example2 of loop_stmt is begin process (a) variable b: bit; begin b := '1'; for i in 0 to 3 loop b := a(3-i) and b; m(i) <= b; end loop; end process; end example2;

24 Alternatywne rozwiązanie Multiplekser Mux_out<= A when sel = "00" else B when sel = "01" else C when sel = "10" else '-'; LUB with sel select Mux_out <= A when "00", B when "01", C when "10", '-' when others; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

25 Transkoder kodu hex na siedmiosegmentowy with HEX select LED<= "1111001" when "0001", --1 "0100100" when "0010", --2 "0110000" when "0011", --3 "0011001" when "0100", --4 "0010010" when "0101", --5 "0000010" when "0110", --6 "1111000" when "0111", --7 "0000000" when "1000", --8 "0010000" when "1001", --9 "0001000" when "1010", --A "0000011" when "1011", --b "1000110" when "1100", --C "0100001" when "1101", --d "0000110" when "1110", --E "0001110" when "1111", --F "1000000" when others; --0

26 Przerzutnik typu D process (CLK) begin if (CLK'event and CLK='1') then if reset=‘1’ then -- reset synchroniczny DOUT <= '0'; else DOUT <= DIN; end if; end process ; process (CLK, RESET) begin if RESET='1' then – reset asynchroniczny DOUT <= '0'; elsif (CLK'event and CLK='1') then DOUT <= DIN; end if; end process ;

27 Przerzutnik typu D z multiplekserem i Clock Enable (CE) process (CLK) begin if (CLK'event and CLK='1') then if ce= ‘1’ then if sel=‘0’ then DOUT <= DIN0; else DOUT <= DIN1; end if ; -- sel end if ; -- ce end if ; -- clk end process; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

28 sensivity list Pytanie: Jaka jest różnica w zachowaniu się dwóch poniższych procesów ? Odpowiedź: Lewy:Symulacja jednokrotna. Użycie poprzednich wartości S i T dla obliczenia wartości V. Prawy:Symulacja dwukrotna. Uaktualni wartości S i T dla obliczenia wartości V w dwóch cyklach delta. process (A, B)– częsty błąd begin S <= A; T <= B; V <= S or T; end process; process (A, B, S, T) begin S <= A; T <= B; V <= S or T; end process; E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

29 SIPO (Serial-In Parallel-Out) (Deserializer) process(clk) begin if clk'event and clk=‘1' then Q(N-1 downto 0)<= Q(N-2 downto 0) & Din; end if; end process;

30 Parallel-In Serial-Out (PISO) – Serializer

31 PISO - VHDL process(clk) begin if clk'event and clk1=‘1' then if load=‘1’ then Q <= D; else Q(N-1 downto 0)<= Q(N-2 downto 0) & Din; end if; end process; Qout<= Q(N-1);

32 Przesyłanie danych szeregowo SerDeser PISO Clk SIPO D clk takt Sposób 1 Sposób 2

33 Incrementator (S=A+1) c i-1 \a i 01 001 110 01 000 101 SiSi CiCi s i = a i  c i-1 c i = a i c i-1 HA Half Adder

34 Incrementator: Example A=1011 2 = 11 10 =0xB S=A+1= 1100 2 =12 10 =0xC

35 Dodawanie z szeregową propagacją przeniesienia (Ripple Carry) Adder: S= A+B c i-1 \a i,b i 00011110 00101 11010 c i-1 \a i,b i 00011110 00010 10111 sisi cici a i + b i +c i-1 = s i + 2·c i s i = a i  b i  c i-1 c i = a i b i + a i c i-1 + b i c i-1 = a i b i + c i-1 (a i  b i ) Propagate Generate

36 Odejmowanie / Subtraction (a-b) c i-1 \a i,b i 00011110 00101 11010 c i-1 \a i,b i 00011110 00100 11110 sisi cici a i - b i -c i-1 = s i - 2·c i s i = a i  b i  c i-1 Red color – difference between addition and subtraction Two’s Complement (2C) Sign bitnegation Direct Add 1 to the LSB (Least Significant Bit) Instead of employing dedicated subtraction we can use a standard adder convert B to 2C code Example: 1111 in 2C= 0000+1= 0001 (minus one)

37 Add/Subtract Logic Convert B to Two’s Complement when Sub=1 S<= A+B when Sub=‘0’ else A-B;

38 Counter mod 2 N Q n+1 = Q n +1 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter_2N is port(clk, reset_asynch: in std_logic; count : out std_logic_vector (3 downto 0)); end counter_2N; architecture Beh of counter_2N is signal Q: std_logic_vector(3 downto 0):= "0000"; begin process(clk, reset_asynch) begin if reset_asynch=‘1’ then Q ’0’); elsif clk’event and clk=‘1’ then Q<= Q + 1; end if; end process; Count<= Q end Beh;

39 Counter mod N architecture Beh of counter_N is signal Q: std_logic_vector(3 downto 0):= "0000"; begin process(clk) begin if clk’event and clk=‘1’ then if reset_synch=‘1’ or Q=N-1 then Q ’0’); else Q<= Q + 1; end if; -- not reset end if; -- clk end process; end Beh;

40 Up/Down Counter mod 2 N architecture Beh of counter_up_down is signal Q: std_logic_vector(3 downto 0); begin process(clk) begin if clk’event and clk=‘1’ then if Up_DownN=‘1’ then Q<= Q + 1; else Q<= Q - 1; end if; -- up / downN end if; -- clk end process; Count <= Q; end Beh;

41 Up/Down Counter mod N process(clk) begin if clk’event and clk=‘1’ then if Up_DownN=‘1’ then if Q = N-1 then Q ’0’) else Q<= Q + 1; end if; else -- counting down if Q = 0 then Q<= conv_std_logic_vector(N-1, vec_width); else Q<= Q - 1; end if; end if; -- up / downN end if; -- clk end process;

42 Rejestr przesuwny w prawo i w lewo z wpisem równoległym S= 0- przesuń w prawo S=1- przesuń w lewo S=2- wpis równoległy S=3- wpis równoległy process(clk) begin if clk’event and clk=‘1’ then if S(1)= ‘1’ then -- load Q<= D; elsif S(0)= ‘0’ then – shift right Q<= Dleft & Q(3 downto 1); else -- shift left Q<= Q(2 downto 0) & Drigth; end if; end if; end process;

43 Automat Moore’a --Insert the following in the architecture before the begin keyword --Use descriptive names for the states, like st1_reset, st2_search type state_type is (st1_, st2_,...); signal state, next_state : state_type; --Declare internal signals for all outputs of the state-machine signal _i : std_logic; -- example output signal --other outputs --Insert the following in the architecture after the begin keyword SYNC_PROC: process ( ) begin if ( 'event and = '1') then if ( = '1') then state ; <= '0'; else state <= next_state; _i; -- assign other outputs to internal signals end if; end process;

44 Automat Mealy’ego MEALY State-Machine - Outputs based on state and inputs OUTPUT_DECODE: process (state,,,...) begin --insert statements to decode internal output signals --below is simple example if (state = st3_ and = '1') then _i <= '1'; else _i <= '0'; end if; end process; NEXT_STATE_DECODE: process (state,,,...) begin --declare default state for next_state to avoid latches next_state <= state; --default is to stay in current state --insert statements to decode next_state --below is a simple example case (state) is when st1_ => if = '1' then next_state ; end if; when st2_ => if = '1' then next_state ; end if; when st3_ => next_state ; when others => next_state ; end case; end process;

45 Styl projektowania Modelowa struktura projektu: Jeden sygnał zegarowy Wszystkie przerzutniki wyzwalane tym samym zboczem Problemy przy dwóch aktywnych zboczach: Zależność od współczynnika wypełnienia (tolerancja na zmiany duty cycle w dokumentacji projektu!) Problemy z metodą testowania typu ścieżka brzegowa (JTAG 1149) CLK E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

46 Styl projektowania Asynchroniczne kluczowanie zegara - same problemy! (niewykorzystanie zasobów dystrybucji sygnałów zegarowych, problemy z testowaniem, gorsze parametry czasowe itp.) Rozwiązanie – stosowanie wejść CE – kodowanie przez warunek: if ce=‘1’ po sekwencji if clk’event and clk=‘1’. CLK E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

47 Styl projektowania CLK Nie należy stosować wewnętrznie (asynchronicznie!) generowanych sygnałów zegarowych. Należy natomiast projektować układy synchroniczne lub używać kilku sygnałów zegarowych (patrz: DLL). CLK CE E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

48 Deklaracja sygnałów w entity W deklaracji sygnału jako portu dla entity należy wyszczególnić: nazwę sygnału, jego kierunek, typ i opcjonalnie jego wartość początkową. Składnia: port ( names : direction type [ := expression] [ ; more_ports] ); Przykład: port (DATA_IN: in bit:= ‘0’; DATA_OUT: out bit); port (B, A: in std_logic_vector);

49 Deklaracja sygnałów w VHDL Pytanie: Jaki jest najprawdopodobniej kierunek sygnału DATA_OUT ? Odpowiedź: buffer Ze względu na to że buffer propaguje do nadrzędnych modułów nie zaleca się go używać. Lepiej jest użyć wewnętrznego dodatkowego sygnału. MUXMUX logika DATA_IN SELECT DATA_OUT

50 Generic library IEEE; use IEEE.STD_LOGIC_1164.all; entity MY_ADDER generic (width: integer; operacja: integer); port ( a, b: in std_logic_vector(width-1 downto 0); s: out std_logic_vector(width-1 downto 0)); end MY_ADDER; architecture arch of MY_ADDER is gplus: if operacja = 0 generate s<= a + b; end generate; gminus: if operacja=1 generate s<= a-b; end generate; end arch;

51 Dodawanie bibliotek library ieee; use ieee.std_logic_1164.all; -- użycie std_logic use ieee.std_logic_unsigned.all; -- każda wartość std_logic_vector jest traktowana jako integer bez znaku use ieee.std_logic_signed.all; -- każda wartość std_logic_vector jest traktowana jako integer ze znaku Nie można równocześnie użyć obu bibliotek: std_logic_unsigned oraz std_logic_signed. W tym wypadku należy użyć biblioteki: use ieee.std_logic_arith.all; oraz zamiast słowa kluczowego std_logic_vector należy użyć słów unsigned lub signed (wada: konieczność używania konwersji std_logic_vector  unsigned (lub signed))

52 Umiejscawianie komponentów entity FULL_ADDER is port ( a, b, cin: in std_logic; s, cout: out std_logic); end FULL_ADDER; architecture arch of FULL_ADDER is begin s<= a xor b xor c; cout<= a when a=b else cin; end arch; entity MY_ADDER is generic (width: integer); port ( a, b: in std_logic_vector(width-1 downto 0); s: out std_logic_vector(width-1downto 0); end MY_ADDER; architecture arch of MY_ADDER is component FULL_ADDER -- deklaracja komponentu port ( a, b, cin: in std_logic; s, cout: out std_logic); end component; signal carry: std_logic_vector(0 to dwidth); begin carry(0)<= ‘0’; gi: for i in 0 to width-1 generate fa: full_adder Port map (a=> a(i), b=>b(i), cin=> carry(i), s=> s(i), cout=> carry(i+1)); end generate; end arch;

53 Przykład pamięci ROM w VHDL library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity rom is port ( ADDR : in std_logic_vector(5 downto 0); DATA : out std_logic_vector(19 downto 0)); end rom; architecture syn of rom is type rom_type is array (63 downto 0) of std_logic_vector (19 downto 0); signal ROM : rom_type:= (X"0200A", X"00300", X"08101", X"04000", X"08601", X"0233A", X"00300", X"08602", X"02310", X"0203B", X"08300", X"04002", X"08201", X"00500", X"04001", X"02500", X"00340", X"00241", X"04002", X"08300", X"08201", X"00500", X"08101", X"00602", X"04003", X"0241E", X"00301", X"00102", X"02122", X"02021", X"00301", X"00102", X"02222", X"04001", X"00342", X"0232B", X"00900", X"00302", X"00102", X"04002", X"00900", X"08201", X"02023", X"00303", X"02433", X"00301", X"04004", X"00301", X"00102", X"02137", X"02036", X"00301", X"00102", X"02237", X"04004", X"00304", X"04040", X"02500", X"02500", X"02500", X"0030D", X"02341", X"08201", X"0400D"); begin data <= ROM(conv_integer(ADDR)); end syn;

54 RAM: Synch. zapis / asynch. odczyt process ( ) begin if ( 'event and = '1') then if ( = '1') then (conv_integer( )) ; end if; end process; (conv_integer( ));

55 First-In First-Out (FIFO) Wejście: A, B, -,C, -, D, E Wyjście: -, A, -, B, -, -, C, -, D, E empty full

56 TESTBENCH – połączenie Process/Component Rodzaje procesów testujących Ad Hoc Zbiór wektorów testowych do podstawowych testów funkcjonalnych. Algorytmiczny Prosty algorytm generujący wymuszenia, np. pętla zwiększająca zmienną przez cały jej zakres do testowania dekodera lub ALU. Plik wektorów Rozwiązanie strukturalne: proces czytający plik z wektorami do testowania. ProcessComponent Signals UUTTestBench E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

57 Przykład symulacji entity my_adder_tb is end my_adder_tb; Architecture sim of my_adder_tb is component my_adder........ end component; constant width: integer:= 4; signal a, b, s: std_logic_vector(width-1 downto 0):= (others=>’0’); -- to działa tylko dla symulacji signal error: bit; -- sygnalizuje błąd podczas obliczeń begin UUT: my_adder -- testowany moduł port map(a=> a, b=>b, s=>s); wymus: process begin -- generacja wszystkich możliwych wektorów wejściowych a, b wait for 10ns; a<= a + 1; if a="1111” then b<= b+1; end if; end process; error<= ‘1’ when a+b/=s else ‘0’; end sim;

58 Metody wymuszania stanów sygnałów process begin wait for 5ns; clk<= not clk; end process; CE<= ‘1’; first<= '0', '1' after 201ns, '0' after 211ns; process begin a<= ‘0’; b<= ‘0’; wait for 10ns; a<= ‘1’; wait for 50ns; a<=‘0’; b<= ‘1’; wait; -- czekaj w nieskończoność end process;

59 VHDL – literatura „A Guide to VHDL”, S. Mazor, P. Langstraat „VHDL Analysis and Modelling of Digital Systems”, Z. Navabi „VHDL Hardware Description and Design”, R. Lipsett, C. Schaefer, C. Ussery „The VHDL Cookbook”, P. J. Ashenden „VHDL programming: with advanced topics”, L. Baker „VHDL starter's guide”, S. Yalamanchili „VHDL for designers”, S. Sjoholm, L. Lindh „VHDL made easy!”, D. Pellerin, D. Taylor „VHDL answers to frequently asked questions”, B. Cohen „VHDL and AHDL digital systems implementation”, F. A. Scarpino „VHDL: język opisu i projektowania układów cyfrowych”, W. Wrona „Active-VHDL Series BOOK#2 – EVITA Interactive Tutorial”, J. Mirkowski, M. Kapustka, Z. Skowroński, A. Biniszkiewicz „VHDL: a logic synthesis approach”, D. Naylor, S. Jones E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

60 VHDL – literatura Marek ZwolińskiWłodzimierz Wrona Kevin Skahill Józef Kalisz E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

61 VHDL – zasoby w Internecie http://fpga.elektro.agh.edu.pl VHDL: http://www.vhdl.org/http://www.vhdl.org/ Grupa dyskusyjna: comp.lang.vhdl (FAQ - 4części) Accellera: http://www.accellera.org/http://www.accellera.org/ EDA Industry Working Groups homepage: http://www.eda.org/http://www.eda.org/ FPGA Journal http://www.fpgajournal.com/ - (ładne lekcje ChalkTalk )http://www.fpgajournal.com/ Design Automation Cafe: http://www.dacafe.com/http://www.dacafe.com/ Doulos High Level Design Web site: http://www.doulos.com/http://www.doulos.com/ VHDL-online, University of Erlangen-Nürnberg: http://www.vhdl-online.de/http://www.vhdl-online.de/ VHDL info pages of the Microelectronics Department (University of Ulm, Germany): http://mikro.e-technik.uni-ulm.de/vhdl/vhdl_infos.htmlhttp://mikro.e-technik.uni-ulm.de/vhdl/vhdl_infos.html E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

62 VHDL – tutoriale Evita Interactive VHDL Tutorial from Aldec, Inc.: http://www.aldec.com Doulos High Level Design Web site; A Hardware Engineers Guide to VHDL: http://www.doulos.com/hegv/index.htm http://www.doulos.com/hegv/index.htm An Introductory VHDL Tutorial, Green Mountain Computing Systems: http://www.gmvhdl.com/VHDL.html http://www.gmvhdl.com/VHDL.html VHDL Tutorial by Ulrich Heinkel, Thomas Bürner and Martin Padeffke (in English and German): http://www.vhdl-online.de/~vhdl/TUTORIAL/http://www.vhdl-online.de/~vhdl/TUTORIAL/ VHDL-FSM-Tutorial by Martin Padeffke: http://www.vhdl-online.de/FSM/http://www.vhdl-online.de/FSM/ VHDL Verification Course by Stefan Doll: http://www.stefanVHDL.com/http://www.stefanVHDL.com/ E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków

63 VHDL – free IP cores OpenIP home page: http://www.opencores.orghttp://www.opencores.org System On Chip http://www.soccentral.com/http://www.soccentral.com/ Free behavioral models from Alatek: http://www.alatek.com/http://www.alatek.com/ The Hamburg VHDL archive: http://tams-www.informatik.uni-hamburg.de/research/vlsi/vhdl/ http://tams-www.informatik.uni-hamburg.de/research/vlsi/vhdl/ Rapid Prototyping of Application Specific Signal Processors (RASSP) www site: http://www.eda.org/rassp/http://www.eda.org/rassp/ Doulos High Level Design Web site; Monthly-updated Original Models (developed by Doulos): http://www.doulos.com/fi/http://www.doulos.com/fi/ A VHDL synthesizable model for the MICROCHIP PIC 16C5X microcontroller by Tom Coonan: http://www.mindspring.com/~tcoonan/http://www.mindspring.com/~tcoonan/ VHDL Library of Arithmetic Units developed by R. Zimmermann: http://www.iis.ee.ethz.ch/~zimmi/arith_lib.html http://www.iis.ee.ethz.ch/~zimmi/arith_lib.html E. Jamro, J.Kasperek, P.J.Rajda © 2009 Katedra Elektroniki AGH Kraków


Pobierz ppt "VHDL Ernest Jamro, Paweł Russek C3 p. 504"

Podobne prezentacje


Reklamy Google