Gast
#5223500
Guten Abend! ich habe ein Problem. Ich wollte eine astabile Kippstufe in VHDL realisieren, und habe es auch geschafft. Mein Problem ist, dass ich eine Einschaltzeit vom Ausgang von 30ns brauche und eine Ausschaltzeit von 50ns. Das mit den 30ns klappt ja noch, aber die Ausschaltzeit geht einfach nicht bis 50ns(nur 40ns). Programm: -- Astabile Kippstufe library IEEE; use IEEE.std_logic_1164.all; entity AMV is port( CLK: in bit; START: in bit; -- RESET - Leitung Q: out bit; -- Ausgangssignal NOTQ: out bit ); -- negiertes Ausgangssignal end AMV; architecture MOORE of AMV is type ZUSTAENDE is (Z0, Z1, Z2); -- Aufzählungstyp signal ZUSTAND,VOR_ZU, FOLGE_Z: ZUSTAENDE; begin REG: process(CLK, START) -- Zustandsaktualisierung begin if START = '0' then ZUSTAND <= Z0 after 5ns; elsif clk = '1' and clk'event then VOR_ZU <= ZUSTAND; if START = '1' then if VOR_ZU = Z0 then ZUSTAND <= FOLGE_Z after 30ns; end if; if VOR_ZU = Z1 then ZUSTAND <= FOLGE_Z after 50ns; end if; end if; end if; end process REG; NETZE: process(START, ZUSTAND) -- Kombinatorische Logik begin Q <= '0';-- after 5ns; -- Default Ausgangssignal NOTQ <= '1';-- after 5ns; FOLGE_Z <= Z0;-- after 5ns; -- Default Folgezustand Z0 case ZUSTAND is when Z0 => Q <= '0';-- after 5ns; NOTQ <= '1';-- after 5ns; if START = '1' then FOLGE_Z <= Z1;-- after 5ns; end if; when Z1 => Q <= '1';-- after 5ns; NOTQ <= '0';-- after 5ns; if START = '1' then FOLGE_Z <= Z0;-- after 5ns; end if; when Z2 => if START = '1' then FOLGE_Z <= Z0;-- after 5ns; end if; end case; end process NETZE; end MOORE; Testbench: library IEEE; use IEEE.std_logic_1164.all; entity top_AMV is end top_AMV; architecture ta_MOORE of top_AMV is component AMV is port( CLK: in bit; START: in bit; -- RESET - Leitung Q: out bit; -- Ausgangssignal NOTQ: out bit ); -- negiertes Ausgangssignal end component; signal clk : bit; signal start: bit; signal q: bit; signal notq: bit; begin DUT: AMV port map (clk, start, q, notq); STIMULI: process begin clk <= '0'; start <= '0'; wait for 5 ns; start <= '1'; wait for 5 ns; for I in 0 to 100 loop clk <= '1'; wait for 5 ns; clk <= '0'; wait for 5 ns; end loop; assert false report "Test done." severity note; wait; end process STIMULI; end ta_MOORE;