reduced complexity in dummy IP. Now works with buffers with no unnecessary stall

This commit is contained in:
Erik Örtenberg 2025-05-22 23:49:40 +02:00
parent 4e4853c540
commit b1eee9ce1e

View File

@ -3,44 +3,37 @@ use IEEE.std_logic_1164.all;
use IEEE.NUMERIC_STD.all; use IEEE.NUMERIC_STD.all;
entity dummy_ip is entity dummy_ip is
generic (
data_width : natural := 8
);
port ( port (
clk, rst : in std_logic; clk, rst : in std_logic;
ready_in, valid_in : in std_logic; ready_in, valid_in : in std_logic;
ready_out, valid_out : out std_logic; ready_out, valid_out : out std_logic;
data_in : in std_logic_vector(data_width - 1 downto 0); data_in : in std_logic_vector(8 - 1 downto 0);
data_out : out std_logic_vector(data_width - 1 downto 0) data_out : out std_logic_vector(8 - 1 downto 0)
); );
end entity dummy_ip; end entity dummy_ip;
architecture rtl of dummy_ip is architecture rtl of dummy_ip is
signal incremented_in : std_logic_vector(data_width - 1 downto 0); signal incremented_in : std_logic_vector(8 - 1 downto 0);
signal valid_out_signal : std_logic;
begin begin
valid_out <= valid_out_signal; comb_proc: process(ready_in, valid_in, data_in, incremented_in)
data_out <= incremented_in; begin
ready_out <= ready_in;
end process;
seq_proc: process(clk, data_in, ready_in, valid_in) seq_proc: process(clk,rst)
begin begin
if rst = '1' then if rst = '1' then
incremented_in <= (others => '0'); valid_out <= '0';
valid_out_signal <= '0'; data_out <= (others => '0');
ready_out <= '1'; elsif rising_edge(clk) then
else if valid_in = '1' and ready_in = '1' then
if rising_edge(clk) then valid_out <= '1';
if valid_in = '1' then data_out <= std_logic_vector(unsigned(data_in) + 1);
valid_out_signal <= '1'; else
ready_out <= '0'; valid_out <= '0';
elsif valid_out_signal = '1' and ready_in = '1' then end if;
valid_out_signal <= '0'; elsif falling_edge(clk) then
ready_out <= '1';
end if;
elsif falling_edge(clk)then
incremented_in <= std_logic_vector(unsigned(data_in) + 1);
end if;
end if; end if;
end process seq_proc; end process seq_proc;