square: stay quiet if period = 0
This commit is contained in:
parent
790c08f1f2
commit
963cd1059e
@ -38,23 +38,30 @@ architecture Behavioral of square is
|
||||
signal enabled: std_logic;
|
||||
|
||||
signal counter: unsigned(23 downto 0);
|
||||
signal active: std_logic;
|
||||
|
||||
begin
|
||||
|
||||
-- counter process
|
||||
-- drives counter
|
||||
-- drives counter, active
|
||||
process(clk, rst)
|
||||
begin
|
||||
|
||||
if rst = '1' then
|
||||
counter <= to_unsigned(0, 24);
|
||||
active <= '0';
|
||||
elsif rising_edge(clk) then
|
||||
if enabled = '0' or counter(22 downto 7) = unsigned(period) then
|
||||
active <= '0';
|
||||
counter <= to_unsigned(0, 24);
|
||||
|
||||
if enabled = '1' and unsigned(period) /= 0 then
|
||||
if counter(22 downto 7) = unsigned(period) then
|
||||
active <= '1';
|
||||
else
|
||||
counter <= counter + 1;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
end process;
|
||||
|
||||
@ -76,9 +83,9 @@ begin
|
||||
m_we <= '0';
|
||||
|
||||
if enabled = '1' then
|
||||
if counter = 0 and m_busy = '1' then
|
||||
if active = '1' and m_busy = '1' then
|
||||
deferred := '1';
|
||||
elsif deferred = '1' or (counter = 0 and m_busy = '0') then
|
||||
elsif deferred = '1' or (active = '1' and m_busy = '0') then
|
||||
m_we <= '1';
|
||||
m_addr <= out_addr;
|
||||
if high = '1' then
|
||||
|
Loading…
Reference in New Issue
Block a user