1 |
5 |
sergeykhbr |
-----------------------------------------------------------------------------
|
2 |
|
|
--! @file
|
3 |
|
|
--! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
|
4 |
|
|
--! @author Sergey Khabarov - sergeykhbr@gmail.com
|
5 |
|
|
--! @brief RockeTile top level.
|
6 |
|
|
--! @details RISC-V "RocketTile" without Uncore subsystem.
|
7 |
|
|
------------------------------------------------------------------------------
|
8 |
|
|
--! Standard library
|
9 |
|
|
library IEEE;
|
10 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
11 |
|
|
|
12 |
|
|
--! Data transformation and math functions library
|
13 |
|
|
library commonlib;
|
14 |
|
|
use commonlib.types_common.all;
|
15 |
|
|
|
16 |
|
|
--! Technology definition library.
|
17 |
|
|
library techmap;
|
18 |
|
|
--! Technology constants definition.
|
19 |
|
|
use techmap.gencomp.all;
|
20 |
|
|
--! AMBA system bus specific library.
|
21 |
|
|
library ambalib;
|
22 |
|
|
--! AXI4 configuration constants.
|
23 |
|
|
use ambalib.types_amba4.all;
|
24 |
|
|
--! Rocket-chip specific library
|
25 |
|
|
library rocketlib;
|
26 |
|
|
--! TileLink interface description.
|
27 |
|
|
use rocketlib.types_rocket.all;
|
28 |
|
|
library work;
|
29 |
|
|
use work.all;
|
30 |
|
|
|
31 |
|
|
--! @brief RocketTile entity declaration.
|
32 |
|
|
--! @details This module implements Risc-V Core with L1-cache,
|
33 |
|
|
--! branch predictor and other stuffs of the RocketTile.
|
34 |
|
|
entity rocket_l1only is
|
35 |
|
|
generic (
|
36 |
|
|
hartid : integer := 0;
|
37 |
|
|
reset_vector : integer := 16#1000#
|
38 |
|
|
);
|
39 |
|
|
port (
|
40 |
|
|
nrst : in std_logic;
|
41 |
|
|
clk_sys : in std_logic;
|
42 |
|
|
msti1 : in nasti_master_in_type;
|
43 |
|
|
msto1 : out nasti_master_out_type;
|
44 |
|
|
mstcfg1 : out nasti_master_config_type;
|
45 |
|
|
msti2 : in nasti_master_in_type;
|
46 |
|
|
msto2 : out nasti_master_out_type;
|
47 |
|
|
mstcfg2 : out nasti_master_config_type;
|
48 |
|
|
interrupts : in std_logic_vector(CFG_CORE_IRQ_TOTAL-1 downto 0)
|
49 |
|
|
);
|
50 |
|
|
--! @}
|
51 |
|
|
|
52 |
|
|
end;
|
53 |
|
|
|
54 |
|
|
--! @brief SOC top-level architecture declaration.
|
55 |
|
|
architecture arch_rocket_l1only of rocket_l1only is
|
56 |
|
|
|
57 |
|
|
constant CFG_HARTID : std_logic_vector(63 downto 0) := conv_std_logic_vector(hartid, 64);
|
58 |
|
|
constant CFG_RESET_VECTOR : std_logic_vector(63 downto 0) := conv_std_logic_vector(reset_vector, 64);
|
59 |
|
|
|
60 |
|
|
constant xmstconfig1 : nasti_master_config_type := (
|
61 |
|
|
descrsize => PNP_CFG_MASTER_DESCR_BYTES,
|
62 |
|
|
descrtype => PNP_CFG_TYPE_MASTER,
|
63 |
|
|
vid => VENDOR_GNSSSENSOR,
|
64 |
|
|
did => RISCV_CACHED_TILELINK
|
65 |
|
|
);
|
66 |
|
|
|
67 |
|
|
constant xmstconfig2 : nasti_master_config_type := (
|
68 |
|
|
descrsize => PNP_CFG_MASTER_DESCR_BYTES,
|
69 |
|
|
descrtype => PNP_CFG_TYPE_MASTER,
|
70 |
|
|
vid => VENDOR_GNSSSENSOR,
|
71 |
|
|
did => RISCV_UNCACHED_TILELINK
|
72 |
|
|
);
|
73 |
|
|
|
74 |
|
|
signal cpu_rst : std_logic;
|
75 |
|
|
|
76 |
|
|
signal cto : tile_out_type;
|
77 |
|
|
signal cti : tile_in_type;
|
78 |
|
|
|
79 |
|
|
signal uto : tile_out_type;
|
80 |
|
|
signal uti : tile_in_type;
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
component AxiBridge is port (
|
84 |
|
|
clk : in std_logic;
|
85 |
|
|
nrst : in std_logic;
|
86 |
|
|
|
87 |
|
|
--! Tile-to-AXI direction
|
88 |
|
|
tloi : in tile_out_type;
|
89 |
|
|
msto : out nasti_master_out_type;
|
90 |
|
|
--! AXI-to-Tile direction
|
91 |
|
|
msti : in nasti_master_in_type;
|
92 |
|
|
tlio : out tile_in_type
|
93 |
|
|
);
|
94 |
|
|
end component;
|
95 |
|
|
|
96 |
|
|
component Tile2Axi is port (
|
97 |
|
|
clk : in std_logic;
|
98 |
|
|
nrst : in std_logic;
|
99 |
|
|
|
100 |
|
|
--! Tile-to-AXI direction
|
101 |
|
|
tloi : in tile_out_type;
|
102 |
|
|
msto : out nasti_master_out_type;
|
103 |
|
|
--! AXI-to-Tile direction
|
104 |
|
|
msti : in nasti_master_in_type;
|
105 |
|
|
tlio : out tile_in_type
|
106 |
|
|
);
|
107 |
|
|
end component;
|
108 |
|
|
|
109 |
|
|
COMPONENT RocketTile
|
110 |
|
|
PORT(
|
111 |
|
|
clock : IN std_logic;
|
112 |
|
|
reset : IN std_logic;
|
113 |
|
|
io_cached_0_a_ready : IN std_logic;
|
114 |
|
|
io_cached_0_a_valid : OUT std_logic;
|
115 |
|
|
io_cached_0_a_bits_opcode : OUT std_logic_vector(2 downto 0);
|
116 |
|
|
io_cached_0_a_bits_param : OUT std_logic_vector(2 downto 0);
|
117 |
|
|
io_cached_0_a_bits_size : OUT std_logic_vector(3 downto 0);
|
118 |
|
|
io_cached_0_a_bits_source : OUT std_logic_vector(1 downto 0);
|
119 |
|
|
io_cached_0_a_bits_address : OUT std_logic_vector(31 downto 0);
|
120 |
|
|
io_cached_0_a_bits_mask : OUT std_logic_vector(7 downto 0);
|
121 |
|
|
io_cached_0_a_bits_data : OUT std_logic_vector(63 downto 0);
|
122 |
|
|
io_cached_0_b_ready : OUT std_logic;
|
123 |
|
|
io_cached_0_b_valid : IN std_logic;
|
124 |
|
|
io_cached_0_b_bits_opcode : IN std_logic_vector(2 downto 0);
|
125 |
|
|
io_cached_0_b_bits_param : IN std_logic_vector(1 downto 0);
|
126 |
|
|
io_cached_0_b_bits_size : IN std_logic_vector(3 downto 0);
|
127 |
|
|
io_cached_0_b_bits_source : IN std_logic_vector(1 downto 0);
|
128 |
|
|
io_cached_0_b_bits_address : IN std_logic_vector(31 downto 0);
|
129 |
|
|
io_cached_0_b_bits_mask : IN std_logic_vector(7 downto 0);
|
130 |
|
|
io_cached_0_b_bits_data : IN std_logic_vector(63 downto 0);
|
131 |
|
|
io_cached_0_c_ready : IN std_logic;
|
132 |
|
|
io_cached_0_c_valid : OUT std_logic;
|
133 |
|
|
io_cached_0_c_bits_opcode : OUT std_logic_vector(2 downto 0);
|
134 |
|
|
io_cached_0_c_bits_param : OUT std_logic_vector(2 downto 0);
|
135 |
|
|
io_cached_0_c_bits_size : OUT std_logic_vector(3 downto 0);
|
136 |
|
|
io_cached_0_c_bits_source : OUT std_logic_vector(1 downto 0);
|
137 |
|
|
io_cached_0_c_bits_address : OUT std_logic_vector(31 downto 0);
|
138 |
|
|
io_cached_0_c_bits_data : OUT std_logic_vector(63 downto 0);
|
139 |
|
|
io_cached_0_c_bits_error : OUT std_logic;
|
140 |
|
|
io_cached_0_d_ready : OUT std_logic;
|
141 |
|
|
io_cached_0_d_valid : IN std_logic;
|
142 |
|
|
io_cached_0_d_bits_opcode : IN std_logic_vector(2 downto 0);
|
143 |
|
|
io_cached_0_d_bits_param : IN std_logic_vector(1 downto 0);
|
144 |
|
|
io_cached_0_d_bits_size : IN std_logic_vector(3 downto 0);
|
145 |
|
|
io_cached_0_d_bits_source : IN std_logic_vector(1 downto 0);
|
146 |
|
|
io_cached_0_d_bits_sink : IN std_logic_vector(3 downto 0);
|
147 |
|
|
io_cached_0_d_bits_addr_lo : IN std_logic_vector(2 downto 0);
|
148 |
|
|
io_cached_0_d_bits_data : IN std_logic_vector(63 downto 0);
|
149 |
|
|
io_cached_0_d_bits_error : IN std_logic;
|
150 |
|
|
io_cached_0_e_ready : IN std_logic;
|
151 |
|
|
io_cached_0_e_valid : OUT std_logic;
|
152 |
|
|
io_cached_0_e_bits_sink : OUT std_logic_vector(3 downto 0);
|
153 |
|
|
io_uncached_0_a_ready : IN std_logic;
|
154 |
|
|
io_uncached_0_a_valid : OUT std_logic;
|
155 |
|
|
io_uncached_0_a_bits_opcode : OUT std_logic_vector(2 downto 0);
|
156 |
|
|
io_uncached_0_a_bits_param : OUT std_logic_vector(2 downto 0);
|
157 |
|
|
io_uncached_0_a_bits_size : OUT std_logic_vector(3 downto 0);
|
158 |
|
|
io_uncached_0_a_bits_source : OUT std_logic_vector(2 downto 0);
|
159 |
|
|
io_uncached_0_a_bits_address : OUT std_logic_vector(31 downto 0);
|
160 |
|
|
io_uncached_0_a_bits_mask : OUT std_logic_vector(7 downto 0);
|
161 |
|
|
io_uncached_0_a_bits_data : OUT std_logic_vector(63 downto 0);
|
162 |
|
|
io_uncached_0_b_ready : OUT std_logic;
|
163 |
|
|
io_uncached_0_b_valid : IN std_logic;
|
164 |
|
|
io_uncached_0_b_bits_opcode : IN std_logic_vector(2 downto 0);
|
165 |
|
|
io_uncached_0_b_bits_param : IN std_logic_vector(1 downto 0);
|
166 |
|
|
io_uncached_0_b_bits_size : IN std_logic_vector(3 downto 0);
|
167 |
|
|
io_uncached_0_b_bits_source : IN std_logic_vector(2 downto 0);
|
168 |
|
|
io_uncached_0_b_bits_address : IN std_logic_vector(31 downto 0);
|
169 |
|
|
io_uncached_0_b_bits_mask : IN std_logic_vector(7 downto 0);
|
170 |
|
|
io_uncached_0_b_bits_data : IN std_logic_vector(63 downto 0);
|
171 |
|
|
io_uncached_0_c_ready : IN std_logic;
|
172 |
|
|
io_uncached_0_c_valid : OUT std_logic;
|
173 |
|
|
io_uncached_0_c_bits_opcode : OUT std_logic_vector(2 downto 0);
|
174 |
|
|
io_uncached_0_c_bits_param : OUT std_logic_vector(2 downto 0);
|
175 |
|
|
io_uncached_0_c_bits_size : OUT std_logic_vector(3 downto 0);
|
176 |
|
|
io_uncached_0_c_bits_source : OUT std_logic_vector(2 downto 0);
|
177 |
|
|
io_uncached_0_c_bits_address : OUT std_logic_vector(31 downto 0);
|
178 |
|
|
io_uncached_0_c_bits_data : OUT std_logic_vector(63 downto 0);
|
179 |
|
|
io_uncached_0_c_bits_error : OUT std_logic;
|
180 |
|
|
io_uncached_0_d_ready : OUT std_logic;
|
181 |
|
|
io_uncached_0_d_valid : IN std_logic;
|
182 |
|
|
io_uncached_0_d_bits_opcode : IN std_logic_vector(2 downto 0);
|
183 |
|
|
io_uncached_0_d_bits_param : IN std_logic_vector(1 downto 0);
|
184 |
|
|
io_uncached_0_d_bits_size : IN std_logic_vector(3 downto 0);
|
185 |
|
|
io_uncached_0_d_bits_source : IN std_logic_vector(2 downto 0);
|
186 |
|
|
io_uncached_0_d_bits_sink : IN std_logic_vector(3 downto 0);
|
187 |
|
|
io_uncached_0_d_bits_addr_lo : IN std_logic_vector(2 downto 0);
|
188 |
|
|
io_uncached_0_d_bits_data : IN std_logic_vector(63 downto 0);
|
189 |
|
|
io_uncached_0_d_bits_error : IN std_logic;
|
190 |
|
|
io_uncached_0_e_ready : IN std_logic;
|
191 |
|
|
io_uncached_0_e_valid : OUT std_logic;
|
192 |
|
|
io_uncached_0_e_bits_sink : OUT std_logic_vector(3 downto 0);
|
193 |
|
|
io_hartid : IN std_logic_vector(63 downto 0);
|
194 |
|
|
io_interrupts_debug : IN std_logic;
|
195 |
|
|
io_interrupts_mtip : IN std_logic;
|
196 |
|
|
io_interrupts_msip : IN std_logic;
|
197 |
|
|
io_interrupts_meip : IN std_logic;
|
198 |
|
|
io_interrupts_seip : IN std_logic;
|
199 |
|
|
io_resetVector : IN std_logic_vector(63 downto 0)
|
200 |
|
|
);
|
201 |
|
|
END COMPONENT;
|
202 |
|
|
|
203 |
|
|
begin
|
204 |
|
|
|
205 |
|
|
mstcfg1 <= xmstconfig1;
|
206 |
|
|
mstcfg2 <= xmstconfig2;
|
207 |
|
|
cpu_rst <= not nrst;
|
208 |
|
|
|
209 |
|
|
cto.a_source(2) <= '0';
|
210 |
|
|
cti.b_source(2) <= '0';
|
211 |
|
|
cto.c_source(2) <= '0';
|
212 |
|
|
cti.d_source(2) <= '0';
|
213 |
|
|
|
214 |
|
|
inst_tile: RocketTile PORT MAP(
|
215 |
|
|
clock => clk_sys,
|
216 |
|
|
reset => cpu_rst,
|
217 |
|
|
|
218 |
|
|
io_cached_0_a_ready => cti.a_ready,
|
219 |
|
|
io_cached_0_a_valid => cto.a_valid,
|
220 |
|
|
io_cached_0_a_bits_opcode => cto.a_opcode,
|
221 |
|
|
io_cached_0_a_bits_param => cto.a_param,
|
222 |
|
|
io_cached_0_a_bits_size => cto.a_size,
|
223 |
|
|
io_cached_0_a_bits_source => cto.a_source(1 downto 0),
|
224 |
|
|
io_cached_0_a_bits_address => cto.a_address,
|
225 |
|
|
io_cached_0_a_bits_mask => cto.a_mask,
|
226 |
|
|
io_cached_0_a_bits_data => cto.a_data,
|
227 |
|
|
io_cached_0_b_ready => cto.b_ready,
|
228 |
|
|
io_cached_0_b_valid => cti.b_valid,
|
229 |
|
|
io_cached_0_b_bits_opcode => cti.b_opcode,
|
230 |
|
|
io_cached_0_b_bits_param => cti.b_param,
|
231 |
|
|
io_cached_0_b_bits_size => cti.b_size,
|
232 |
|
|
io_cached_0_b_bits_source => cti.b_source(1 downto 0),
|
233 |
|
|
io_cached_0_b_bits_address => cti.b_address,
|
234 |
|
|
io_cached_0_b_bits_mask => cti.b_mask,
|
235 |
|
|
io_cached_0_b_bits_data => cti.b_data,
|
236 |
|
|
io_cached_0_c_ready => cti.c_ready,
|
237 |
|
|
io_cached_0_c_valid => cto.c_valid,
|
238 |
|
|
io_cached_0_c_bits_opcode => cto.c_opcode,
|
239 |
|
|
io_cached_0_c_bits_param => cto.c_param,
|
240 |
|
|
io_cached_0_c_bits_size => cto.c_size,
|
241 |
|
|
io_cached_0_c_bits_source => cto.c_source(1 downto 0),
|
242 |
|
|
io_cached_0_c_bits_address => cto.c_address,
|
243 |
|
|
io_cached_0_c_bits_data => cto.c_data,
|
244 |
|
|
io_cached_0_c_bits_error => cto.c_error,
|
245 |
|
|
io_cached_0_d_ready => cto.d_ready,
|
246 |
|
|
io_cached_0_d_valid => cti.d_valid,
|
247 |
|
|
io_cached_0_d_bits_opcode => cti.d_opcode,
|
248 |
|
|
io_cached_0_d_bits_param => cti.d_param,
|
249 |
|
|
io_cached_0_d_bits_size => cti.d_size,
|
250 |
|
|
io_cached_0_d_bits_source => cti.d_source(1 downto 0),
|
251 |
|
|
io_cached_0_d_bits_sink => cti.d_sink,
|
252 |
|
|
io_cached_0_d_bits_addr_lo => cti.d_addr_lo,
|
253 |
|
|
io_cached_0_d_bits_data => cti.d_data,
|
254 |
|
|
io_cached_0_d_bits_error => cti.d_error,
|
255 |
|
|
io_cached_0_e_ready => cti.e_ready,
|
256 |
|
|
io_cached_0_e_valid => cto.e_valid,
|
257 |
|
|
io_cached_0_e_bits_sink => cto.e_sink,
|
258 |
|
|
|
259 |
|
|
io_uncached_0_a_ready => uti.a_ready,
|
260 |
|
|
io_uncached_0_a_valid => uto.a_valid,
|
261 |
|
|
io_uncached_0_a_bits_opcode => uto.a_opcode,
|
262 |
|
|
io_uncached_0_a_bits_param => uto.a_param,
|
263 |
|
|
io_uncached_0_a_bits_size => uto.a_size,
|
264 |
|
|
io_uncached_0_a_bits_source => uto.a_source,
|
265 |
|
|
io_uncached_0_a_bits_address => uto.a_address,
|
266 |
|
|
io_uncached_0_a_bits_mask => uto.a_mask,
|
267 |
|
|
io_uncached_0_a_bits_data => uto.a_data,
|
268 |
|
|
io_uncached_0_b_ready => uto.b_ready,
|
269 |
|
|
io_uncached_0_b_valid => uti.b_valid,
|
270 |
|
|
io_uncached_0_b_bits_opcode => uti.b_opcode,
|
271 |
|
|
io_uncached_0_b_bits_param => uti.b_param,
|
272 |
|
|
io_uncached_0_b_bits_size => uti.b_size,
|
273 |
|
|
io_uncached_0_b_bits_source => uti.b_source,
|
274 |
|
|
io_uncached_0_b_bits_address => uti.b_address,
|
275 |
|
|
io_uncached_0_b_bits_mask => uti.b_mask,
|
276 |
|
|
io_uncached_0_b_bits_data => uti.b_data,
|
277 |
|
|
io_uncached_0_c_ready => uti.c_ready,
|
278 |
|
|
io_uncached_0_c_valid => uto.c_valid,
|
279 |
|
|
io_uncached_0_c_bits_opcode => uto.c_opcode,
|
280 |
|
|
io_uncached_0_c_bits_param => uto.c_param,
|
281 |
|
|
io_uncached_0_c_bits_size => uto.c_size,
|
282 |
|
|
io_uncached_0_c_bits_source => uto.c_source,
|
283 |
|
|
io_uncached_0_c_bits_address => uto.c_address,
|
284 |
|
|
io_uncached_0_c_bits_data => uto.c_data,
|
285 |
|
|
io_uncached_0_c_bits_error => uto.c_error,
|
286 |
|
|
io_uncached_0_d_ready => uto.d_ready,
|
287 |
|
|
io_uncached_0_d_valid => uti.d_valid,
|
288 |
|
|
io_uncached_0_d_bits_opcode => uti.d_opcode,
|
289 |
|
|
io_uncached_0_d_bits_param => uti.d_param,
|
290 |
|
|
io_uncached_0_d_bits_size => uti.d_size,
|
291 |
|
|
io_uncached_0_d_bits_source => uti.d_source,
|
292 |
|
|
io_uncached_0_d_bits_sink => uti.d_sink,
|
293 |
|
|
io_uncached_0_d_bits_addr_lo => uti.d_addr_lo,
|
294 |
|
|
io_uncached_0_d_bits_data => uti.d_data,
|
295 |
|
|
io_uncached_0_d_bits_error => uti.d_error,
|
296 |
|
|
io_uncached_0_e_ready => uti.e_ready,
|
297 |
|
|
io_uncached_0_e_valid => uto.e_valid,
|
298 |
|
|
io_uncached_0_e_bits_sink => uto.e_sink,
|
299 |
|
|
|
300 |
|
|
io_hartid => CFG_HARTID,
|
301 |
|
|
io_interrupts_debug => interrupts(CFG_CORE_IRQ_DEBUG),
|
302 |
|
|
io_interrupts_mtip => interrupts(CFG_CORE_IRQ_MTIP),
|
303 |
|
|
io_interrupts_msip => interrupts(CFG_CORE_IRQ_MSIP),
|
304 |
|
|
io_interrupts_meip => interrupts(CFG_CORE_IRQ_MEIP),
|
305 |
|
|
io_interrupts_seip => interrupts(CFG_CORE_IRQ_SEIP),
|
306 |
|
|
io_resetVector => CFG_RESET_VECTOR
|
307 |
|
|
);
|
308 |
|
|
|
309 |
|
|
cbridge0 : Tile2Axi port map (
|
310 |
|
|
clk => clk_sys,
|
311 |
|
|
nrst => nrst,
|
312 |
|
|
--! Tile-to-AXI direction
|
313 |
|
|
tloi => cto,
|
314 |
|
|
msto => msto1,
|
315 |
|
|
--! AXI-to-Tile direction
|
316 |
|
|
msti => msti1,
|
317 |
|
|
tlio => cti
|
318 |
|
|
);
|
319 |
|
|
|
320 |
|
|
ubridge0 : Tile2Axi port map (
|
321 |
|
|
clk => clk_sys,
|
322 |
|
|
nrst => nrst,
|
323 |
|
|
--! Tile-to-AXI direction
|
324 |
|
|
tloi => uto,
|
325 |
|
|
msto => msto2,
|
326 |
|
|
--! AXI-to-Tile direction
|
327 |
|
|
msti => msti2,
|
328 |
|
|
tlio => uti
|
329 |
|
|
);
|
330 |
|
|
|
331 |
|
|
end arch_rocket_l1only;
|