1 / 24

Curs 04 Sinte z a automatelor (maşinilor) secvenţiale cu st ă ri finite

Curs 04 Sinte z a automatelor (maşinilor) secvenţiale cu st ă ri finite. Automate Moore Automate Mealy. Structura automatelor secvenţiale. combinaţional. secvenţial. combinaţional. combinaţional. secvenţial. combinaţional. Descrierea VHDL a unui automat sincron Moore.

sakura
Download Presentation

Curs 04 Sinte z a automatelor (maşinilor) secvenţiale cu st ă ri finite

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. Curs 04Sinteza automatelor (maşinilor) secvenţiale cu stări finite Automate Moore Automate Mealy

  2. Structura automatelor secvenţiale combinaţional secvenţial combinaţional combinaţional secvenţial combinaţional

  3. Descrierea VHDL a unui automat sincron Moore 1. se definesc stările automatului: TYPEstari IS (Initializare,..., Starea3); signal stare_curenta, stare_viitoare : stari; 2. se descrie diagrama de tranziţii – blocul 1: Tranzitii : process (stare_curenta, intrari) begin .... end process Tranzitii ; 3. se descrie registrul de stocare – bocul 2: Registru : process (reset,clock) begin ... end process Registru; 4. se descrie decodorul de stări – blocul 3: Iesiri : process (stare_curenta) begin ...... end process Iesiri;

  4. intrările blocului 1 ieşirea blocului Descrierea VHDL a diagramei de tranziţii stare_curenta, X1, X0 Tranzitii:process() begin case is when Initializare => if (X1=’0’ and X0=’0’) then stare_viitoare <= Starea0; elsif (X1=’1’ and X0=’1’) then stare_viitoare <= Starea3; elsestare_viitoare <= Initializare; end if; when Starea0=> ... when Starea1 => ... when Starea2 => ... when Starea3 => ... end case; end process Tranzitii; stare_curenta

  5. ceas, intrările asincrone ale automatului logica asincrona logica sincrona Descrierea VHDL a registrului de stare clock, reset Registru:process() begin if (reset='1') then stare_curenta <= Iniţializare; elsif rising_edge(clock) then stare_curenta <= stare_viitoare; end if; end process Registru;

  6. intrare bloc 3 valoare iesiri Descrierea VHDL a blocului de ieşire Iesiri :process() begin case stare_curenta is when Initializare => Y1 <= '0'; Y0 <= '0'; when Starea0 => ... when Starea1 => ... when Starea2 => ... when Starea3 => ... end case; end process Iesiri; stare_curenta with stare_curenta select iesire <= valoare_1 when stare_1, …, valoare_n when stare_n;

  7. ARIE minimă SEQUENTIAL 000 001 010 011 100 101 110 111 VITEZĂ maximă ROBUST (fără glitch-uri) ONE-HOT 0000000 0000001 0000010 0000100 0001000 0010000 0100000 1000000 GRAY 000 001 011 010 110 111 101 100 JOHNSON 0000 0001 0011 0111 1111 1110 1100 1000 Optimizare automatului cu stari finite prin stabilirea codului starilor

  8. Eliminarea blocului de determinare a ieşirilor Indicaţie: stările automatului se vor codifica astfel încât să furnizeze valorile ieşirilor automatului Exemplu: Y1 <= stare_curenta(2); Y0 <= stare_curenta(1); atribuirea iesirilor ieşirile nu pot furniza 2 coduri diferite pentru starile 1, respectiv 2 se introduce un nou bit care permite codarea diferită a stărilor 1, respectiv 2 constant initializare : std_logic_vector (2 downto 0) : = “000”; constant stare0 : std_logic_vector (2 downto 0) : = “100”; ... signal stare_curenta : std_logic_vector(2 downto 0); signal stare_viitoare : std_logic_vector(2 downto 0); declararea codului stărilor declararea stărilor

  9. Descrierea VHDL a unui automat sincron Mealy asincron ieşirile depind de starea curentă a automatului şi de starea curentă a intrărilor: descrierea blocului 1 – diagrama de tranziţii: rămâne neschimbat descrierea blocului 2 – registrul de stare: rămâne neschimbat descrierea blocului 3 – blocul de ieşire: valorile ieşirilor sunt specificate în funcţie de starea curentă şi de intrări;

  10. Descrierea VHDL a blocului de ieşire Iesiri :process( stare_curenta, intrari) Begin case stare_curenta is when stare_* => if intrare = nivel_activ then iesiri <= valoare_1; else iesiri <= valoare_2; end if; when stare_** => …. end process Iesiri;

  11. Descrierea VHDL a unui automat sincron Mealy sincron • se introduce un semnal intern tmp care preia valorile ieşirilor în funcţie de starea automatului • ieşirile vor fi actualizate sincron cu semnalul de ceas, în cadrul procesului care descrie registrul automatului, prin furnizarea valorilor semnalului intern tmpsemnalului de ieşire. • descrierea blocului 2 – registrul de stare: se adaugă o instrucţiune de atribuire în care ieşirea preia valoarea semnalului intern tmp, pe frontul activ al semnalului de ceas. • descrierea blocului 3 – blocul de ieşire: valorile semnalului intern tmp sunt specificate în funcţie de starea curentă şi de intrări;

  12. Registru:process(clock,reset) begin if (reset = '1') then stare_curenta <= Initializare ; Y <= ”00”; elsif rising_edge(clock) then stare_curenta <= stare_viitoare ; Y <= tmp; end if; end process Registru; Iesiri:process(stare_curenta, X) begin case stare_curenta is when Initializare => if (X=”00”) then tmp <= ”10”; elsif (X=”11”) then tmp <= ”01”; else tmp <= ”00”; end if; when Starea0 => ... when Starea1 => ... when Starea2 => ... when Starea3 => ... end case; end process Iesiri;

  13. Blocuri de memorie în dispozitivele FPGA

  14. Tipuri de blocuri de memorii • ROM, RAM • Single port; dual port • Asincrone; sincrone

  15. Sinteza blocurilor de memorie • Descriere comportamentală şi inferenţă • Utilizarea resurselor FPGA-ului dedicate blocurilor de memorie prin instanţiere

  16. Descriere comportamentală şi inferenţă Cod portabil Nu necesită instrumente de sinteză şi implementare dedicate Pot fi generate soluţii neoptimizate Se pot infera doar memorii RAM sincrone Nu există suport hardware pentru semnalul de activare a blocului de memorie RAM (enable) generează blocuri RAM distribuite Instanţiere resurse dedicate Soluţii optime Pot fi generate toate tipurile de memorii RAM Codul sursă nu este portabil, fiind dependent de structura FPGA-ului Nu se pot controla parametrii de timp (timing) şi arie Necesită instrumente software de proiectare dedicate. Avantaje-dezavantaje

  17. Memorie RAM single port cu citire asincronă – entitateamemorie distribuită LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; entity raminfr is generic ( bits : integer := 32; -- dimensiune cuvânt memorie addr_bits : integer := 3); -- 2^addr_bits = număr cuvinte RAM port (clk : in std_logic; we : in std_logic; a: in std_logic_vector(addr_bits-1 downto 0); di : in std_logic_vector(bits-1 downto 0); do : out std_logic_vector(bits-1 downto 0)); end raminfr;

  18. 1. Memorie RAM single port cu citire asincronă - arhitectura architecture behavioral of raminfr is type ram_type is array (2**addr_bits-1 downto 0) of std_logic_vector (bits-1 downto 0); signal RAM : ram_type; begin process (clk) begin if (rising_edge(clk)) then if (we = '1') then RAM(conv_integer(a)) <= di; -- scriere sincrona end if; end if; end process; do <= RAM(conv_integer(a)); -- citire asincrona end behavioral;

  19. 2. Memorie RAM single port cu citire sincronă – entitateamemorie distribuită LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; entity raminfr is generic ( bits : integer := 32; -- dimensiune cuvânt addr_bits : integer := 3); -- 2^addr_bits = numar cuvinte port (clk : in std_logic; we : in std_logic; a : in std_logic_vector(addr_bits-1 downto 0); di : in std_logic_vector(bits-1 downto 0); do : out std_logic_vector(bits-1 downto 0)); end raminfr;

  20. 2. Memorie RAM single port cu citire sincronă - arhitectura architecture behavioral of raminfr is type ram_type is array (2**addr_bits-1 downto 0) of std_logic_vector (bits-1 downto 0); signal RAM : ram_type; begin process (clk) begin if (rising_edge(clk)) then if (we = '1') then RAM(conv_integer(a)) <= di; end if; do <= RAM(conv_integer(a));-- citire sincronă end if; end process; end behavioral;

  21. 3. Memoriedual port RAM cu citire asincronă – entitatememorie distribuită library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity raminfr is generic ( bits : integer := 32; -- dimensiune cuvânt addr_bits : integer := 3); -- 2^addr_bits = număr cuvinte port (clk : in std_logic; we : in std_logic; a : in std_logic_vector(addr_bits-1 downto 0); dpra : in std_logic_vector(addr_bits-1 downto 0); di : in std_logic_vector(bits-1 downto 0); spo : out std_logic_vector(bits-1 downto 0); dpo : out std_logic_vector(bits-1 downto 0)); end raminfr;

  22. 3. Memorie dual port RAM cu citire asincronă - arhitectură architecture syn of raminfr is type ram_type is array (2**addr_bits-1 downto 0) of std_logic_vector (bits-1 downto 0); signal RAM : ram_type; begin process (clk) begin if (clk'event and clk = '1') then if (we = '1') then RAM(conv_integer(a)) <= di; end if; end if; end process; spo <= RAM(conv_integer(a)); dpo <= RAM(conv_integer(dpra)); end syn;

  23. 4. Memoria ROM - entitatea LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_unsigned.all; entity rominfr is generic ( bits : integer := 10; -- dimensiune cuvinte addr_bits : integer := 3); -- 2^addr_bits = numar cuvinte port (a : in std_logic_vector(addr_bits-1 downto 0); do : out std_logic_vector(bits-1 downto 0)); end rominfr;

  24. 4. Memoria ROM - arhitectura architecture behavioral of rominfr is type rom_type is array (2**addr_bits-1 downto 0) of std_logic_vector (bits-1 downto 0); constant ROM : rom_type := ("0000110001", "0100110100", "0100110110", "0110110000", "0000111100", "0111110101", "0100110100", "1111100111"); begin do <= ROM(conv_integer(a)); end behavioral;

More Related