171 lines
5.9 KiB
VHDL
171 lines
5.9 KiB
VHDL
|
-- This package contains all definitions relating to the implementation of the avalon_st protocol
|
||
|
|
||
|
library ieee;
|
||
|
use ieee.std_logic_1164.all;
|
||
|
|
||
|
package avalon_st_pkg is
|
||
|
type AVALON_ST_8 is record
|
||
|
data : std_logic_vector(7 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_16 is record
|
||
|
data : std_logic_vector(15 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
empty : std_logic_vector(0 downto 0);
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_32 is record
|
||
|
data : std_logic_vector(31 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
empty : std_logic_vector(0 downto 0);
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_64 is record
|
||
|
data : std_logic_vector(63 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
empty : std_logic_vector(1 downto 0);
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_128 is record
|
||
|
data : std_logic_vector(127 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
empty : std_logic_vector(2 downto 0);
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_256 is record
|
||
|
data : std_logic_vector(255 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
empty : std_logic_vector(3 downto 0);
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_512 is record
|
||
|
data : std_logic_vector(511 downto 0);
|
||
|
valid : std_logic;
|
||
|
startofpacket : std_logic;
|
||
|
endofpacket : std_logic;
|
||
|
empty : std_logic_vector(4 downto 0);
|
||
|
error : std_logic;
|
||
|
end record;
|
||
|
|
||
|
type AVALON_ST_8_ARRAY_TYPE is array (natural range <>) of AVALON_ST_8;
|
||
|
type AVALON_ST_16_ARRAY_TYPE is array (natural range <>) of AVALON_ST_16;
|
||
|
type AVALON_ST_32_ARRAY_TYPE is array (natural range <>) of AVALON_ST_32;
|
||
|
type AVALON_ST_64_ARRAY_TYPE is array (natural range <>) of AVALON_ST_64;
|
||
|
type AVALON_ST_128_ARRAY_TYPE is array (natural range <>) of AVALON_ST_128;
|
||
|
type AVALON_ST_256_ARRAY_TYPE is array (natural range <>) of AVALON_ST_256;
|
||
|
type AVALON_ST_512_ARRAY_TYPE is array (natural range <>) of AVALON_ST_512;
|
||
|
|
||
|
function ZERO_AVALON_ST_8 return AVALON_ST_8;
|
||
|
function ZERO_AVALON_ST_16 return AVALON_ST_16;
|
||
|
function ZERO_AVALON_ST_32 return AVALON_ST_32;
|
||
|
function ZERO_AVALON_ST_64 return AVALON_ST_64;
|
||
|
function ZERO_AVALON_ST_128 return AVALON_ST_128;
|
||
|
function ZERO_AVALON_ST_256 return AVALON_ST_256;
|
||
|
function ZERO_AVALON_ST_512 return AVALON_ST_512;
|
||
|
|
||
|
end package avalon_st_pkg;
|
||
|
|
||
|
package body avalon_st_pkg is
|
||
|
|
||
|
function ZERO_AVALON_ST_8 return AVALON_ST_8 is
|
||
|
variable returned_record : AVALON_ST_8;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_8;
|
||
|
|
||
|
function ZERO_AVALON_ST_16 return AVALON_ST_16 is
|
||
|
variable returned_record : AVALON_ST_16;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.empty := (others => '0');
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_16;
|
||
|
|
||
|
function ZERO_AVALON_ST_32 return AVALON_ST_32 is
|
||
|
variable returned_record : AVALON_ST_32;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.empty := (others => '0');
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_32;
|
||
|
|
||
|
function ZERO_AVALON_ST_64 return AVALON_ST_64 is
|
||
|
variable returned_record : AVALON_ST_64;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.empty := (others => '0');
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_64;
|
||
|
|
||
|
function ZERO_AVALON_ST_128 return AVALON_ST_128 is
|
||
|
variable returned_record : AVALON_ST_128;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.empty := (others => '0');
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_128;
|
||
|
|
||
|
function ZERO_AVALON_ST_256 return AVALON_ST_256 is
|
||
|
variable returned_record : AVALON_ST_256;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.empty := (others => '0');
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_256;
|
||
|
|
||
|
function ZERO_AVALON_ST_512 return AVALON_ST_512 is
|
||
|
variable returned_record : AVALON_ST_512;
|
||
|
begin
|
||
|
returned_record.data := (others => '0');
|
||
|
returned_record.valid := '0';
|
||
|
returned_record.startofpacket := '0';
|
||
|
returned_record.endofpacket := '0';
|
||
|
returned_record.empty := (others => '0');
|
||
|
returned_record.error := '0';
|
||
|
return returned_record;
|
||
|
end function ZERO_AVALON_ST_512;
|