1 |
20 |
mcwaccent |
-- Package Filea Template
|
2 |
|
|
--
|
3 |
|
|
-- Purpose: This package defines supplemental types, subtypes,
|
4 |
|
|
-- constants, and functions
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
library IEEE;
|
8 |
|
|
use IEEE.STD_LOGIC_1164.all;
|
9 |
|
|
--use work.mem_interface_top_parameters_0.all;
|
10 |
|
|
|
11 |
|
|
package port_block_Constants is
|
12 |
|
|
|
13 |
|
|
constant MAX_NUM_PORTS_2_FIND : integer := 64;
|
14 |
|
|
constant MAX_NUM_FRAME_COUNTERS : integer := 8;
|
15 |
|
|
constant TCP_SOURCE : std_logic_vector(7 downto 0) := X"24";
|
16 |
|
|
constant TCP_DESTINATION : std_logic_vector(7 downto 0) := X"25";
|
17 |
|
|
constant UDP_SOURCE : std_logic_vector(7 downto 0) := X"2E";
|
18 |
|
|
constant UDP_DESTINATION : std_logic_vector(7 downto 0) := X"2F";
|
19 |
|
|
constant SHARED_MEM_PREFIX_SOURCE : std_logic_vector(8 downto 0) := "011011000";
|
20 |
|
|
constant SHARED_MEM_PREFIX_DEST : std_logic_vector(8 downto 0) := "011011001";
|
21 |
|
|
constant SHARED_MEM_LUT_SRC_START : std_logic_Vector(8 downto 0) := "011011010";
|
22 |
|
|
constant SHARED_MEM_LUT_DST_START : std_logic_Vector(8 downto 0) := "011011011";
|
23 |
|
|
constant SHARED_MEM_COUNTER_START : STD_logic_vector(8 downto 0) := "011011100";
|
24 |
|
|
constant baud : std_logic_vector := "110";--"000";
|
25 |
|
|
--sharable memory id map----
|
26 |
|
|
constant ID_0_SHARED : std_logic_vector(5 downto 0) := "100000";
|
27 |
|
|
constant ID_EmPAC_SHARED : std_logic_vector(5 downto 0) := "100001";
|
28 |
|
|
constant ID_wc_uart_SHARED : std_logic_vector(5 downto 0) := "100010";
|
29 |
|
|
constant ID_eRCP_SHARED : std_logic_vector(5 downto 0) := "100011";
|
30 |
|
|
constant ID_eRCP0_SHARED : std_logic_vector(5 downto 0) := "100100";
|
31 |
|
|
constant ID_5_SHARED : std_logic_vector(5 downto 0) := "100101";
|
32 |
|
|
constant ID_6_SHARED : std_logic_vector(5 downto 0) := "100110";
|
33 |
|
|
constant ID_7_SHARED : std_logic_vector(5 downto 0) := "100111";
|
34 |
|
|
constant ID_8_SHARED : std_logic_vector(5 downto 0) := "101000";
|
35 |
|
|
constant ID_9_SHARED : std_logic_vector(5 downto 0) := "101001";
|
36 |
|
|
constant ID_10_SHARED : std_logic_vector(5 downto 0) := "101010";
|
37 |
|
|
constant ID_11_SHARED : std_logic_vector(5 downto 0) := "101011";
|
38 |
|
|
constant ID_12_SHARED : std_logic_vector(5 downto 0) := "101100";
|
39 |
|
|
constant ID_13_SHARED : std_logic_vector(5 downto 0) := "101101";
|
40 |
|
|
constant ID_14_SHARED : std_logic_vector(5 downto 0) := "101110";
|
41 |
|
|
constant ID_15_SHARED : std_logic_vector(5 downto 0) := "101111";
|
42 |
|
|
constant ID_16_SHARED : std_logic_vector(5 downto 0) := "110000";
|
43 |
|
|
constant ID_17_SHARED : std_logic_vector(5 downto 0) := "110001";
|
44 |
|
|
constant ID_18_SHARED : std_logic_vector(5 downto 0) := "110010";
|
45 |
|
|
constant ID_19_SHARED : std_logic_vector(5 downto 0) := "110011";
|
46 |
|
|
constant ID_20_SHARED : std_logic_vector(5 downto 0) := "110100";
|
47 |
|
|
constant ID_21_SHARED : std_logic_vector(5 downto 0) := "110101";
|
48 |
|
|
constant ID_22_SHARED : std_logic_vector(5 downto 0) := "110110";
|
49 |
|
|
constant ID_23_SHARED : std_logic_vector(5 downto 0) := "110111";
|
50 |
|
|
constant ID_24_SHARED : std_logic_vector(5 downto 0) := "111000";
|
51 |
|
|
constant ID_25_SHARED : std_logic_vector(5 downto 0) := "111001";
|
52 |
|
|
constant ID_26_SHARED : std_logic_vector(5 downto 0) := "111010";
|
53 |
|
|
constant ID_27_SHARED : std_logic_vector(5 downto 0) := "111011";
|
54 |
|
|
constant ID_28_SHARED : std_logic_vector(5 downto 0) := "111100";
|
55 |
|
|
constant ID_29_SHARED : std_logic_vector(5 downto 0) := "111101";
|
56 |
|
|
constant ID_30_SHARED : std_logic_vector(5 downto 0) := "111110";
|
57 |
|
|
constant ID_31_SHARED : std_logic_vector(5 downto 0) := "111111";
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
constant SRC_MINI_PREFIX : std_logic_vector(2 downto 0) := "000";
|
61 |
|
|
constant DST_MINI_PREFIX : std_logic_vector(2 downto 0) := "001";
|
62 |
|
|
constant LUT_SRC_MINI_PREFIX : std_logic_vector(2 downto 0) := "010";
|
63 |
|
|
constant LUT_DST_MINI_PREFIX : std_logic_vector(2 downto 0) := "011";
|
64 |
|
|
constant COUNTER_MINI_PREFIX : std_logic_vector(2 downto 0) := "100";
|
65 |
|
|
--constant MAX_NUM_PORTS_2_FIND : integer := 64;
|
66 |
|
|
type array_table is array (0 to 63) of std_logic_vector(16 downto 0);
|
67 |
|
|
|
68 |
|
|
type frame_counters_type is
|
69 |
|
|
record
|
70 |
|
|
count0 : std_logic_vector(31 downto 0);
|
71 |
|
|
count1 : std_logic_vector(31 downto 0);
|
72 |
|
|
count2 : std_logic_vector(31 downto 0);
|
73 |
|
|
count3 : std_logic_vector(31 downto 0);
|
74 |
|
|
count4 : std_logic_vector(31 downto 0);
|
75 |
|
|
count5 : std_logic_vector(31 downto 0);
|
76 |
|
|
count6 : std_logic_vector(31 downto 0);
|
77 |
|
|
count7 : std_logic_vector(31 downto 0);
|
78 |
|
|
end record;
|
79 |
|
|
|
80 |
|
|
type frame_counters_array_type is array (0 to 7) of std_logic_vector(31 downto 0);
|
81 |
|
|
|
82 |
|
|
type lut_check is
|
83 |
|
|
record
|
84 |
|
|
in_lut : boolean;
|
85 |
|
|
lut_pointer : integer range 0 to MAX_NUM_PORTS_2_FIND -1;
|
86 |
|
|
end record;
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
function check_lut (signal l : in array_table; signal m : in std_logic_vector(16 downto 0)) return lut_check;
|
92 |
|
|
|
93 |
|
|
end port_block_Constants;
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
package body port_block_Constants is
|
97 |
|
|
|
98 |
|
|
function check_lut (signal l : in array_table; signal m : in std_logic_Vector(16 downto 0)) return lut_check is
|
99 |
|
|
variable return_v : lut_check;
|
100 |
|
|
-- variable return_v : boolean;
|
101 |
|
|
-- variable return_port : integer range 0 to num_of_ports -1;
|
102 |
|
|
begin
|
103 |
|
|
for i in 0 to MAX_NUM_PORTS_2_FIND -1 loop
|
104 |
|
|
if(l(i) = m) then
|
105 |
|
|
return_v.in_lut := true;
|
106 |
|
|
return_v.lut_pointer := i;
|
107 |
|
|
exit;
|
108 |
|
|
else
|
109 |
|
|
return_v.in_lut := false;
|
110 |
|
|
return_v.lut_pointer := 0;
|
111 |
|
|
end if;
|
112 |
|
|
end loop;
|
113 |
|
|
return return_v;
|
114 |
|
|
end check_lut;
|
115 |
|
|
|
116 |
|
|
end port_block_Constants;
|