Documente Academic
Documente Profesional
Documente Cultură
Pentru modelarea circuitului am folosit tabelul cu valorile de adevar. Din tabel se deduce comportarea
circuitului. Stim ca ordinea prioritatile este: RN, SN, CKN.
Pentru modelarea circuitului am folosit tabelul cu valorile de adevar. Din tabel se deduce comportarea
circuitului. Stim ca ordinea prioritatile este: RN, SN, CKN.
Cand Rn=0 avem Q=0 si QN=1;
Cand Sn=0 avem Q=1 si QN=0;
Cand Rn=Sn=0 avem Q=1 si Qn=0;
Cand Rn=Sn=1, atunci modificarile se fac in functie de Clock si intrarea D.
Circuit DFFNSR:
library IEEE;
use IEEE.std_logic_1164.all;
--declararea entitatii
entity PC_DFFNSR is
generic ( tpLH_Q: time:=2 ns ; tpHL_Q: time:=1 ns;
tpLH_nQ: time:=2 ns; tpHL_nQ: time:=1 ns; --constatnte tip time
setup_timeLH: time:=50 ps; setup_timeHL: time:=50 ps;
hold_timeLH : time:=50 ps; hold_timeHL : time:=800 ps);
end PC_DFFNSR;
-- declarea entitatii
architecture PC_arhitectura_DFFNSR of PC_DFFNSR is
begin
proces_DFFNSR : process (CKN,SN,RN)
begin
if((SN='0') and (RN='0')) then
Q<='1' after 1 ns ;
QN<='0' after 1 ns ;
elsif((SN='1') and (RN='0') ) then
Q<='0' after 1 ns ;
QN<='1' after 1 ns ;
elsif((SN='0') and (RN='1')) then
Q<='1' after 1 ns ;
QN<='0' after 1 ns ; -- pana aici se verifica daca Set si Reset negate blocheaza funct
bistabilului
elsif ((SN='1') and (RN='1')) then
if(D='0' and CKN'event and CKN='1' ) then
Q<='0' after tpLH_Q ;
QN<='1' after tpLH_nQ ;
elsif (D='1' and CKN'event and CKN='1') then
Q<='1' after tpHL_Q ;
QN<='0' after tpHL_nQ ;
--cand NSet si NReset sunt 1 , aici se copiaza intrarea la iesire
end if;
end if;
end process proces_DFFNSR ;
end PC_arhitectura_DFFNSR ;
Testare DFFNSR:
library ieee;
use ieee.std_logic_1164.ALL;
-- creare entitate
entity PC_entitate_testbench is
end PC_entitate_testbench;
--creare arhitectura
architecture PC_arhitectura_testbench of PC_entitate_testbench is
component PC_DFFNSR is
port ( D,RN,SN,CKN : in std_logic; --intrari
Q, QN : out std_logic ); --iesiri
end component;
--generari de semnale
gen_NClock: process
begin
NClock <= '1';
wait for 3 ns;
NClock<= '0';
wait for 3 ns;
end process;
gen_NReset: process
begin
NReset <= '0';
wait for 15 ns;
NReset<= '1';
wait for 15 ns;
NReset <= '0';
wait for 15 ns;
NReset<= '1';
wait for 75 ns;
end process;
gen_NSet: process
begin
NSet<= '1';
wait for 15 ns;
NSet <= '0';
wait for 30 ns;
NSet <= '1';
wait for 75 ns;
end process;
gen_Date: process
begin
Date<= '0';
wait for 7 ns;
Date<= '1';
wait for 7 ns;
end process;
semnaluldone: process
begin
wait for 200 ns; --sta 200ns
assert (false) -- pt ca e (false), trece mai departe
report "Exit!"
severity failure; -- termina simularea
end process;
d architecture PC_arhitectura_testbench;