1 |
5 |
sergeykhbr |
-----------------------------------------------------------------------------
|
2 |
|
|
--! @file
|
3 |
|
|
--! @copyright Copyright 2015 GNSS Sensor Ltd. All right reserved.
|
4 |
|
|
--! @author Sergey Khabarov
|
5 |
|
|
--! @brief Network on Chip design top level.
|
6 |
|
|
--! @details RISC-V "Rocket"/"River" based system with the AMBA AXI4 (NASTI)
|
7 |
|
|
--! system bus and integrated peripheries.
|
8 |
|
|
------------------------------------------------------------------------------
|
9 |
|
|
--! Standard library
|
10 |
|
|
library IEEE;
|
11 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
12 |
|
|
|
13 |
|
|
--! Data transformation and math functions library
|
14 |
|
|
library commonlib;
|
15 |
|
|
use commonlib.types_common.all;
|
16 |
|
|
|
17 |
|
|
--! Technology definition library.
|
18 |
|
|
library techmap;
|
19 |
|
|
--! Technology constants definition.
|
20 |
|
|
use techmap.gencomp.all;
|
21 |
|
|
--! "Virtual" PLL declaration.
|
22 |
|
|
use techmap.types_pll.all;
|
23 |
|
|
--! "Virtual" buffers declaration.
|
24 |
|
|
use techmap.types_buf.all;
|
25 |
|
|
|
26 |
|
|
--! AMBA system bus specific library
|
27 |
|
|
library ambalib;
|
28 |
|
|
--! AXI4 configuration constants.
|
29 |
|
|
use ambalib.types_amba4.all;
|
30 |
|
|
--! Misc modules library
|
31 |
|
|
library misclib;
|
32 |
|
|
use misclib.types_misc.all;
|
33 |
|
|
--! Ethernet related declarations.
|
34 |
|
|
library ethlib;
|
35 |
|
|
use ethlib.types_eth.all;
|
36 |
|
|
|
37 |
|
|
--! Rocket-chip specific library
|
38 |
|
|
library rocketlib;
|
39 |
|
|
--! SOC top-level component declaration.
|
40 |
|
|
use rocketlib.types_rocket.all;
|
41 |
|
|
|
42 |
|
|
--! River CPU specific library
|
43 |
|
|
library riverlib;
|
44 |
|
|
--! River top level with AMBA interface module declaration
|
45 |
|
|
use riverlib.types_river.all;
|
46 |
|
|
|
47 |
|
|
--! Top-level implementaion library
|
48 |
|
|
library work;
|
49 |
|
|
--! Target dependable configuration: RTL, FPGA or ASIC.
|
50 |
|
|
use work.config_target.all;
|
51 |
|
|
--! Target independable configuration.
|
52 |
|
|
use work.config_common.all;
|
53 |
|
|
|
54 |
|
|
--! @brief SOC Top-level entity declaration.
|
55 |
|
|
--! @details This module implements full SOC functionality and all IO signals
|
56 |
|
|
--! are available on FPGA/ASIC IO pins.
|
57 |
|
|
entity riscv_soc is port
|
58 |
|
|
(
|
59 |
|
|
--! Input reset. Active High. Usually assigned to button "Center".
|
60 |
|
|
i_rst : in std_logic;
|
61 |
|
|
|
62 |
|
|
--! Differential clock (LVDS) positive signal.
|
63 |
|
|
i_sclk_p : in std_logic;
|
64 |
|
|
--! Differential clock (LVDS) negative signal.
|
65 |
|
|
i_sclk_n : in std_logic;
|
66 |
|
|
--! DIP switch.
|
67 |
|
|
i_dip : in std_logic_vector(3 downto 0);
|
68 |
|
|
--! LEDs.
|
69 |
|
|
o_led : out std_logic_vector(7 downto 0);
|
70 |
|
|
--! JTAG signals:
|
71 |
|
|
i_jtag_tck : in std_logic;
|
72 |
|
|
i_jtag_ntrst : in std_logic;
|
73 |
|
|
i_jtag_tms : in std_logic;
|
74 |
|
|
i_jtag_tdi : in std_logic;
|
75 |
|
|
o_jtag_tdo : out std_logic;
|
76 |
|
|
o_jtag_vref : out std_logic;
|
77 |
|
|
--! UART1 signals:
|
78 |
|
|
i_uart1_ctsn : in std_logic;
|
79 |
|
|
i_uart1_rd : in std_logic;
|
80 |
|
|
o_uart1_td : out std_logic;
|
81 |
|
|
o_uart1_rtsn : out std_logic;
|
82 |
|
|
--! UART2 (debug port) signals:
|
83 |
|
|
i_uart2_ctsn : in std_logic;
|
84 |
|
|
i_uart2_rd : in std_logic;
|
85 |
|
|
o_uart2_td : out std_logic;
|
86 |
|
|
o_uart2_rtsn : out std_logic;
|
87 |
|
|
--! Ethernet MAC PHY interface signals
|
88 |
|
|
i_gmiiclk_p : in std_ulogic;
|
89 |
|
|
i_gmiiclk_n : in std_ulogic;
|
90 |
|
|
o_egtx_clk : out std_ulogic;
|
91 |
|
|
i_etx_clk : in std_ulogic;
|
92 |
|
|
i_erx_clk : in std_ulogic;
|
93 |
|
|
i_erxd : in std_logic_vector(3 downto 0);
|
94 |
|
|
i_erx_dv : in std_ulogic;
|
95 |
|
|
i_erx_er : in std_ulogic;
|
96 |
|
|
i_erx_col : in std_ulogic;
|
97 |
|
|
i_erx_crs : in std_ulogic;
|
98 |
|
|
i_emdint : in std_ulogic;
|
99 |
|
|
o_etxd : out std_logic_vector(3 downto 0);
|
100 |
|
|
o_etx_en : out std_ulogic;
|
101 |
|
|
o_etx_er : out std_ulogic;
|
102 |
|
|
o_emdc : out std_ulogic;
|
103 |
|
|
io_emdio : inout std_logic;
|
104 |
|
|
o_erstn : out std_ulogic
|
105 |
|
|
);
|
106 |
|
|
--! @}
|
107 |
|
|
|
108 |
|
|
end riscv_soc;
|
109 |
|
|
|
110 |
|
|
--! @brief SOC top-level architecture declaration.
|
111 |
|
|
architecture arch_riscv_soc of riscv_soc is
|
112 |
|
|
|
113 |
|
|
--! @name Buffered in/out signals.
|
114 |
|
|
--! @details All signals that are connected with in/out pads must be passed
|
115 |
|
|
--! through the dedicated buffere modules. For FPGA they are implemented
|
116 |
|
|
--! as an empty devices but ASIC couldn't be made without buffering.
|
117 |
|
|
--! @{
|
118 |
|
|
signal ib_rst : std_logic;
|
119 |
|
|
signal ib_clk_tcxo : std_logic;
|
120 |
|
|
signal ib_sclk_n : std_logic;
|
121 |
|
|
signal ib_dip : std_logic_vector(3 downto 0);
|
122 |
|
|
signal ib_gmiiclk : std_logic;
|
123 |
|
|
--! @}
|
124 |
|
|
|
125 |
|
|
signal w_ext_reset : std_ulogic; -- External system reset or PLL unlcoked. MUST NOT USED BY DEVICES.
|
126 |
|
|
signal w_glob_rst : std_ulogic; -- Global reset active HIGH
|
127 |
|
|
signal w_glob_nrst : std_ulogic; -- Global reset active LOW
|
128 |
|
|
signal w_soft_rst : std_ulogic; -- Software reset (acitve HIGH) from DSU
|
129 |
|
|
signal w_bus_nrst : std_ulogic; -- Global reset and Soft Reset active LOW
|
130 |
|
|
signal w_clk_bus : std_ulogic; -- bus clock from the internal PLL (100MHz virtex6/40MHz Spartan6)
|
131 |
|
|
signal w_pll_lock : std_ulogic; -- PLL status signal. 0=Unlocked; 1=locked.
|
132 |
|
|
|
133 |
|
|
signal uart1i : uart_in_type;
|
134 |
|
|
signal uart1o : uart_out_type;
|
135 |
|
|
signal uart2i : uart_in_type;
|
136 |
|
|
signal uart2o : uart_out_type;
|
137 |
|
|
|
138 |
|
|
--! Arbiter is switching only slaves output signal, data from noc
|
139 |
|
|
--! is connected to all slaves and to the arbiter itself.
|
140 |
|
|
signal aximi : nasti_master_in_vector;
|
141 |
|
|
signal aximo : nasti_master_out_vector;
|
142 |
|
|
signal axisi : nasti_slave_in_vector;
|
143 |
|
|
signal axiso : nasti_slaves_out_vector;
|
144 |
|
|
signal slv_cfg : nasti_slave_cfg_vector;
|
145 |
|
|
signal mst_cfg : nasti_master_cfg_vector;
|
146 |
|
|
signal core_irqs : std_logic_vector(CFG_CORE_IRQ_TOTAL-1 downto 0);
|
147 |
|
|
signal dport_i : dport_in_type;
|
148 |
|
|
signal dport_o : dport_out_type;
|
149 |
|
|
signal wb_miss_addr : std_logic_vector(CFG_NASTI_ADDR_BITS-1 downto 0);
|
150 |
|
|
signal wb_bus_util_w : std_logic_vector(CFG_NASTI_MASTER_TOTAL-1 downto 0);
|
151 |
|
|
signal wb_bus_util_r : std_logic_vector(CFG_NASTI_MASTER_TOTAL-1 downto 0);
|
152 |
|
|
|
153 |
|
|
signal eth_i : eth_in_type;
|
154 |
|
|
signal eth_o : eth_out_type;
|
155 |
|
|
|
156 |
|
|
signal irq_pins : std_logic_vector(CFG_IRQ_TOTAL-1 downto 1);
|
157 |
|
|
begin
|
158 |
|
|
|
159 |
|
|
--! PAD buffers:
|
160 |
|
|
irst0 : ibuf_tech generic map(CFG_PADTECH) port map (ib_rst, i_rst);
|
161 |
|
|
dipx : for i in 0 to 3 generate
|
162 |
|
|
idipz : ibuf_tech generic map(CFG_PADTECH) port map (ib_dip(i), i_dip(i));
|
163 |
|
|
end generate;
|
164 |
|
|
|
165 |
|
|
iclk0 : idsbuf_tech generic map (CFG_PADTECH) port map (
|
166 |
|
|
i_sclk_p, i_sclk_n, ib_clk_tcxo);
|
167 |
|
|
|
168 |
|
|
igbebuf0 : igdsbuf_tech generic map (CFG_PADTECH) port map (
|
169 |
|
|
i_gmiiclk_p, i_gmiiclk_n, ib_gmiiclk);
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
--! @todo all other in/out signals via buffers:
|
173 |
|
|
|
174 |
|
|
-- Nullify emty AXI-slots:
|
175 |
|
|
axiso(CFG_NASTI_SLAVE_ENGINE) <= nasti_slave_out_none;
|
176 |
|
|
slv_cfg(CFG_NASTI_SLAVE_ENGINE) <= nasti_slave_config_none;
|
177 |
|
|
irq_pins(CFG_IRQ_GNSSENGINE) <= '0';
|
178 |
|
|
slv_cfg(CFG_NASTI_SLAVE_RFCTRL) <= nasti_slave_config_none;
|
179 |
|
|
axiso(CFG_NASTI_SLAVE_RFCTRL) <= nasti_slave_out_none;
|
180 |
|
|
slv_cfg(CFG_NASTI_SLAVE_FSE_GPS) <= nasti_slave_config_none;
|
181 |
|
|
axiso(CFG_NASTI_SLAVE_FSE_GPS) <= nasti_slave_out_none;
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
------------------------------------
|
185 |
|
|
-- @brief Internal PLL device instance.
|
186 |
|
|
pll0 : SysPLL_tech generic map (
|
187 |
|
|
tech => CFG_FABTECH
|
188 |
|
|
) port map (
|
189 |
|
|
i_reset => ib_rst,
|
190 |
|
|
i_clk_tcxo => ib_clk_tcxo,
|
191 |
|
|
o_clk_bus => w_clk_bus,
|
192 |
|
|
o_locked => w_pll_lock
|
193 |
|
|
);
|
194 |
|
|
w_ext_reset <= ib_rst or not w_pll_lock;
|
195 |
|
|
|
196 |
|
|
------------------------------------
|
197 |
|
|
--! @brief System Reset device instance.
|
198 |
|
|
rst0 : reset_global port map (
|
199 |
|
|
inSysReset => w_ext_reset,
|
200 |
|
|
inSysClk => w_clk_bus,
|
201 |
|
|
inPllLock => w_pll_lock,
|
202 |
|
|
outReset => w_glob_rst
|
203 |
|
|
);
|
204 |
|
|
w_glob_nrst <= not w_glob_rst;
|
205 |
|
|
w_bus_nrst <= not (w_glob_rst or w_soft_rst);
|
206 |
|
|
|
207 |
|
|
--! @brief AXI4 controller.
|
208 |
|
|
ctrl0 : axictrl generic map (
|
209 |
|
|
watchdog_memop => 0
|
210 |
|
|
) port map (
|
211 |
|
|
i_clk => w_clk_bus,
|
212 |
|
|
i_nrst => w_glob_nrst,
|
213 |
|
|
i_slvcfg => slv_cfg,
|
214 |
|
|
i_slvo => axiso,
|
215 |
|
|
i_msto => aximo,
|
216 |
|
|
o_slvi => axisi,
|
217 |
|
|
o_msti => aximi,
|
218 |
|
|
o_miss_irq => irq_pins(CFG_IRQ_MISS_ACCESS),
|
219 |
|
|
o_miss_addr => wb_miss_addr,
|
220 |
|
|
o_bus_util_w => wb_bus_util_w, -- Bus write access utilization per master statistic
|
221 |
|
|
o_bus_util_r => wb_bus_util_r -- Bus read access utilization per master statistic
|
222 |
|
|
);
|
223 |
|
|
|
224 |
|
|
--! @brief RISC-V Processor core (River or Rocket).
|
225 |
|
|
river_ena : if CFG_COMMON_RIVER_CPU_ENABLE generate
|
226 |
|
|
cpu0 : river_amba port map (
|
227 |
|
|
i_nrst => w_bus_nrst,
|
228 |
|
|
i_clk => w_clk_bus,
|
229 |
|
|
i_msti => aximi(CFG_NASTI_MASTER_CACHED),
|
230 |
|
|
o_msto => aximo(CFG_NASTI_MASTER_CACHED),
|
231 |
|
|
o_mstcfg => mst_cfg(CFG_NASTI_MASTER_CACHED),
|
232 |
|
|
i_dport => dport_i,
|
233 |
|
|
o_dport => dport_o,
|
234 |
|
|
i_ext_irq => core_irqs(CFG_CORE_IRQ_MEIP)
|
235 |
|
|
);
|
236 |
|
|
aximo(CFG_NASTI_MASTER_UNCACHED) <= nasti_master_out_none;
|
237 |
|
|
mst_cfg(CFG_NASTI_MASTER_UNCACHED) <= nasti_master_config_none;
|
238 |
|
|
end generate;
|
239 |
|
|
|
240 |
|
|
--! DSU doesn't support Rocket-chip CPU
|
241 |
|
|
river_dis : if not CFG_COMMON_RIVER_CPU_ENABLE generate
|
242 |
|
|
--! Not imlpemented interrupts:
|
243 |
|
|
core_irqs(CFG_CORE_IRQ_MTIP) <= '0'; -- timer's
|
244 |
|
|
core_irqs(CFG_CORE_IRQ_MSIP) <= '0'; -- software's
|
245 |
|
|
core_irqs(CFG_CORE_IRQ_SEIP) <= '0'; -- superuser external interrupt
|
246 |
|
|
core_irqs(CFG_CORE_IRQ_DEBUG) <= '0';
|
247 |
|
|
|
248 |
|
|
cpu0 : rocket_l1only generic map (
|
249 |
|
|
hartid => 0,
|
250 |
|
|
reset_vector => 16#1000#
|
251 |
|
|
) port map (
|
252 |
|
|
nrst => w_bus_nrst,
|
253 |
|
|
clk_sys => w_clk_bus,
|
254 |
|
|
msti1 => aximi(CFG_NASTI_MASTER_CACHED),
|
255 |
|
|
msto1 => aximo(CFG_NASTI_MASTER_CACHED),
|
256 |
|
|
mstcfg1 => mst_cfg(CFG_NASTI_MASTER_CACHED),
|
257 |
|
|
msti2 => aximi(CFG_NASTI_MASTER_UNCACHED),
|
258 |
|
|
msto2 => aximo(CFG_NASTI_MASTER_UNCACHED),
|
259 |
|
|
mstcfg2 => mst_cfg(CFG_NASTI_MASTER_UNCACHED),
|
260 |
|
|
interrupts => core_irqs
|
261 |
|
|
);
|
262 |
|
|
end generate;
|
263 |
|
|
|
264 |
|
|
dsu_ena : if CFG_DSU_ENABLE generate
|
265 |
|
|
------------------------------------
|
266 |
|
|
--! @brief Debug Support Unit with access to the CSRs
|
267 |
|
|
--! @details Map address:
|
268 |
|
|
--! 0x80080000..0x8009ffff (128 KB total)
|
269 |
|
|
dsu0 : axi_dsu generic map (
|
270 |
|
|
xaddr => 16#80080#,
|
271 |
|
|
xmask => 16#fffe0#
|
272 |
|
|
) port map (
|
273 |
|
|
clk => w_clk_bus,
|
274 |
|
|
nrst => w_glob_nrst,
|
275 |
|
|
o_cfg => slv_cfg(CFG_NASTI_SLAVE_DSU),
|
276 |
|
|
i_axi => axisi(CFG_NASTI_SLAVE_DSU),
|
277 |
|
|
o_axi => axiso(CFG_NASTI_SLAVE_DSU),
|
278 |
|
|
o_dporti => dport_i,
|
279 |
|
|
i_dporto => dport_o,
|
280 |
|
|
o_soft_rst => w_soft_rst,
|
281 |
|
|
-- Run time platform statistic signals:
|
282 |
|
|
i_miss_irq => irq_pins(CFG_IRQ_MISS_ACCESS),
|
283 |
|
|
i_miss_addr => wb_miss_addr,
|
284 |
|
|
i_bus_util_w => wb_bus_util_w, -- Write access bus utilization per master statistic
|
285 |
|
|
i_bus_util_r => wb_bus_util_r -- Read access bus utilization per master statistic
|
286 |
|
|
);
|
287 |
|
|
end generate;
|
288 |
|
|
dsu_dis : if not CFG_DSU_ENABLE generate
|
289 |
|
|
slv_cfg(CFG_NASTI_SLAVE_DSU) <= nasti_slave_config_none;
|
290 |
|
|
axiso(CFG_NASTI_SLAVE_DSU) <= nasti_slave_out_none;
|
291 |
|
|
dport_i <= dport_in_none;
|
292 |
|
|
end generate;
|
293 |
|
|
|
294 |
|
|
------------------------------------
|
295 |
|
|
-- JTAG TAP interface
|
296 |
|
|
jtag0 : tap_jtag generic map (
|
297 |
|
|
ainst => 2,
|
298 |
|
|
dinst => 3
|
299 |
|
|
) port map (
|
300 |
|
|
nrst => w_glob_nrst,
|
301 |
|
|
clk => w_clk_bus,
|
302 |
|
|
i_tck => i_jtag_tck,
|
303 |
|
|
i_ntrst => i_jtag_ntrst,
|
304 |
|
|
i_tms => i_jtag_tms,
|
305 |
|
|
i_tdi => i_jtag_tdi,
|
306 |
|
|
o_tdo => o_jtag_tdo,
|
307 |
|
|
o_jtag_vref => o_jtag_vref,
|
308 |
|
|
i_msti => aximi(CFG_AXI_MASTER_JTAG),
|
309 |
|
|
o_msto => aximo(CFG_AXI_MASTER_JTAG),
|
310 |
|
|
o_mstcfg => mst_cfg(CFG_AXI_MASTER_JTAG)
|
311 |
|
|
);
|
312 |
|
|
|
313 |
|
|
------------------------------------
|
314 |
|
|
--! @brief TAP via UART (debug port) with master interface.
|
315 |
|
|
uart2i.cts <= not i_uart2_ctsn;
|
316 |
|
|
uart2i.rd <= i_uart2_rd;
|
317 |
|
|
uart2 : uart_tap port map (
|
318 |
|
|
nrst => w_glob_nrst,
|
319 |
|
|
clk => w_clk_bus,
|
320 |
|
|
i_uart => uart2i,
|
321 |
|
|
o_uart => uart2o,
|
322 |
|
|
i_msti => aximi(CFG_NASTI_MASTER_MSTUART),
|
323 |
|
|
o_msto => aximo(CFG_NASTI_MASTER_MSTUART),
|
324 |
|
|
o_mstcfg => mst_cfg(CFG_NASTI_MASTER_MSTUART)
|
325 |
|
|
);
|
326 |
|
|
o_uart2_td <= uart2o.td;
|
327 |
|
|
o_uart2_rtsn <= not uart2o.rts;
|
328 |
|
|
|
329 |
|
|
------------------------------------
|
330 |
|
|
--! @brief BOOT ROM module isntance with the AXI4 interface.
|
331 |
|
|
--! @details Map address:
|
332 |
|
|
--! 0x00000000..0x00001fff (8 KB total)
|
333 |
|
|
boot0 : nasti_bootrom generic map (
|
334 |
|
|
memtech => CFG_MEMTECH,
|
335 |
|
|
xaddr => 16#00000#,
|
336 |
|
|
xmask => 16#ffffe#,
|
337 |
|
|
sim_hexfile => CFG_SIM_BOOTROM_HEX
|
338 |
|
|
) port map (
|
339 |
|
|
clk => w_clk_bus,
|
340 |
|
|
nrst => w_glob_nrst,
|
341 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_BOOTROM),
|
342 |
|
|
i => axisi(CFG_NASTI_SLAVE_BOOTROM),
|
343 |
|
|
o => axiso(CFG_NASTI_SLAVE_BOOTROM)
|
344 |
|
|
);
|
345 |
|
|
|
346 |
|
|
------------------------------------
|
347 |
|
|
--! @brief Firmware Image ROM with the AXI4 interface.
|
348 |
|
|
--! @details Map address:
|
349 |
|
|
--! 0x00100000..0x0013ffff (256 KB total)
|
350 |
|
|
--! @warning Don't forget to change ROM_ADDR_WIDTH in rom implementation
|
351 |
|
|
img0 : nasti_romimage generic map (
|
352 |
|
|
memtech => CFG_MEMTECH,
|
353 |
|
|
xaddr => 16#00100#,
|
354 |
|
|
xmask => 16#fffc0#,
|
355 |
|
|
sim_hexfile => CFG_SIM_FWIMAGE_HEX
|
356 |
|
|
) port map (
|
357 |
|
|
clk => w_clk_bus,
|
358 |
|
|
nrst => w_glob_nrst,
|
359 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_ROMIMAGE),
|
360 |
|
|
i => axisi(CFG_NASTI_SLAVE_ROMIMAGE),
|
361 |
|
|
o => axiso(CFG_NASTI_SLAVE_ROMIMAGE)
|
362 |
|
|
);
|
363 |
|
|
|
364 |
|
|
------------------------------------
|
365 |
|
|
--! Internal SRAM module instance with the AXI4 interface.
|
366 |
|
|
--! @details Map address:
|
367 |
|
|
--! 0x10000000..0x1007ffff (512 KB total)
|
368 |
|
|
sram0 : nasti_sram generic map (
|
369 |
|
|
memtech => CFG_MEMTECH,
|
370 |
|
|
xaddr => 16#10000#,
|
371 |
|
|
xmask => 16#fff80#, -- 512 KB mask
|
372 |
|
|
abits => (10 + log2(512)), -- 512 KB address
|
373 |
|
|
init_file => CFG_SIM_FWIMAGE_HEX -- Used only for inferred
|
374 |
|
|
) port map (
|
375 |
|
|
clk => w_clk_bus,
|
376 |
|
|
nrst => w_glob_nrst,
|
377 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_SRAM),
|
378 |
|
|
i => axisi(CFG_NASTI_SLAVE_SRAM),
|
379 |
|
|
o => axiso(CFG_NASTI_SLAVE_SRAM)
|
380 |
|
|
);
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
------------------------------------
|
384 |
|
|
--! @brief Controller of the LEDs, DIPs and GPIO with the AXI4 interface.
|
385 |
|
|
--! @details Map address:
|
386 |
|
|
--! 0x80000000..0x80000fff (4 KB total)
|
387 |
|
|
gpio0 : nasti_gpio generic map (
|
388 |
|
|
xaddr => 16#80000#,
|
389 |
|
|
xmask => 16#fffff#,
|
390 |
|
|
xirq => 0
|
391 |
|
|
) port map (
|
392 |
|
|
clk => w_clk_bus,
|
393 |
|
|
nrst => w_glob_nrst,
|
394 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_GPIO),
|
395 |
|
|
i => axisi(CFG_NASTI_SLAVE_GPIO),
|
396 |
|
|
o => axiso(CFG_NASTI_SLAVE_GPIO),
|
397 |
|
|
i_dip => ib_dip,
|
398 |
|
|
o_led => o_led
|
399 |
|
|
);
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
------------------------------------
|
403 |
|
|
uart1i.cts <= not i_uart1_ctsn;
|
404 |
|
|
uart1i.rd <= i_uart1_rd;
|
405 |
|
|
|
406 |
|
|
--! @brief UART Controller with the AXI4 interface.
|
407 |
|
|
--! @details Map address:
|
408 |
|
|
--! 0x80001000..0x80001fff (4 KB total)
|
409 |
|
|
uart1 : nasti_uart generic map (
|
410 |
|
|
xaddr => 16#80001#,
|
411 |
|
|
xmask => 16#FFFFF#,
|
412 |
|
|
xirq => CFG_IRQ_UART1,
|
413 |
|
|
fifosz => 16
|
414 |
|
|
) port map (
|
415 |
|
|
nrst => w_glob_nrst,
|
416 |
|
|
clk => w_clk_bus,
|
417 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_UART1),
|
418 |
|
|
i_uart => uart1i,
|
419 |
|
|
o_uart => uart1o,
|
420 |
|
|
i_axi => axisi(CFG_NASTI_SLAVE_UART1),
|
421 |
|
|
o_axi => axiso(CFG_NASTI_SLAVE_UART1),
|
422 |
|
|
o_irq => irq_pins(CFG_IRQ_UART1)
|
423 |
|
|
);
|
424 |
|
|
o_uart1_td <= uart1o.td;
|
425 |
|
|
o_uart1_rtsn <= not uart1o.rts;
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
------------------------------------
|
429 |
|
|
--! @brief Interrupt controller with the AXI4 interface.
|
430 |
|
|
--! @details Map address:
|
431 |
|
|
--! 0x80002000..0x80002fff (4 KB total)
|
432 |
|
|
irq0 : nasti_irqctrl generic map (
|
433 |
|
|
xaddr => 16#80002#,
|
434 |
|
|
xmask => 16#FFFFF#
|
435 |
|
|
) port map (
|
436 |
|
|
clk => w_clk_bus,
|
437 |
|
|
nrst => w_bus_nrst,
|
438 |
|
|
i_irqs => irq_pins,
|
439 |
|
|
o_cfg => slv_cfg(CFG_NASTI_SLAVE_IRQCTRL),
|
440 |
|
|
i_axi => axisi(CFG_NASTI_SLAVE_IRQCTRL),
|
441 |
|
|
o_axi => axiso(CFG_NASTI_SLAVE_IRQCTRL),
|
442 |
|
|
o_irq_meip => core_irqs(CFG_CORE_IRQ_MEIP)
|
443 |
|
|
);
|
444 |
|
|
|
445 |
|
|
--! @brief Timers with the AXI4 interface.
|
446 |
|
|
--! @details Map address:
|
447 |
|
|
--! 0x80005000..0x80005fff (4 KB total)
|
448 |
|
|
gptmr0 : nasti_gptimers generic map (
|
449 |
|
|
xaddr => 16#80005#,
|
450 |
|
|
xmask => 16#fffff#,
|
451 |
|
|
xirq => CFG_IRQ_GPTIMERS,
|
452 |
|
|
tmr_total => 2
|
453 |
|
|
) port map (
|
454 |
|
|
clk => w_clk_bus,
|
455 |
|
|
nrst => w_glob_nrst,
|
456 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_GPTIMERS),
|
457 |
|
|
i_axi => axisi(CFG_NASTI_SLAVE_GPTIMERS),
|
458 |
|
|
o_axi => axiso(CFG_NASTI_SLAVE_GPTIMERS),
|
459 |
|
|
o_irq => irq_pins(CFG_IRQ_GPTIMERS)
|
460 |
|
|
);
|
461 |
|
|
|
462 |
|
|
--! Gigabit clock phase rotator with buffers
|
463 |
|
|
clkrot90 : clkp90_tech generic map (
|
464 |
|
|
tech => CFG_FABTECH,
|
465 |
|
|
freq => 125000 -- KHz = 125 MHz
|
466 |
|
|
) port map (
|
467 |
|
|
i_rst => w_glob_rst,
|
468 |
|
|
i_clk => ib_gmiiclk,
|
469 |
|
|
o_clk => eth_i.gtx_clk,
|
470 |
|
|
o_clkp90 => eth_i.tx_clk_90,
|
471 |
|
|
o_clk2x => open, -- used in gbe 'io_ref'
|
472 |
|
|
o_lock => open
|
473 |
|
|
);
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
--! @brief Ethernet MAC with the AXI4 interface.
|
477 |
|
|
--! @details Map address:
|
478 |
|
|
--! 0x80040000..0x8007ffff (256 KB total)
|
479 |
|
|
--! EDCL IP: 192.168.1.51 = C0.A8.01.33
|
480 |
|
|
eth0_ena : if CFG_ETHERNET_ENABLE generate
|
481 |
|
|
eth_i.tx_clk <= i_etx_clk;
|
482 |
|
|
eth_i.rx_clk <= i_erx_clk;
|
483 |
|
|
eth_i.rxd <= i_erxd;
|
484 |
|
|
eth_i.rx_dv <= i_erx_dv;
|
485 |
|
|
eth_i.rx_er <= i_erx_er;
|
486 |
|
|
eth_i.rx_col <= i_erx_col;
|
487 |
|
|
eth_i.rx_crs <= i_erx_crs;
|
488 |
|
|
eth_i.mdint <= i_emdint;
|
489 |
|
|
|
490 |
|
|
mac0 : grethaxi generic map (
|
491 |
|
|
xaddr => 16#80040#,
|
492 |
|
|
xmask => 16#FFFC0#,
|
493 |
|
|
xirq => CFG_IRQ_ETHMAC,
|
494 |
|
|
memtech => CFG_MEMTECH,
|
495 |
|
|
mdcscaler => 60, --! System Bus clock in MHz
|
496 |
|
|
enable_mdio => 1,
|
497 |
|
|
fifosize => 16,
|
498 |
|
|
nsync => 1,
|
499 |
|
|
edcl => 1,
|
500 |
|
|
edclbufsz => 16,
|
501 |
|
|
macaddrh => 16#20789#,
|
502 |
|
|
macaddrl => 16#123#,
|
503 |
|
|
ipaddrh => 16#C0A8#,
|
504 |
|
|
ipaddrl => 16#0033#,
|
505 |
|
|
phyrstadr => 7,
|
506 |
|
|
enable_mdint => 1,
|
507 |
|
|
maxsize => 1518
|
508 |
|
|
) port map (
|
509 |
|
|
rst => w_glob_nrst,
|
510 |
|
|
clk => w_clk_bus,
|
511 |
|
|
msti => aximi(CFG_NASTI_MASTER_ETHMAC),
|
512 |
|
|
msto => aximo(CFG_NASTI_MASTER_ETHMAC),
|
513 |
|
|
mstcfg => mst_cfg(CFG_NASTI_MASTER_ETHMAC),
|
514 |
|
|
msto2 => open, -- EDCL separate access is disabled
|
515 |
|
|
mstcfg2 => open, -- EDCL separate access is disabled
|
516 |
|
|
slvi => axisi(CFG_NASTI_SLAVE_ETHMAC),
|
517 |
|
|
slvo => axiso(CFG_NASTI_SLAVE_ETHMAC),
|
518 |
|
|
slvcfg => slv_cfg(CFG_NASTI_SLAVE_ETHMAC),
|
519 |
|
|
ethi => eth_i,
|
520 |
|
|
etho => eth_o,
|
521 |
|
|
irq => irq_pins(CFG_IRQ_ETHMAC)
|
522 |
|
|
);
|
523 |
|
|
|
524 |
|
|
end generate;
|
525 |
|
|
--! Ethernet disabled
|
526 |
|
|
eth0_dis : if not CFG_ETHERNET_ENABLE generate
|
527 |
|
|
slv_cfg(CFG_NASTI_SLAVE_ETHMAC) <= nasti_slave_config_none;
|
528 |
|
|
axiso(CFG_NASTI_SLAVE_ETHMAC) <= nasti_slave_out_none;
|
529 |
|
|
mst_cfg(CFG_NASTI_MASTER_ETHMAC) <= nasti_master_config_none;
|
530 |
|
|
aximo(CFG_NASTI_MASTER_ETHMAC) <= nasti_master_out_none;
|
531 |
|
|
irq_pins(CFG_IRQ_ETHMAC) <= '0';
|
532 |
|
|
eth_o <= eth_out_none;
|
533 |
|
|
end generate;
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
emdio_pad : iobuf_tech generic map(
|
537 |
|
|
CFG_PADTECH
|
538 |
|
|
) port map (
|
539 |
|
|
o => eth_i.mdio_i,
|
540 |
|
|
io => io_emdio,
|
541 |
|
|
i => eth_o.mdio_o,
|
542 |
|
|
t => eth_o.mdio_oe
|
543 |
|
|
);
|
544 |
|
|
o_egtx_clk <= eth_i.gtx_clk;--eth_i.tx_clk_90;
|
545 |
|
|
o_etxd <= eth_o.txd;
|
546 |
|
|
o_etx_en <= eth_o.tx_en;
|
547 |
|
|
o_etx_er <= eth_o.tx_er;
|
548 |
|
|
o_emdc <= eth_o.mdc;
|
549 |
|
|
o_erstn <= w_glob_nrst;
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
--! @brief Plug'n'Play controller of the current configuration with the
|
553 |
|
|
--! AXI4 interface.
|
554 |
|
|
--! @details Map address:
|
555 |
|
|
--! 0xfffff000..0xffffffff (4 KB total)
|
556 |
|
|
pnp0 : nasti_pnp generic map (
|
557 |
|
|
xaddr => 16#fffff#,
|
558 |
|
|
xmask => 16#fffff#,
|
559 |
|
|
tech => CFG_MEMTECH,
|
560 |
|
|
hw_id => CFG_HW_ID
|
561 |
|
|
) port map (
|
562 |
|
|
sys_clk => w_clk_bus,
|
563 |
|
|
adc_clk => '0',
|
564 |
|
|
nrst => w_glob_nrst,
|
565 |
|
|
mstcfg => mst_cfg,
|
566 |
|
|
slvcfg => slv_cfg,
|
567 |
|
|
cfg => slv_cfg(CFG_NASTI_SLAVE_PNP),
|
568 |
|
|
i => axisi(CFG_NASTI_SLAVE_PNP),
|
569 |
|
|
o => axiso(CFG_NASTI_SLAVE_PNP)
|
570 |
|
|
);
|
571 |
|
|
|
572 |
|
|
|
573 |
|
|
end arch_riscv_soc;
|