cloudFPGA (cF) API
1.0
The documentation of the source code of cloudFPGA (cF)
Return to the generic documentation of cloudFPGA
ArpCam_pkg.vhd
Go to the documentation of this file.
1
-- *******************************************************************************
2
-- * Copyright 2016 -- 2021 IBM Corporation
3
-- *
4
-- * Licensed under the Apache License, Version 2.0 (the "License");
5
-- * you may not use this file except in compliance with the License.
6
-- * You may obtain a copy of the License at
7
-- *
8
-- * http://www.apache.org/licenses/LICENSE-2.0
9
-- *
10
-- * Unless required by applicable law or agreed to in writing, software
11
-- * distributed under the License is distributed on an "AS IS" BASIS,
12
-- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-- * See the License for the specific language governing permissions and
14
-- * limitations under the License.
15
-- *******************************************************************************
16
17
-- *****************************************************************************
18
-- *
19
-- * cloudFPGA
20
-- *
21
-- *----------------------------------------------------------------------------
22
-- *
23
-- * Title : Shared package for the CAM of the ARP server.
24
-- *
25
-- * File : ArpCam_pkg.vhd
26
-- *
27
-- * Created : Feb. 2020
28
-- * Authors : Francois Abel
29
-- *
30
-- *****************************************************************************
31
32
33
--******************************************************************************
34
--** CONTEXT CLAUSE - FLASH_PKG
35
--******************************************************************************
36
library
IEEE
;
37
use
IEEE.std_logic_1164.
all
;
38
use
IEEE.numeric_std.
all
;
39
40
41
--******************************************************************************
42
--** PACKAGE DECALARATION - ARP_CAM_PKG
43
--******************************************************************************
44
package
ArpCam_pkg
is
45
46
------------------------------------------------------------------------------
47
-- CONSTANTS DEFINITION
48
------------------------------------------------------------------------------
49
50
constant
cETH_ADDR_WIDTH
:
integer
:=
48
;
-- bits
51
constant
cIP4_ADDR_WIDTH
:
integer
:=
32
;
-- bits
52
constant
cHLS_BOOL_WIDTH
:
integer
:=
8
;
-- bits
53
constant
cHLS_1BIT_WIDTH
:
integer
:=
8
;
-- bits
54
55
constant
cOPCODE_INSERT
:
std_logic
:=
'
0
'
;
56
constant
cOPCODE_DELETE
:
std_logic
:=
'
1
'
;
57
58
------------------------------------------------------------------------------
59
-- TYPES DEFINITION
60
------------------------------------------------------------------------------
61
62
--------------------------------------------------------------------
63
-- HLS-Update-Request
64
-- Format of the MAC update request generated by the HLS core
65
-- {opCode + ipKey+ macValue} = {8 + 32 + 48} = 81
66
--------------------------------------------------------------------
67
type
t_HlsUpdReq
is
68
record
69
macVal
:
std_logic_vector
(
cETH_ADDR_WIDTH
-
1
downto
0
)
;
-- [47: 0]
70
ipKey
:
std_logic_vector
(
cIP4_ADDR_WIDTH
-
1
downto
0
)
;
-- [79:48]
71
opCode
:
std_logic_vector
(
cHLS_1BIT_WIDTH
-
1
downto
0
)
;
-- [87:80]
72
end
record
;
73
74
--------------------------------------------------------------------
75
-- RTL-Update-Request
76
-- Format of the MAC update request as expected by the RTL CAM
77
-- {srcBit + opCode + macValue + ipKey} = {1 + 1 + 48 +32} = 82
78
--------------------------------------------------------------------
79
type
t_RtlUpdReq
is
80
record
81
srcBit
:
std_logic
;
-- [0]
82
opCode
:
std_logic
;
-- [1]
83
macVal
:
std_logic_vector
(
cETH_ADDR_WIDTH
-
1
downto
0
)
;
-- [49: 2]
84
ipKey
:
std_logic_vector
(
cIP4_ADDR_WIDTH
-
1
downto
0
)
;
-- [81:50]
85
end
record
;
86
87
--------------------------------------------------------------------
88
-- HLS-Update-Reply
89
-- Format of the MAC update reply expected by the HLS core
90
-- {opCode + macValue} = {8 + 48} = 56
91
--------------------------------------------------------------------
92
type
t_HlsUpdRep
is
93
record
94
macVal
:
std_logic_vector
(
cETH_ADDR_WIDTH
-
1
downto
0
)
;
-- [47: 0]
95
opCode
:
std_logic_vector
(
cHLS_1BIT_WIDTH
-
1
downto
0
)
;
-- [55:48]
96
end
record
;
97
98
--------------------------------------------------------------------
99
-- RTL-Update-Reply
100
-- Format of the MAC update reply generated by the RTL CAM
101
-- {opCode + macValue} = {8 + 48} = 56
102
--------------------------------------------------------------------
103
type
t_RtlUpdRep
is
104
record
105
srcBit
:
std_logic
;
-- [0]
106
opCode
:
std_logic
;
-- [1]
107
macVal
:
std_logic_vector
(
cETH_ADDR_WIDTH
-
1
downto
0
)
;
-- [49: 2]
108
end
record
;
109
110
--------------------------------------------------------------------
111
-- HLS-Lookup-Request
112
-- Format of the MAC lookup request generated by the HLS core
113
-- {ipKey} = {32} = 32
114
--------------------------------------------------------------------
115
type
t_HlsLkpReq
is
116
record
117
ipKey
:
std_logic_vector
(
cIP4_ADDR_WIDTH
-
1
downto
0
)
;
-- [31: 0]
118
end
record
;
119
120
--------------------------------------------------------------------
121
-- RTL-Lookup-Request
122
-- Format of the MAC update request as expected by the RTL CAM
123
-- {srcBit + ipKey} = {1 + 32} = 33
124
--------------------------------------------------------------------
125
type
t_RtlLkpReq
is
126
record
127
srcBit
:
std_logic
;
-- [0]
128
ipKey
:
std_logic_vector
(
cIP4_ADDR_WIDTH
-
1
downto
0
)
;
-- [32: 1]
129
end
record
;
130
131
--------------------------------------------------------------------
132
-- HLS-Lookup-Reply
133
-- Format of the MAC lookup reply expected by the HLS core
134
-- {opCode + macValue} = {8 + 48} = 56
135
--------------------------------------------------------------------
136
type
t_HlsLkpRep
is
137
record
138
macVal
:
std_logic_vector
(
cETH_ADDR_WIDTH
-
1
downto
0
)
;
-- [47: 0]
139
hitBit
:
std_logic
;
-- [48]
140
end
record
;
141
142
--------------------------------------------------------------------
143
-- RTL-Lookup-Reply
144
-- Format of the MAC lookup reply generated by the RTL CAM
145
-- {opCode + macValue} = {8 + 48} = 56
146
--------------------------------------------------------------------
147
type
t_RtlLkpRep
is
148
record
149
srcBit
:
std_logic
;
-- [0]
150
hitBit
:
std_logic
;
-- [1]
151
macVal
:
std_logic_vector
(
cETH_ADDR_WIDTH
-
1
downto
0
)
;
-- [49: 2]
152
end
record
;
153
154
155
----------------------------------------------------------------------------
156
-- FUNCTIONS DECLARATION
157
----------------------------------------------------------------------------
158
159
---------------------------------------
160
-- Logarithmic Function (with ceiling)
161
---------------------------------------
162
function
fLog2Ceil (n :
integer
)
163
return
integer
;
164
165
166
end
ArpCam_pkg;
167
168
169
170
--******************************************************************************
171
--** PACKAGE BODY - ARP_CAM_PKG
172
--******************************************************************************
173
package
body
_ArpCam_pkg
is
174
175
-------------------------------------
176
-- Function fLog2Ceil()
177
-- Purpose: computes ceil(log2(n))
178
-------------------------------------
179
function
fLog2Ceil (n :
integer
)
return
integer
is
180
variable
m, p :
integer
;
181
begin
182
m :=
0
;
183
p :=
1
;
184
for
i
in
0
to
n
loop
185
if
p < n
then
186
m := m +
1
;
187
p := p *
2
;
188
end
if
;
189
end
loop
;
190
return
m;
191
end
fLog2Ceil;
192
193
end
ArpCam_pkg;
194
195
196
repos_for_Dox
cFDK
SRA
LIB
SHELL
LIB
hdl
nts
ArpCam_pkg.vhd
Generated on Sat Jul 15 2023 05:02:58 for cloudFPGA (cF) API by
1.9.1