Fletchgen
The Fletcher Design Generator
src
fletchgen
top
axi_template.h
1
// Copyright 2018-2019 Delft University of Technology
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#pragma once
16
17
namespace
fletchgen::top {
18
19
// TODO(johanpel): Insert this template through resource linking.
21
static
char
axi_source[] =
22
"-- Copyright 2018-2019 Delft University of Technology\n"
23
"--\n"
24
"-- Licensed under the Apache License, Version 2.0 (the \"License\");\n"
25
"-- you may not use this file except in compliance with the License.\n"
26
"-- You may obtain a copy of the License at\n"
27
"--\n"
28
"-- http://www.apache.org/licenses/LICENSE-2.0\n"
29
"--\n"
30
"-- Unless required by applicable law or agreed to in writing, software\n"
31
"-- distributed under the License is distributed on an \"AS IS\" BASIS,\n"
32
"-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
33
"-- See the License for the specific language governing permissions and\n"
34
"-- limitations under the License.\n"
35
"\n"
36
"library ieee;\n"
37
"use ieee.std_logic_1164.all;\n"
38
"use ieee.numeric_std.all;\n"
39
"use ieee.std_logic_misc.all;\n"
40
"\n"
41
"library work;\n"
42
"use work.Axi_pkg.all;\n"
43
"use work.UtilInt_pkg.all;\n"
44
"use work.UtilConv_pkg.all;\n"
45
"use work.UtilMisc_pkg.all;\n"
46
"\n"
47
"-------------------------------------------------------------------------------\n"
48
"-- AXI4 compatible top level for Fletcher generated accelerators.\n"
49
"-------------------------------------------------------------------------------\n"
50
"-- Requires an AXI4 port to host memory.\n"
51
"-- Requires an AXI4-lite port from host for MMIO.\n"
52
"-------------------------------------------------------------------------------\n"
53
"entity AxiTop is\n"
54
" generic (\n"
55
" -- Accelerator properties\n"
56
" INDEX_WIDTH : natural := 32;\n"
57
" REG_WIDTH : natural := 32;\n"
58
" TAG_WIDTH : natural := 1;\n"
59
" -- AXI4 (full) bus properties for memory access.\n"
60
" BUS_ADDR_WIDTH : natural := ${BUS_ADDR_WIDTH};\n"
61
" BUS_DATA_WIDTH : natural := ${BUS_DATA_WIDTH};\n"
62
" BUS_LEN_WIDTH : natural := ${BUS_LEN_WIDTH};\n"
63
" BUS_BURST_MAX_LEN : natural := ${BUS_BURST_MAX_LEN};\n"
64
" BUS_BURST_STEP_LEN : natural := ${BUS_BURST_STEP_LEN}\n"
65
" );\n"
66
"\n"
67
" port (\n"
68
" -- Kernel clock domain.\n"
69
" kcd_clk : in std_logic;\n"
70
" kcd_reset : in std_logic;\n"
71
" \n"
72
" -- Bus clock domain.\n"
73
" bcd_clk : in std_logic;\n"
74
" bcd_reset : in std_logic;\n"
75
"\n"
76
" ---------------------------------------------------------------------------\n"
77
" -- External signals\n"
78
" ---------------------------------------------------------------------------\n"
79
"${EXTERNAL_PORT_DECL}\n"
80
" ---------------------------------------------------------------------------\n"
81
" -- AXI4 master as Host Memory Interface\n"
82
" ---------------------------------------------------------------------------\n"
83
" -- Read address channel\n"
84
" m_axi_araddr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);\n"
85
" m_axi_arlen : out std_logic_vector(BUS_LEN_WIDTH-1 downto 0);\n"
86
" m_axi_arvalid : out std_logic := '0';\n"
87
" m_axi_arready : in std_logic;\n"
88
" m_axi_arsize : out std_logic_vector(2 downto 0);\n"
89
"\n"
90
" -- Read data channel\n"
91
" m_axi_rdata : in std_logic_vector(BUS_DATA_WIDTH-1 downto 0);\n"
92
" m_axi_rresp : in std_logic_vector(1 downto 0);\n"
93
" m_axi_rlast : in std_logic;\n"
94
" m_axi_rvalid : in std_logic;\n"
95
" m_axi_rready : out std_logic := '0';\n"
96
"\n"
97
" -- Write address channel\n"
98
" m_axi_awvalid : out std_logic := '0';\n"
99
" m_axi_awready : in std_logic;\n"
100
" m_axi_awaddr : out std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);\n"
101
" m_axi_awlen : out std_logic_vector(BUS_LEN_WIDTH-1 downto 0);\n"
102
" m_axi_awsize : out std_logic_vector(2 downto 0);\n"
103
" m_axi_awuser : out std_logic_vector(0 downto 0);\n"
104
"\n"
105
" -- Write data channel\n"
106
" m_axi_wvalid : out std_logic := '0';\n"
107
" m_axi_wready : in std_logic;\n"
108
" m_axi_wdata : out std_logic_vector(BUS_DATA_WIDTH-1 downto 0);\n"
109
" m_axi_wlast : out std_logic;\n"
110
" m_axi_wstrb : out std_logic_vector(BUS_DATA_WIDTH/8-1 downto 0);\n"
111
"\n"
112
" -- Write response channel\n"
113
" m_axi_bvalid : in std_logic;\n"
114
" m_axi_bready : out std_logic;\n"
115
" m_axi_bresp : in std_logic_vector(1 downto 0);\n"
116
" ---------------------------------------------------------------------------\n"
117
" -- AXI4-lite Slave as MMIO interface\n"
118
" ---------------------------------------------------------------------------\n"
119
" -- Write address channel\n"
120
" s_axi_awvalid : in std_logic;\n"
121
" s_axi_awready : out std_logic;\n"
122
" s_axi_awaddr : in std_logic_vector(${MMIO_ADDR_WIDTH}-1 downto 0);\n"
123
"\n"
124
" -- Write data channel\n"
125
" s_axi_wvalid : in std_logic;\n"
126
" s_axi_wready : out std_logic;\n"
127
" s_axi_wdata : in std_logic_vector(${MMIO_DATA_WIDTH}-1 downto 0);\n"
128
" s_axi_wstrb : in std_logic_vector((${MMIO_DATA_WIDTH}/8)-1 downto 0);\n"
129
"\n"
130
" -- Write response channel\n"
131
" s_axi_bvalid : out std_logic;\n"
132
" s_axi_bready : in std_logic;\n"
133
" s_axi_bresp : out std_logic_vector(1 downto 0);\n"
134
"\n"
135
" -- Read address channel\n"
136
" s_axi_arvalid : in std_logic;\n"
137
" s_axi_arready : out std_logic;\n"
138
" s_axi_araddr : in std_logic_vector(${MMIO_ADDR_WIDTH}-1 downto 0);\n"
139
"\n"
140
" -- Read data channel\n"
141
" s_axi_rvalid : out std_logic;\n"
142
" s_axi_rready : in std_logic;\n"
143
" s_axi_rdata : out std_logic_vector(${MMIO_DATA_WIDTH}-1 downto 0);\n"
144
" s_axi_rresp : out std_logic_vector(1 downto 0)\n"
145
" );\n"
146
"end AxiTop;\n"
147
"\n"
148
"architecture Behavorial of AxiTop is\n"
149
"\n"
150
" -----------------------------------------------------------------------------\n"
151
" -- Generated top-level wrapper component.\n"
152
" -----------------------------------------------------------------------------\n"
153
" ${MANTLE_DECL}"
154
" -----------------------------------------------------------------------------\n"
155
" -- Internal signals. \n"
156
" \n"
157
" -- Active low reset for bus clock domain\n"
158
" signal bcd_reset_n : std_logic;\n"
159
" \n"
160
" -- Bus signals to convert to AXI.\n"
161
" signal rd_mst_rreq_addr : std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);\n"
162
" signal rd_mst_rreq_len : std_logic_vector(BUS_LEN_WIDTH-1 downto 0);\n"
163
" signal rd_mst_rreq_valid : std_logic;\n"
164
" signal rd_mst_rreq_ready : std_logic;\n"
165
" signal rd_mst_rdat_data : std_logic_vector(BUS_DATA_WIDTH-1 downto 0);\n"
166
" signal rd_mst_rdat_last : std_logic;\n"
167
" signal rd_mst_rdat_valid : std_logic;\n"
168
" signal rd_mst_rdat_ready : std_logic;\n"
169
" signal wr_mst_wreq_valid : std_logic;\n"
170
" signal wr_mst_wreq_ready : std_logic;\n"
171
" signal wr_mst_wreq_addr : std_logic_vector(BUS_ADDR_WIDTH-1 downto 0);\n"
172
" signal wr_mst_wreq_len : std_logic_vector(BUS_LEN_WIDTH-1 downto 0);\n"
173
" signal wr_mst_wreq_last : std_logic;\n"
174
" signal wr_mst_wdat_valid : std_logic;\n"
175
" signal wr_mst_wdat_ready : std_logic;\n"
176
" signal wr_mst_wdat_data : std_logic_vector(BUS_DATA_WIDTH-1 downto 0);\n"
177
" signal wr_mst_wdat_strobe : std_logic_vector(BUS_DATA_WIDTH/8-1 downto 0);\n"
178
" signal wr_mst_wdat_last : std_logic;\n"
179
" signal wr_mst_wrep_valid : std_logic;\n"
180
" signal wr_mst_wrep_ready : std_logic;\n"
181
" signal wr_mst_wrep_ok : std_logic;\n"
182
"\n"
183
"begin\n"
184
"\n"
185
" -- Active low reset\n"
186
" bcd_reset_n <= not bcd_reset;\n"
187
"\n"
188
" -----------------------------------------------------------------------------\n"
189
" -- Fletcher generated wrapper\n"
190
" -----------------------------------------------------------------------------\n"
191
" ${FLETCHER_WRAPPER_INST_NAME} : ${FLETCHER_WRAPPER_NAME}\n"
192
" generic map (\n"
193
" BUS_ADDR_WIDTH => BUS_ADDR_WIDTH,\n"
194
" BUS_DATA_WIDTH => BUS_DATA_WIDTH,\n"
195
" BUS_BURST_STEP_LEN => BUS_BURST_STEP_LEN,\n"
196
" BUS_BURST_MAX_LEN => BUS_BURST_MAX_LEN,\n"
197
" BUS_LEN_WIDTH => BUS_LEN_WIDTH,\n"
198
" INDEX_WIDTH => INDEX_WIDTH,\n"
199
" TAG_WIDTH => TAG_WIDTH\n"
200
" )\n"
201
" port map (\n"
202
" kcd_clk => kcd_clk,\n"
203
" kcd_reset => kcd_reset,\n"
204
" bcd_clk => bcd_clk,\n"
205
" bcd_reset => bcd_reset,\n"
206
"${EXTERNAL_INST_MAP}\n"
207
"${MST_RREQ_INSTANTIATE}\n"
208
"${MST_WREQ_INSTANTIATE}\n"
209
" mmio_awvalid => s_axi_awvalid,\n"
210
" mmio_awready => s_axi_awready,\n"
211
" mmio_awaddr => s_axi_awaddr,\n"
212
" mmio_wvalid => s_axi_wvalid,\n"
213
" mmio_wready => s_axi_wready,\n"
214
" mmio_wdata => s_axi_wdata,\n"
215
" mmio_wstrb => s_axi_wstrb,\n"
216
" mmio_bvalid => s_axi_bvalid,\n"
217
" mmio_bready => s_axi_bready,\n"
218
" mmio_bresp => s_axi_bresp,\n"
219
" mmio_arvalid => s_axi_arvalid,\n"
220
" mmio_arready => s_axi_arready,\n"
221
" mmio_araddr => s_axi_araddr,\n"
222
" mmio_rvalid => s_axi_rvalid,\n"
223
" mmio_rready => s_axi_rready,\n"
224
" mmio_rdata => s_axi_rdata,\n"
225
" mmio_rresp => s_axi_rresp\n"
226
" );\n"
227
"\n"
228
"${AXI_READ_CONVERTER}\n"
229
"${AXI_WRITE_CONVERTER}\n"
230
"\n"
231
"end architecture;"
;
232
233
}
// namespace fletchgen::top
Generated by
1.9.1