Rete RSS

10
Rete RSS VHDL per l’orale di Reti Logiche

description

Rete RSS. VHDL per l’orale di Reti Logiche. Descrizione. La Rete sincrona realizzata con sintesi diretta, compara 2 Byte seriali e restituisce un segnale binario. Ingressi: Serial_Input : segnale seriale che trasmette il Byte attuale; - PowerPoint PPT Presentation

Transcript of Rete RSS

Page 1: Rete RSS

Rete RSS

VHDL per l’orale di Reti Logiche

Page 2: Rete RSS

Descrizione

La Rete sincrona realizzata con sintesi diretta, compara 2 Byte seriali e restituisce un segnale binario.Ingressi:• Serial_Input: segnale seriale che trasmette il Byte attuale;• Start: segnale che va ad 1 all’inizio dell’inserimento dei dati;• Clock: segnale periodico;• Reset: riporta la rete allo stato iniziale azzerando il contatore ed i registri;Uscite:• A[7,0]: Byte appena inserito;• B[7,0]: Byte inserito precedentemente;• Counter: segnale che va ad 1 quando conte per 8;• Abilita: segnale che resta ad 1 quando è già stato inserito il primo Byte ed abilita z;• Uguali: Va e resta ad 1 per un solo clock quando i 2 Byte sono uguali;

Page 3: Rete RSS

Codice VHDL (1)• signal Reset_Counter: std_logic; -- Segnali interni• signal Conteggio: std_logic_vector (3 downto 0):="0000"; -- Segnali interni• signal Reset_RegA: std_logic; -- Segnali interni• signal z: std_logic; -- Segnali interni• signal Reset_Start: std_logic; -- Segnali interni• signal Go: std_logic; -- Segnali interni

• Begin

• Reset_Counter <= (Reset or Counter);• Reset_RegA <= (Reset or Counter);• Uguali <= (z and Counter and Abilita);• Reset_Start <= (Reset or Counter);

• process_start: process(Start, Go, Reset_Start) -- FFD che salva il segnale Start e restituisce Go (Reset Asincrono)• begin • if (Reset_Start = '1') then• Go <= '0';• else • if (Start'event) and (Start='1') then• Go <= '1';• end if;• end if;• end process;

Page 4: Rete RSS

Codice VHDL (2)• process_counter: process(Clock, Go, Reset_Counter) -- Contatore che conta per 8• begin • if (Clock'event) and (Clock = '1') then• if (Reset_Counter='1') then• Conteggio <= "0000";• elsif (Go='1') then• Conteggio <= Conteggio + "0001";• end if;• end if;• end process;•

• process_decoder: process(Conteggio) --Decoder che rende 1 Counter• begin• case Conteggio(3 downto 0) is • when "1000" => Counter <='1';• when others => Counter <='0';• end case;• end process;

Page 5: Rete RSS

Codice VHDL (3)• process_regA: process(Ser_Input, Go, Clock, Reset_RegA) --Registro A che memorizza il Segnale • begin -- serializzato in Input e lo manda in B•

• if (Clock'event) and (Clock = '1')then• if (Reset_RegA ='1') then• A <= "00000000";• elsif (Go = '1') then• A <= Ser_Input & A(7 downto 1);• end if;• end if;• end process;•

• process_regB: process(Clock, Reset, Counter) --Registro B che memorizza il Byte precedente di A• begin --mandandolo poi nel comparatore•

• if (Clock'event) and (Clock = '1') then• if (Reset ='1') then• B <= "00000000";• elsif (Counter ='1') then• B<=A;• end if;• end if;• end process;

Page 6: Rete RSS

Codice VHDL (4)• process_abilita: process(Clock, Reset) -- rete che blocca z il primo "giro" (Reset Asincrono)• begin

• if (Reset = '1') then• Abilita <= '0';• else • if (Clock'event) and (Clock='1') and (Abilita = '0') then• Abilita <= Counter;• end if;• end if;• end process;•

• process_comparator: process(A, B) --Compara i 2 Byte e restituisce '1' se sono uguali• begin • if (A=B) then• z <= '1';• else• z <= '0';• end if;• end process;•

• end Behavioral;

Page 7: Rete RSS

Test di simulazione• wait for 10ns;• reset<='0'; -- Fine di Reset di Sistema•

• wait for 170ns;•

• -- Controllo che z non sia ad 1 al primo giro• start<='1'; Ser_Input<='0'; -- Inserimento prima serie di bit (Uguale al RegB) Z non deve andare a 1• wait for 2400ns;• start<='0'; Ser_Input<='0'; -- Fine inserimento prima serie di bit (8 fronti del clock) "00000000"•

• wait for 500ns;•

• -- Controllo che z non sia 1, se Byte diversi• start<='1'; Ser_Input<='1'; -- Inserimento seconda serie di bit• wait for 2400ns;• start<='0'; Ser_Input<='0'; -- Fine inserimento seconda serie di bit (8 fronti del clock) "00000000"•

• wait for 600ns;•

• reset<='1'; • wait for 500ns;• reset<='0';

Page 8: Rete RSS

Test di simulazione (2)• -- Controllo che z non sia ad 1 al primo giro con Byte <> da "00000000"• start<='1'; Ser_Input<='0'; -- Inserimento terza serie di bit • wait for 300ns;• Ser_Input<='1'; start<='0'; wait for 600ns;• Ser_Input<='0'; wait for 600ns;• Ser_Input<='1'; wait for 600ns;• Ser_Input<='0'; wait for 300ns;• start<='0'; -- Fine inserimento terza serie di bit (8 fronti del clock) "01100110"•

• wait for 800ns;•

• -- Controllo che z sia 1 al secondo giro con 2 Byte uguali• start<='1'; Ser_Input<='0'; -- Inserimento quarta serie di bit = alla terza• wait for 300ns;• Ser_Input<='1'; wait for 600ns;• Ser_Input<='0'; wait for 600ns;• Ser_Input<='1'; start<='0'; wait for 600ns;• Ser_Input<='0'; wait for 300ns;• start<='0'; -- Fine inserimento quarta serie di bit (8 fronti del clock) "01100110"•

• wait for 800ns;• reset<='1';•

• WAIT;• end process;

Page 9: Rete RSS

Simulazioni Behavioural

Parte 1 Parte 2 (dopo il reset)

Page 10: Rete RSS

Simulazioni Post-Route

Parte 1 Parte 2 (dopo il reset)