1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Title : Package for constants
|
3 |
|
|
-- Project : UDP2HIBI
|
4 |
|
|
-------------------------------------------------------------------------------
|
5 |
|
|
-- File : udp2hibi_pkg.vhd
|
6 |
|
|
-- Author : Jussi Nieminen
|
7 |
|
|
-- Last update: 2012-03-22
|
8 |
|
|
-- Platform :
|
9 |
|
|
-------------------------------------------------------------------------------
|
10 |
|
|
-- Description: (see the title...)
|
11 |
|
|
-------------------------------------------------------------------------------
|
12 |
|
|
-- Revisions :
|
13 |
|
|
-- Date Version Author Description
|
14 |
|
|
-- 2009/12/02 1.0 niemin95 Created
|
15 |
|
|
-------------------------------------------------------------------------------
|
16 |
|
|
|
17 |
|
|
library ieee;
|
18 |
|
|
use ieee.std_logic_1164.all;
|
19 |
|
|
|
20 |
|
|
package udp2hibi_pkg is
|
21 |
|
|
|
22 |
|
|
-- **************************************
|
23 |
|
|
-- * udp2hibi headers and conf packets: *
|
24 |
|
|
-- **************************************
|
25 |
|
|
|
26 |
|
|
constant id_hi_idx_c : integer := 31;
|
27 |
|
|
constant id_lo_idx_c : integer := 28;
|
28 |
|
|
|
29 |
|
|
-- tx configuration:
|
30 |
|
|
-----------------------------------------------------------------------------
|
31 |
|
|
-- 31_28,27___________________________0
|
32 |
|
|
-- |0x0 | 28 bits: timeout value |
|
33 |
|
|
|
34 |
|
|
-- 31_________________________________0
|
35 |
|
|
-- | 32 bits: destination IP |
|
36 |
|
|
|
37 |
|
|
-- 31_____________16,15_______________0
|
38 |
|
|
-- | 16b: dest port | 16b: source port |
|
39 |
|
|
|
40 |
|
|
-- 31_________________________________0
|
41 |
|
|
-- | 32 bits: sender's hibi addr |
|
42 |
|
|
|
43 |
|
|
constant tx_conf_header_id_c : std_logic_vector( 3 downto 0 ) := x"0";
|
44 |
|
|
constant timeout_w_c : integer := 28;
|
45 |
|
|
-----------------------------------------------------------------------------
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
-- tx data:
|
49 |
|
|
-----------------------------------------------------------------------------
|
50 |
|
|
-- 31_28,27________17,16______________0
|
51 |
|
|
-- |0x1 | 11b:tx_len | 17b:don't care |
|
52 |
|
|
|
53 |
|
|
-- 31_____24,23____17,16_____8,7______0
|
54 |
|
|
-- | byte 3 | byte 2 | byte 1 | byte 0 |
|
55 |
|
|
|
56 |
|
|
-- etc...
|
57 |
|
|
|
58 |
|
|
constant tx_data_header_id_c : std_logic_vector( 3 downto 0 ) := x"1";
|
59 |
|
|
constant tx_len_w_c : integer := 11;
|
60 |
|
|
-----------------------------------------------------------------------------
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
-- tx release:
|
64 |
|
|
-----------------------------------------------------------------------------
|
65 |
|
|
-- 31_28,27___________________________0
|
66 |
|
|
-- |0x2 | 28 bits: don't care |
|
67 |
|
|
|
68 |
|
|
constant tx_release_header_id_c : std_logic_vector( 3 downto 0 ) := x"2";
|
69 |
|
|
-----------------------------------------------------------------------------
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
-- rx configuration:
|
73 |
|
|
-----------------------------------------------------------------------------
|
74 |
|
|
-- 31_28,27___________________________0
|
75 |
|
|
-- |0x3 | 28 bits: don't care |
|
76 |
|
|
|
77 |
|
|
-- 31_________________________________0
|
78 |
|
|
-- | 32 bits: source IP |
|
79 |
|
|
|
80 |
|
|
-- 31_____________16,15_______________0
|
81 |
|
|
-- | 16b: dest port | 16b: source port |
|
82 |
|
|
|
83 |
|
|
-- 31_________________________________0
|
84 |
|
|
-- | 32 bits: dest hibi addr |
|
85 |
|
|
|
86 |
|
|
constant rx_conf_header_id_c : std_logic_vector( 3 downto 0 ) := x"3";
|
87 |
|
|
-----------------------------------------------------------------------------
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
-- rx data:
|
91 |
|
|
-----------------------------------------------------------------------------
|
92 |
|
|
-- 31_28,27________17,16______________0
|
93 |
|
|
-- |0x4 | 11b:rx_len | 17b:don't care |
|
94 |
|
|
|
95 |
|
|
-- 31_____24,23____17,16_____8,7______0
|
96 |
|
|
-- | byte 3 | byte 2 | byte 1 | byte 0 |
|
97 |
|
|
|
98 |
|
|
-- etc...
|
99 |
|
|
|
100 |
|
|
constant rx_data_header_id_c : std_logic_vector( 3 downto 0 ) := x"4";
|
101 |
|
|
-----------------------------------------------------------------------------
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
-- ack:
|
105 |
|
|
-----------------------------------------------------------------------------
|
106 |
|
|
-- 31_28,27,26________________________0
|
107 |
|
|
-- |0x5 |?x| 27 bits: don't care |
|
108 |
|
|
|
109 |
|
|
-- if bit 27 = '1': tx configuration ack, else rx conf ack
|
110 |
|
|
|
111 |
|
|
constant ack_header_id_c : std_logic_vector( 3 downto 0 ) := x"5";
|
112 |
|
|
constant tx_conf_ack_id_c : std_logic := '1';
|
113 |
|
|
constant rx_conf_ack_id_c : std_logic := '0';
|
114 |
|
|
-----------------------------------------------------------------------------
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
-- nack:
|
118 |
|
|
-----------------------------------------------------------------------------
|
119 |
|
|
-- 31_28,27,26________________________0
|
120 |
|
|
-- |0x6 |?x| 27 bits: don't care |
|
121 |
|
|
|
122 |
|
|
-- if bit 27 = '1': tx configuration nack, else rx conf nack
|
123 |
|
|
|
124 |
|
|
constant nack_header_id_c : std_logic_vector( 3 downto 0 ) := x"6";
|
125 |
|
|
-----------------------------------------------------------------------------
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
-- **************************************************************************
|
129 |
|
|
|
130 |
|
|
-- just to avoid plain literals:
|
131 |
|
|
constant ip_addr_w_c : integer := 32; -- bits
|
132 |
|
|
constant udp_port_w_c : integer := 16; -- bits
|
133 |
|
|
constant udp_block_data_w_c : integer := 16; -- bits
|
134 |
|
|
constant udp_block_freq_c : integer := 25000000; --1/s, 25MHz
|
135 |
|
|
|
136 |
|
|
end udp2hibi_pkg;
|