1 / 24

Riistvara kirjelduskeel VHDL

Riistvara kirjelduskeel VHDL. L4, L5. Riistvara kirjelduskeel VHDL L6. Mäluga süsteemid VHDL-s L7. VHDL ja süntees. Modelleerimine. J.F. Wakerly “Digital Design: Principles and Practices” – 7.12, 8.7 - 8.9 Mäluga süsteemide modelleerimine Musta kasti mudel Väljundi väärtus

hadar
Télécharger la présentation

Riistvara kirjelduskeel VHDL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Riistvara kirjelduskeel VHDL L4, L5. Riistvara kirjelduskeel VHDL L6. Mäluga süsteemid VHDL-s L7. VHDL ja süntees I207 - Digitaalloogika ja -süsteemid - L6

  2. Modelleerimine • J.F. Wakerly “Digital Design: Principles and Practices” – 7.12, 8.7 - 8.9 • Mäluga süsteemide modelleerimine • Musta kasti mudel • Väljundi väärtus • sõltub sisendi(te) väärtus(t)est • sõltub signaali (muutuja) eelmisest väärtusest • Kuidas kirjeldada osalist sõltuvust sisendi muutustest? I207 - Digitaalloogika ja -süsteemid - L6

  3. Kombinatoorsed ja mäluga skeemid • Kombinatoorsed skeemid • skeemi väljund sõltub ainult sisendist • atsüklilise topoloogiaga skeem on kombinatoorne • Mäluga skeemid • eksisteerivad mäluelemendid • tagasiside on vajalik • väljundi väärtus sõltub signaali (muutuja) eelmisest väärtusest I207 - Digitaalloogika ja -süsteemid - L6

  4. VHDL – tundlikkuse nimistu • Protsess aktiveeritakse sisendsignaali(de) muutumisel • Tundlikkuse nimistus võivad olla loetletud ainult osad sisendsignaalidest • pole tundlik mitte-loetletud signaalidele • vihje mäluelemendile (või puhvrile) • Simuleerimine ja süntees • erinevused mitte-loetletud signaalide interpretatsioonil I207 - Digitaalloogika ja -süsteemid - L6

  5. a x1 b a x2 b D C Pole hea…  VHDL – tundlikkuse nimistu process (a, b) begin x1 <= a and b; end process; • ehk x1 <= a and b; process (a) begin x2 <= a and b; end process; • b vajab puhvrit! I207 - Digitaalloogika ja -süsteemid - L6

  6. c x a b VHDL – tundlikkuse nimistu process (a, b, c) begin if a=’1’ and b=’1’ then x <= c; else x <= ’0’; end if; end process; I207 - Digitaalloogika ja -süsteemid - L6

  7. c x D C a b VHDL – tundlikkuse nimistu process (a, b, c) begin if a=’1’ and b=’1’ then x <= c; end if; end process; • else haru katmata → mälu (latch) latch I207 - Digitaalloogika ja -süsteemid - L6

  8. c x D C a b VHDL – tundlikkuse nimistu process (a, b) begin if a=’1’ and b=’1’ then x <= c; end if; end process; • Pole enamasti sünteesitav! flip-flop I207 - Digitaalloogika ja -süsteemid - L6

  9. c x D a C VHDL – tundlikkuse nimistu process (a) begin if a’event and a=’1’ then x <= c; end if; end process; • Kokkuleppeline interpretatsioon • et sünteesi tulemus oleks üheselt mõistetav… flip-flop I207 - Digitaalloogika ja -süsteemid - L6

  10. Atribuudid ‘event’ ja ‘stable’ • Atribuut • väärtus, funktsioon, tüüp, vahemik, signaal või konstant, mida võib siduda ühe või enama märgendiga VHDL kirjelduses • event • muutus signaali väärtuses (-tsüklis) • stable(T) • signaali väärtus pole muutunud viimase T ajaühiku jooksul I207 - Digitaalloogika ja -süsteemid - L6

  11. D Q CLK Mäluelement – D-flip-flop P1_FF: process -- behavioral     begin         wait on CLK until CLK=’1’;         Q<=D;     end process P1_FF; P2_FF: process (CLK) -- ”classical”     begin         if CLK=’1’ and CLK’event then             Q<=D;         end if;     end process P2_FF; I207 - Digitaalloogika ja -süsteemid - L6

  12. D Q CLK Mäluelement – D-latch P1_L: process (CLK, D) -- ”classical”     begin         if CLK=’1’ then             Q<=D;         end if;     end process P1_L; • D-flip-flop & andmevookäsud Q <= D when CLK’event and CLK = ’1’ else Q’DRIVING_VALUE;     Q <= D when CLK’event and CLK = ’1’ else unaffected;     Q <= D when CLK’event and CLK = ’1’; I207 - Digitaalloogika ja -süsteemid - L6

  13. flip-flop – reset & enable     P4_FF: process (CLK) begin         if CLK=’1’ and CLK’event then             if    RES=’1’ then    Q<=(others=>’0’);             elsif ENA=’1’ then    Q<=D;             end if;         end if;     end process P4_FF; • Sünkroonne nullimine • “clk’event” ja selle järel “res” I207 - Digitaalloogika ja -süsteemid - L6

  14. flip-flop – asynchronous reset     P5_FF: process (RESET,CLK) begin         if RESET=’1’ then -- asynchronous reset             Q<=(others=>’0’);         elsif CLK=’1’ and CLK’EVENT then             if ENA=’1’ then    Q<=D; end if;         end if;     end process P5_FF; • Asünkroonne nullimine • “reset” esimesena ja“clk’event” elsif-harus takti tunnusena I207 - Digitaalloogika ja -süsteemid - L6

  15. Taktsignaali stiilid • Frondi tunnus ja signaali uus väärtus • järjekord pole oluline • if CLK=’1’ and CLK’event then ... • if CLK=’1’ and not CLK’stable then ... • wait on CLK until CLK=’1’; • wait until CLK=’1’ and CLK’event; • wait until CLK=’1’ and not CLK’stable; I207 - Digitaalloogika ja -süsteemid - L6

  16. + / - < / > RG RG VHDL ja digitaalsüsteem process (a, b, c) begin   x <= f (a, b); y <= g (b, c); end process; process (clk) begin if clk’event and clk=’1’ then q <= d; end if; end process; Funktsionaalsed sõlmed Mäluelemendid I207 - Digitaalloogika ja -süsteemid - L6

  17. Näide - loendur 4 bitti: algus (strt) lõpp (stp) 1-suunaline 2-suunaline I207 - Digitaalloogika ja -süsteemid - L6

  18. Loendur – üks protsess library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; entity agener is generic ( bitwidth: positive ); port ( clock: in bit; reset, enable: in std_logic; start_address, stop_address: in unsigned(bitwidth-1 downto 0); address: out unsigned(bitwidth-1 downto 0) ); end agener; library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; architecture one_process of agener is signal count: unsigned(bitwidth-1 downto 0); begin process begin wait on clock until clock='1'; if reset='1' then count<=start_address; elsif enable='1' and count/=stop_address then count<=count+'1'; end if; end process; address<=count; end one_process; liides käitumine I207 - Digitaalloogika ja -süsteemid - L6

  19. Loendur – kaks protsessi architecture two_process of agener is signal count, new_count: unsigned(bitwidth-1 downto 0); begin process (reset, enable, start_address, stop_address, count) begin new_count<=count; if reset='1' then new_count<=start_address; elsif enable='1' then if start_address<=stop_address then if count<stop_address then new_count<=count+'1'; end if; else if count>stop_address then new_count<=count-'1'; end if; end if; end if; end process; process begin wait on clock until clock='1'; count<=new_count; end process; address<=count; end two_process; kombinatsioonskeem register I207 - Digitaalloogika ja -süsteemid - L6

  20. VHDL & valgusfoor • Kogutsükkel 30 sek., andurid puuduvad • roheline 12 sek. punane • kollane 3 sek. kollane+punane • punane 12 sek. roheline • kollane+punane 3 sek. kollane • Käitumuslik kood • ajakontrolli-käsud – eeldab sisemist taimerit • for-tsükkel ja 1 sek. timer – samm loenduri poole • Sünteesitav kood • eraldi loendur (andmeosa) ja kontroller (automaat) I207 - Digitaalloogika ja -süsteemid - L6

  21. Ajakontrolli-käsud entity TLC is port ( R1, Y1, G1, R2, Y2, G2: out bit ); end entity TLC; architecture behave of TLC is begin process begin R1 <= '0'; Y1 <= '0'; G1 <= '1'; R2 <= '1'; Y2 <= '0'; G2 <= '0'; wait for 12 sec; R1 <= '0'; Y1 <= '1'; G1 <= '0'; R2 <= '1'; Y2 <= '1'; G2 <= '0'; wait for 3 sec; R1 <= '1'; Y1 <= '0'; G1 <= '0'; R2 <= '0'; Y2 <= '0'; G2 <= '1'; wait for 12 sec; R1 <= '1'; Y1 <= '1'; G1 <= '0'; R2 <= '0'; Y2 <= '1'; G2 <= '0'; wait for 3 sec; end process; end architecture behave; Test-pink entity test_tlc is end entity test_tlc; architecture bench of test_tlc is signal road1, road2: bit_vector (1 to 3); component TLC port ( R1, Y1, G1, R2, Y2, G2: out bit ); end component; begin U1: TLC port map (road1(1),road1(2),road1(3), road2(1),road2(2),road2(3)); end architecture bench; VHDL & valgusfoor I207 - Digitaalloogika ja -süsteemid - L6

  22. for-tsükkel entity TLC2 is port ( timer: in bit; R1, Y1, G1, R2, Y2, G2: out bit ); end entity TLC2; architecture behave of TLC2 is begin process begin R1 <= '0'; Y1 <= '0'; G1 <= '1'; R2 <= '1'; Y2 <= '0'; G2 <= '0'; for i in 1 to 12 loop wait on timer until timer='1'; end loop; R1 <= '0'; Y1 <= '1'; G1 <= '0'; R2 <= '1'; Y2 <= '1'; G2 <= '0'; for i in 1 to 3 loop wait on timer until timer='1'; end loop; R1 <= '1'; Y1 <= '0'; G1 <= '0'; R2 <= '0'; Y2 <= '0'; G2 <= '1'; for i in 1 to 12 loop wait on timer until timer='1'; end loop; R1 <= '1'; Y1 <= '1'; G1 <= '0'; R2 <= '0'; Y2 <= '1'; G2 <= '0'; for i in 1 to 3 loop wait on timer until timer='1'; end loop; end process; end architecture behave; Test-pink entity test_tlc2 is end entity test_tlc2; architecture bench of test_tlc2 is signal road1, road2: bit_vector (1 to 3); signal timer: bit := '1'; component TLC2 port ( timer: in bit; R1, Y1, G1, R2, Y2, G2: out bit ); end component; begin timer <= not timer after 500 ms; U1: TLC2 port map (timer, road1(1),road1(2),road1(3), road2(1),road2(2),road2(3)); end architecture bench; VHDL & valgusfoor I207 - Digitaalloogika ja -süsteemid - L6

  23. VHDL & valgusfoor • Simulatsioonide tulemused TLC TLC2 I207 - Digitaalloogika ja -süsteemid - L6

  24. Konfigureerimine • Komponendid entity AD2 is port (A1, A2: in BIT; Y: out BIT); end; architecture B of AD2 is begin Y <= A1 and A2; end; entity XR2 is port (X1, X2: in BIT; Y: out BIT); end; architecture B of XR2 is begin Y <= X1 xor X2; end; • Komponentide deklaratsioonid ja konfiguratsiooni spetsifikatsioon entity Half_Adder is port (X, Y: BIT; Sum, Cout: out BIT); end; architecture Netlist of Half_Adder is use work.all; component MX port (A, B: BIT; Z:out BIT); end component; component MA port (A, B: BIT; Z:out BIT); end component; for G1:MX use entity XR2(B) port map(X1 => A,X2 => B,Y => Z); begin G1:MX port map (X, Y, Sum); G2:MA port map (X, Y, Cout); end; • Konfiguratsiooni deklaratsioon, ploki konfiguratsioon, komponendi konfiguratsioon configuration C1 of Half_Adder is use work.all; for Netlist for G2:MA use entity AD2(B) port map(A1 => A,A2 => B,Y => Z); end for; end for; end; • Allikas – http://www10.edacafe.com/book/ASIC/ASICs.php I207 - Digitaalloogika ja -süsteemid - L6

More Related