Files
es-abschlussprojekt/Archiv/Hardware/crc_axi_control.vhd
T
2025-01-31 17:47:31 +01:00

83 lines
2.9 KiB
VHDL

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity crc_axi_control is
generic (
LUTRAM_AWIDTH : positive := 4;
PACKET_SIZE_WIDTH : positive := 16;
PACKET_NUM_WIDTH : positive := 16;
MAX_BURSTLEN : positive := 16;
);
port (
CLK : in std_logic;
RESETN : in std_logic;
-- AXIL Registers
start_ip : in std_logic;
stop_ip : in std_logic;
status : out std_logic;
interrupt_enable : in std_logic;
interrupt_status : out std_logic;
interrupt_reset : in std_logic;
raddr : in std_logic_vector(31 downto 0);
waddr : in std_logic_vector(31 downto 0);
packet_size : in std_logic_vector(PACKET_SIZE_WIDTH-1 downto 0);
packet_number : in std_logic_vector(PACKET_NUM_WIDTH-1 downto 0);
-- Interface to Block-RAM
ram_sel : out std_logic;
ram_waddr : out std_logic_vector(BRAM_AWIDTH-1 downto 0);
ram_we : out std_logic;
ram_waddr : out std_logic_vector(BRAM_AWIDTH-1 downto 0);
ram_re : out std_logic;
-- Interface to AXI Master component
axi_start : out std_logic;
axi_write : out std_logic;
axi_addr : out std_logic_vector(31 downto 0);
axi_size : out std_logic_vector(3 downto 0);
axi_idle : in std_logic;
-- Control signals for CRC component
crc_en : out std_logic;
cec_rst : out std_logic;
byte_sel : out std_logic_vector(1 downto 0);
);
end entity;
architecture rtl of crc_axi_control is
type state_t is (IDLE, READ_DATA);
signal state : state_t := IDLE;
signal packets_cnt : unsigned(PACKET_NUM_WIDTH-1 downto 0) := (others=>'0');
signal data_cnt : unsigned(PACKET_SIZE_WIDTH+PACKET_NUM_WIDTH-1 downto 0) := (others=>'0');
signal read_addr : unsigned(31 downto 0) := (others=>'0');
signal write_addr : unsigned(31 downto 0) := (others=>'0');
begin
process
begin
wait until rising_edge(CLK);
if RESETN = '0' then
state <= IDLE;
else
case state is
when IDLE =>
if start_ip = '1' then
packets_cnt <= unsigned(packet_number);
data_cnt <= unsigned(packet_size);
read_addr <= unsigned(raddr);
write_addr <= unsigned(waddr);
end if;
when others =>
null;
end case;
end if;
end process;
end architecture;