OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [rtl/] [work/] [riscv_soc_gnss.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
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
--! GNSS Sensor Ltd proprietary library
48
library gnsslib;
49
use gnsslib.types_gnss.all;
50
 
51
 --! Top-level implementaion library
52
library work;
53
--! Target dependable configuration: RTL, FPGA or ASIC.
54
use work.config_target.all;
55
--! Target independable configuration.
56
use work.config_common.all;
57
 
58
--! @brief   SOC Top-level entity declaration.
59
--! @details This module implements full SOC functionality and all IO signals
60
--!          are available on FPGA/ASIC IO pins.
61
entity riscv_soc_gnss is port
62
(
63
  --! Input reset. Active High. Usually assigned to button "Center".
64
  i_rst     : in std_logic;
65
 
66
  --! @name Clocks:
67
  --! @{
68
 
69
  --! Differential clock (LVDS) positive signal.
70
  i_sclk_p  : in std_logic;
71
  --! Differential clock (LVDS) negative signal.
72
  i_sclk_n  : in std_logic;
73
  --! External ADC clock (default 26 MHz).
74
  i_clk_adc : in std_logic;
75
  --! @}
76
 
77
  --! @name User's IOs:
78
  --! @{
79
 
80
  --! DIP switch.
81
  i_int_clkrf : in std_logic;
82
  i_dip     : in std_logic_vector(3 downto 1);
83
  --! LEDs.
84
  o_led     : out std_logic_vector(7 downto 0);
85
  --! @}
86
 
87
  --! @name  UART1 signals:
88
  --! @{
89
  i_uart1_ctsn : in std_logic;
90
  i_uart1_rd   : in std_logic;
91
  o_uart1_td   : out std_logic;
92
  o_uart1_rtsn : out std_logic;
93
  --! @}
94
 
95
  --! @name  UART2 (debug port) signals:
96
  --! @{
97
  i_uart2_ctsn : in std_logic;
98
  i_uart2_rd   : in std_logic;
99
  o_uart2_td   : out std_logic;
100
  o_uart2_rtsn : out std_logic;
101
  --! @}
102
 
103
  --! @name ADC channel A inputs (1575.4 GHz):
104
  --! @{
105
  i_gps_I  : in std_logic_vector(1 downto 0);
106
  i_gps_Q  : in std_logic_vector(1 downto 0);
107
  --! @}
108
 
109
  --! @name ADC channel B inputs (1602 GHz):
110
  --! @{
111
  i_glo_I  : in std_logic_vector(1 downto 0);
112
  i_glo_Q  : in std_logic_vector(1 downto 0);
113
  --! @}
114
 
115
  --! @name MAX2769 SPIs and antenna controls signals:
116
  --! @{
117
  i_gps_ld    : in std_logic;
118
  i_glo_ld    : in std_logic;
119
  o_max_sclk  : out std_logic;
120
  o_max_sdata : out std_logic;
121
  o_max_ncs   : out std_logic_vector(1 downto 0);
122
  i_antext_stat   : in std_logic;
123
  i_antext_detect : in std_logic;
124
  o_antext_ena    : out std_logic;
125
  o_antint_contr  : out std_logic;
126
  --! @}
127
 
128
  --! Ethernet MAC PHY interface signals
129
  --! @{
130
  i_gmiiclk_p : in    std_ulogic;
131
  i_gmiiclk_n : in    std_ulogic;
132
  o_egtx_clk  : out   std_ulogic;
133
  i_etx_clk   : in    std_ulogic;
134
  i_erx_clk   : in    std_ulogic;
135
  i_erxd      : in    std_logic_vector(3 downto 0);
136
  i_erx_dv    : in    std_ulogic;
137
  i_erx_er    : in    std_ulogic;
138
  i_erx_col   : in    std_ulogic;
139
  i_erx_crs   : in    std_ulogic;
140
  i_emdint    : in std_ulogic;
141
  o_etxd      : out   std_logic_vector(3 downto 0);
142
  o_etx_en    : out   std_ulogic;
143
  o_etx_er    : out   std_ulogic;
144
  o_emdc      : out   std_ulogic;
145
  io_emdio    : inout std_logic;
146
  o_erstn     : out   std_ulogic
147
);
148
  --! @}
149
 
150
end riscv_soc_gnss;
151
 
152
--! @brief SOC top-level  architecture declaration.
153
architecture arch_riscv_soc_gnss of riscv_soc_gnss is
154
 
155
  --! @name Buffered in/out signals.
156
  --! @details All signals that are connected with in/out pads must be passed
157
  --!          through the dedicated buffere modules. For FPGA they are implemented
158
  --!          as an empty devices but ASIC couldn't be made without buffering.
159
  --! @{
160
  signal ib_rst     : std_logic;
161
  signal ib_clk_tcxo  : std_logic;
162
  signal ib_sclk_n  : std_logic;
163
  signal ib_clk_adc : std_logic;
164
  signal ib_dip     : std_logic_vector(3 downto 0);
165
  signal ib_gmiiclk : std_logic;
166
  --! @}
167
 
168
  signal w_ext_reset : std_ulogic; -- External system reset or PLL unlcoked. MUST NOT USED BY DEVICES.
169
  signal w_glob_rst  : std_ulogic; -- Global reset active HIGH
170
  signal w_glob_nrst : std_ulogic; -- Global reset active LOW
171
  signal w_soft_rst : std_ulogic; -- Software reset (acitve HIGH) from DSU
172
  signal w_bus_nrst : std_ulogic; -- Global reset and Soft Reset active LOW
173
  signal w_clk_bus  : std_ulogic; -- bus clock from the internal PLL (100MHz virtex6/40MHz Spartan6)
174
  signal w_clk_adc  : std_ulogic; -- 26 MHz from the internal PLL
175
  signal w_pll_lock : std_ulogic; -- PLL status signal. 0=Unlocked; 1=locked.
176
 
177
  signal uart1i : uart_in_type;
178
  signal uart1o : uart_out_type;
179
  -- debug port
180
  signal uart2i : uart_in_type;
181
  signal uart2o : uart_out_type;
182
 
183
  --! Arbiter is switching only slaves output signal, data from noc
184
  --! is connected to all slaves and to the arbiter itself.
185
  signal aximi   : nasti_master_in_vector;
186
  signal aximo   : nasti_master_out_vector;
187
  signal axisi   : nasti_slave_in_vector;
188
  signal axiso   : nasti_slaves_out_vector;
189
  signal slv_cfg : nasti_slave_cfg_vector;
190
  signal mst_cfg : nasti_master_cfg_vector;
191
  signal core_irqs : std_logic_vector(CFG_CORE_IRQ_TOTAL-1 downto 0);
192
  signal dport_i : dport_in_type;
193
  signal dport_o : dport_out_type;
194
  signal wb_miss_addr : std_logic_vector(CFG_NASTI_ADDR_BITS-1 downto 0);
195
  signal wb_bus_util_w : std_logic_vector(CFG_NASTI_MASTER_TOTAL-1 downto 0);
196
  signal wb_bus_util_r : std_logic_vector(CFG_NASTI_MASTER_TOTAL-1 downto 0);
197
 
198
  signal w_gnss_pps : std_logic;
199
 
200
  signal eth_i : eth_in_type;
201
  signal eth_o : eth_out_type;
202
 
203
  signal irq_pins : std_logic_vector(CFG_IRQ_TOTAL-1 downto 1);
204
begin
205
 
206
  --! PAD buffers:
207
  irst0   : ibuf_tech generic map(CFG_PADTECH) port map (ib_rst, i_rst);
208
  iclk1  : ibufg_tech generic map(CFG_PADTECH) port map (O => ib_clk_adc, I => i_clk_adc);
209
  idip0  : ibuf_tech generic map(CFG_PADTECH) port map (ib_dip(0), i_int_clkrf);
210
  dipx : for i in 1 to 3 generate
211
     idipz  : ibuf_tech generic map(CFG_PADTECH) port map (ib_dip(i), i_dip(i));
212
  end generate;
213
 
214
  iclk0 : idsbuf_tech generic map (CFG_PADTECH) port map (
215
         i_sclk_p, i_sclk_n, ib_clk_tcxo);
216
 
217
  igbebuf0 : igdsbuf_tech generic map (CFG_PADTECH) port map (
218
            i_gmiiclk_p, i_gmiiclk_n, ib_gmiiclk);
219
 
220
 
221
  --! @todo all other in/out signals via buffers:
222
 
223
  ------------------------------------
224
  -- @brief Internal PLL device instance.
225
  pll0 : SysPLL_tech generic map (
226
    tech => CFG_FABTECH
227
  ) port map (
228
    i_reset     => ib_rst,
229
    i_clk_tcxo  => ib_clk_tcxo,
230
    o_clk_bus   => w_clk_bus,
231
    o_locked    => w_pll_lock
232
  );
233
  w_ext_reset <= ib_rst or not w_pll_lock;
234
 
235
  w_clk_adc <= ib_clk_adc;
236
 
237
  ------------------------------------
238
  --! @brief System Reset device instance.
239
  rst0 : reset_global port map (
240
    inSysReset  => w_ext_reset,
241
    inSysClk    => w_clk_bus,
242
    inPllLock   => w_pll_lock,
243
    outReset    => w_glob_rst
244
  );
245
  w_glob_nrst <= not w_glob_rst;
246
  w_bus_nrst <= not (w_glob_rst or w_soft_rst);
247
 
248
  --! @brief AXI4 controller.
249
  ctrl0 : axictrl generic map (
250
    watchdog_memop => 0
251
  ) port map (
252
    i_clk    => w_clk_bus,
253
    i_nrst   => w_glob_nrst,
254
    i_slvcfg => slv_cfg,
255
    i_slvo   => axiso,
256
    i_msto   => aximo,
257
    o_slvi   => axisi,
258
    o_msti   => aximi,
259
    o_miss_irq  => irq_pins(CFG_IRQ_MISS_ACCESS),
260
    o_miss_addr => wb_miss_addr,
261
    o_bus_util_w => wb_bus_util_w, -- Bus write access utilization per master statistic
262
    o_bus_util_r => wb_bus_util_r  -- Bus read access utilization per master statistic
263
  );
264
 
265
  --! @brief RISC-V Processor core (River or Rocket).
266
river_ena : if CFG_COMMON_RIVER_CPU_ENABLE generate
267
  cpu0 : river_amba port map (
268
    i_nrst   => w_bus_nrst,
269
    i_clk    => w_clk_bus,
270
    i_msti   => aximi(CFG_NASTI_MASTER_CACHED),
271
    o_msto   => aximo(CFG_NASTI_MASTER_CACHED),
272
    o_mstcfg => mst_cfg(CFG_NASTI_MASTER_CACHED),
273
    i_dport => dport_i,
274
    o_dport => dport_o,
275
    i_ext_irq => core_irqs(CFG_CORE_IRQ_MEIP)
276
  );
277
  aximo(CFG_NASTI_MASTER_UNCACHED) <= nasti_master_out_none;
278
  mst_cfg(CFG_NASTI_MASTER_UNCACHED) <= nasti_master_config_none;
279
end generate;
280
 
281
--! DSU doesn't support Rocket-chip CPU
282
river_dis : if not CFG_COMMON_RIVER_CPU_ENABLE generate
283
  --! Not imlpemented interrupts:
284
  core_irqs(CFG_CORE_IRQ_MTIP) <= '0'; -- timer's
285
  core_irqs(CFG_CORE_IRQ_MSIP) <= '0'; -- software's
286
  core_irqs(CFG_CORE_IRQ_SEIP) <= '0'; -- superuser external interrupt
287
  core_irqs(CFG_CORE_IRQ_DEBUG) <= '0';
288
 
289
  cpu0 : rocket_l1only generic map (
290
    hartid  => 0,
291
    reset_vector => 16#1000#
292
  ) port map (
293
    nrst      => w_bus_nrst,
294
    clk_sys   => w_clk_bus,
295
    msti1     => aximi(CFG_NASTI_MASTER_CACHED),
296
    msto1     => aximo(CFG_NASTI_MASTER_CACHED),
297
    mstcfg1   => mst_cfg(CFG_NASTI_MASTER_CACHED),
298
    msti2     => aximi(CFG_NASTI_MASTER_UNCACHED),
299
    msto2     => aximo(CFG_NASTI_MASTER_UNCACHED),
300
    mstcfg2   => mst_cfg(CFG_NASTI_MASTER_UNCACHED),
301
    interrupts => core_irqs
302
  );
303
end generate;
304
 
305
dsu_ena : if CFG_DSU_ENABLE generate
306
  ------------------------------------
307
  --! @brief Debug Support Unit with access to the CSRs
308
  --! @details Map address:
309
  --!          0x80080000..0x8009ffff (128 KB total)
310
  dsu0 : axi_dsu generic map (
311
    xaddr    => 16#80080#,
312
    xmask    => 16#fffe0#
313
  ) port map (
314
    clk    => w_clk_bus,
315
    nrst   => w_glob_nrst,
316
    o_cfg  => slv_cfg(CFG_NASTI_SLAVE_DSU),
317
    i_axi  => axisi(CFG_NASTI_SLAVE_DSU),
318
    o_axi  => axiso(CFG_NASTI_SLAVE_DSU),
319
    o_dporti => dport_i,
320
    i_dporto => dport_o,
321
    o_soft_rst => w_soft_rst,
322
    -- Run time platform statistic signals:
323
    i_miss_irq  => irq_pins(CFG_IRQ_MISS_ACCESS),
324
    i_miss_addr => wb_miss_addr,
325
    i_bus_util_w => wb_bus_util_w, -- Write access bus utilization per master statistic
326
    i_bus_util_r => wb_bus_util_r  -- Read access bus utilization per master statistic
327
  );
328
end generate;
329
dsu_dis : if not CFG_DSU_ENABLE generate
330
    slv_cfg(CFG_NASTI_SLAVE_DSU) <= nasti_slave_config_none;
331
    axiso(CFG_NASTI_SLAVE_DSU) <= nasti_slave_out_none;
332
    dport_i <= dport_in_none;
333
end generate;
334
 
335
  ------------------------------------
336
  --! @brief TAP via UART (debug port) with master interface.
337
  uart2i.cts   <= not i_uart2_ctsn;
338
  uart2i.rd    <= i_uart2_rd;
339
  uart2 : uart_tap  port map (
340
    nrst   => w_glob_nrst,
341
    clk    => w_clk_bus,
342
    i_uart   => uart2i,
343
    o_uart   => uart2o,
344
    i_msti   => aximi(CFG_NASTI_MASTER_MSTUART),
345
    o_msto   => aximo(CFG_NASTI_MASTER_MSTUART),
346
    o_mstcfg => mst_cfg(CFG_NASTI_MASTER_MSTUART)
347
  );
348
  o_uart2_td  <= uart2o.td;
349
  o_uart2_rtsn <= not uart2o.rts;
350
 
351
 
352
  ------------------------------------
353
  --! @brief BOOT ROM module isntance with the AXI4 interface.
354
  --! @details Map address:
355
  --!          0x00000000..0x00001fff (8 KB total)
356
  boot0 : nasti_bootrom generic map (
357
    memtech  => CFG_MEMTECH,
358
    xaddr    => 16#00000#,
359
    xmask    => 16#ffffe#,
360
    sim_hexfile => CFG_SIM_BOOTROM_HEX
361
  ) port map (
362
    clk  => w_clk_bus,
363
    nrst => w_glob_nrst,
364
    cfg  => slv_cfg(CFG_NASTI_SLAVE_BOOTROM),
365
    i    => axisi(CFG_NASTI_SLAVE_BOOTROM),
366
    o    => axiso(CFG_NASTI_SLAVE_BOOTROM)
367
  );
368
 
369
  ------------------------------------
370
  --! @brief Firmware Image ROM with the AXI4 interface.
371
  --! @details Map address:
372
  --!          0x00100000..0x0013ffff (256 KB total)
373
  --! @warning Don't forget to change ROM_ADDR_WIDTH in rom implementation
374
  img0 : nasti_romimage generic map (
375
    memtech  => CFG_MEMTECH,
376
    xaddr    => 16#00100#,
377
    xmask    => 16#fffc0#,
378
    sim_hexfile => CFG_SIM_FWIMAGE_HEX
379
  ) port map (
380
    clk  => w_clk_bus,
381
    nrst => w_glob_nrst,
382
    cfg  => slv_cfg(CFG_NASTI_SLAVE_ROMIMAGE),
383
    i    => axisi(CFG_NASTI_SLAVE_ROMIMAGE),
384
    o    => axiso(CFG_NASTI_SLAVE_ROMIMAGE)
385
  );
386
 
387
  ------------------------------------
388
  --! Internal SRAM module instance with the AXI4 interface.
389
  --! @details Map address:
390
  --!          0x10000000..0x1007ffff (512 KB total)
391
  sram0 : nasti_sram generic map (
392
    memtech  => CFG_MEMTECH,
393
    xaddr    => 16#10000#,
394
    xmask    => 16#fff80#,            -- 512 KB mask
395
    abits    => (10 + log2(512)),     -- 512 KB address
396
    init_file => CFG_SIM_FWIMAGE_HEX  -- Used only for inferred
397
  ) port map (
398
    clk  => w_clk_bus,
399
    nrst => w_glob_nrst,
400
    cfg  => slv_cfg(CFG_NASTI_SLAVE_SRAM),
401
    i    => axisi(CFG_NASTI_SLAVE_SRAM),
402
    o    => axiso(CFG_NASTI_SLAVE_SRAM)
403
  );
404
 
405
 
406
  ------------------------------------
407
  --! @brief Controller of the LEDs, DIPs and GPIO with the AXI4 interface.
408
  --! @details Map address:
409
  --!          0x80000000..0x80000fff (4 KB total)
410
  gpio0 : nasti_gpio generic map (
411
    xaddr    => 16#80000#,
412
    xmask    => 16#fffff#,
413
    xirq     => 0
414
  ) port map (
415
    clk   => w_clk_bus,
416
    nrst  => w_glob_nrst,
417
    cfg   => slv_cfg(CFG_NASTI_SLAVE_GPIO),
418
    i     => axisi(CFG_NASTI_SLAVE_GPIO),
419
    o     => axiso(CFG_NASTI_SLAVE_GPIO),
420
    i_dip => ib_dip,
421
    o_led => o_led
422
  );
423
 
424
 
425
  ------------------------------------
426
  uart1i.cts   <= not i_uart1_ctsn;
427
  uart1i.rd    <= i_uart1_rd;
428
 
429
  --! @brief UART Controller with the AXI4 interface.
430
  --! @details Map address:
431
  --!          0x80001000..0x80001fff (4 KB total)
432
  uart1 : nasti_uart generic map (
433
    xaddr    => 16#80001#,
434
    xmask    => 16#FFFFF#,
435
         xirq     => CFG_IRQ_UART1,
436
    fifosz   => 16
437
  ) port map (
438
    nrst   => w_glob_nrst,
439
    clk    => w_clk_bus,
440
    cfg    => slv_cfg(CFG_NASTI_SLAVE_UART1),
441
    i_uart => uart1i,
442
    o_uart => uart1o,
443
    i_axi  => axisi(CFG_NASTI_SLAVE_UART1),
444
    o_axi  => axiso(CFG_NASTI_SLAVE_UART1),
445
    o_irq  => irq_pins(CFG_IRQ_UART1)
446
  );
447
  o_uart1_td  <= uart1o.td;
448
  o_uart1_rtsn <= not uart1o.rts;
449
 
450
 
451
  ------------------------------------
452
  --! @brief Interrupt controller with the AXI4 interface.
453
  --! @details Map address:
454
  --!          0x80002000..0x80002fff (4 KB total)
455
  irq0 : nasti_irqctrl generic map (
456
    xaddr      => 16#80002#,
457
    xmask      => 16#FFFFF#
458
  ) port map (
459
    clk    => w_clk_bus,
460
    nrst   => w_bus_nrst,
461
    i_irqs => irq_pins,
462
    o_cfg  => slv_cfg(CFG_NASTI_SLAVE_IRQCTRL),
463
    i_axi  => axisi(CFG_NASTI_SLAVE_IRQCTRL),
464
    o_axi  => axiso(CFG_NASTI_SLAVE_IRQCTRL),
465
    o_irq_meip => core_irqs(CFG_CORE_IRQ_MEIP)
466
  );
467
 
468
  ------------------------------------
469
  --! @brief GNSS Engine stub with the AXI4 interface.
470
  --! @details Map address:
471
  --!          0x80003000..0x80003fff (4 KB total)
472
    gnss0 : gnssengine  generic map (
473
      tech    => CFG_MEMTECH,
474
      xaddr   => 16#80003#,
475
      xmask   => 16#FFFFF#,
476
      xirq    => CFG_IRQ_GNSSENGINE
477
    ) port map (
478
      nrst         => w_glob_nrst,
479
      clk_bus      => w_clk_bus,
480
      clk_adc      => w_clk_adc,
481
      o_cfg        => slv_cfg(CFG_NASTI_SLAVE_ENGINE),
482
      i_axi        => axisi(CFG_NASTI_SLAVE_ENGINE),
483
      o_axi        => axiso(CFG_NASTI_SLAVE_ENGINE),
484
      i_gps_I      => i_gps_I,
485
      i_gps_Q      => i_gps_Q,
486
      i_glo_I      => i_glo_I,
487
      i_glo_Q      => i_glo_Q,
488
      o_ms_pulse   => irq_pins(CFG_IRQ_GNSSENGINE),
489
      o_pps        => w_gnss_pps
490
    );
491
 
492
  --! @brief RF front-end controller with the AXI4 interface.
493
  --! @details Map address:
494
  --!          0x80004000..0x80004fff (4 KB total)
495
    rf0 : axi_rfctrl generic map (
496
      xaddr  => 16#80004#,
497
      xmask  => 16#fffff#
498
    ) port map (
499
      nrst           => w_glob_nrst,
500
      clk            => w_clk_bus,
501
      o_cfg          => slv_cfg(CFG_NASTI_SLAVE_RFCTRL),
502
      i_axi          => axisi(CFG_NASTI_SLAVE_RFCTRL),
503
      o_axi          => axiso(CFG_NASTI_SLAVE_RFCTRL),
504
      i_gps_ld       => i_gps_ld,
505
      i_glo_ld       => i_glo_ld,
506
      outSCLK        => o_max_sclk,
507
      outSDATA       => o_max_sdata,
508
      outCSn         => o_max_ncs,
509
      inExtAntStat   => i_antext_stat,
510
      inExtAntDetect => i_antext_detect,
511
      outExtAntEna   => o_antext_ena,
512
      outIntAntContr => o_antint_contr
513
    );
514
 
515
  --! @brief Timers with the AXI4 interface.
516
  --! @details Map address:
517
  --!          0x80005000..0x80005fff (4 KB total)
518
  gptmr0 : nasti_gptimers  generic map (
519
    xaddr     => 16#80005#,
520
    xmask     => 16#fffff#,
521
         xirq      => CFG_IRQ_GPTIMERS,
522
    tmr_total => 2
523
  ) port map (
524
    clk    => w_clk_bus,
525
    nrst   => w_glob_nrst,
526
    cfg    => slv_cfg(CFG_NASTI_SLAVE_GPTIMERS),
527
    i_axi  => axisi(CFG_NASTI_SLAVE_GPTIMERS),
528
    o_axi  => axiso(CFG_NASTI_SLAVE_GPTIMERS),
529
    o_irq  => irq_pins(CFG_IRQ_GPTIMERS)
530
  );
531
 
532
  --! @brief GPS-CA Fast Search Engine with the AXI4 interface.
533
  --! @details Map address:
534
  --!          0x8000a000..0x8000afff (4 KB total)
535
  fse0_ena : if CFG_GNSSLIB_FSEGPS_ENABLE generate
536
      fse0 : TopFSE generic map (
537
        tech   => CFG_MEMTECH,
538
        xaddr  => 16#8000a#,
539
        xmask  => 16#fffff#,
540
        sys    => GEN_SYSTEM_GPSCA
541
      ) port map (
542
        nrst         => w_glob_nrst,
543
        clk_bus      => w_clk_bus,
544
        clk_adc      => w_clk_adc,
545
        o_cfg        => slv_cfg(CFG_NASTI_SLAVE_FSE_GPS),
546
        i_axi        => axisi(CFG_NASTI_SLAVE_FSE_GPS),
547
        o_axi        => axiso(CFG_NASTI_SLAVE_FSE_GPS),
548
        i_I          => i_gps_I,
549
        i_Q          => i_gps_Q,
550
        i_ms_pulse   => irq_pins(CFG_IRQ_GNSSENGINE),
551
        i_pps        => w_gnss_pps,
552
        i_2ms_only   => '0'
553
      );
554
 
555
--  axi0 : axi_recorder generic map (
556
--    tech     => CFG_MEMTECH,
557
--    xaddr    => 16#800a0#,   -- 64 KB
558
--    xmask    => 16#ffff0#
559
--  ) port map (
560
--    nrst     => w_glob_nrst,
561
--    clk_bus  => w_clk_bus,
562
--    clk_adc  => w_clk_adc,
563
--    o_cfg    => slv_cfg(CFG_NASTI_SLAVE_FSE_GPS),
564
--    i_axi    => axisi(CFG_NASTI_SLAVE_FSE_GPS),
565
--    o_axi    => axiso(CFG_NASTI_SLAVE_FSE_GPS),
566
--    i_gps_I  => i_gps_I,
567
--    i_gps_Q  => i_gps_Q
568
--  );
569
 
570
  end generate;
571
  --! FSE GPS disable
572
  fse0_dis : if not CFG_GNSSLIB_FSEGPS_ENABLE generate
573
      slv_cfg(CFG_NASTI_SLAVE_FSE_GPS) <= nasti_slave_config_none;
574
      axiso(CFG_NASTI_SLAVE_FSE_GPS) <= nasti_slave_out_none;
575
  end generate;
576
 
577
  --! Gigabit clock phase rotator with buffers
578
  clkrot90 : clkp90_tech  generic map (
579
    tech    => CFG_FABTECH,
580
    freq    => 125000   -- KHz = 125 MHz
581
  ) port map (
582
    i_rst    => w_glob_rst,
583
    i_clk    => ib_gmiiclk,
584
    o_clk    => eth_i.gtx_clk,
585
    o_clkp90 => eth_i.tx_clk_90,
586
    o_clk2x  => open, -- used in gbe 'io_ref'
587
    o_lock   => open
588
  );
589
 
590
 
591
  --! @brief Ethernet MAC with the AXI4 interface.
592
  --! @details Map address:
593
  --!          0x80040000..0x8007ffff (256 KB total)
594
  --!          EDCL IP: 192.168.1.51 = C0.A8.01.33
595
  eth0_ena : if CFG_ETHERNET_ENABLE generate
596
    eth_i.tx_clk <= i_etx_clk;
597
    eth_i.rx_clk <= i_erx_clk;
598
    eth_i.rxd <= i_erxd;
599
    eth_i.rx_dv <= i_erx_dv;
600
    eth_i.rx_er <= i_erx_er;
601
    eth_i.rx_col <= i_erx_col;
602
    eth_i.rx_crs <= i_erx_crs;
603
    eth_i.mdint <= i_emdint;
604
 
605
    mac0 : grethaxi generic map (
606
      xaddr => 16#80040#,
607
      xmask => 16#FFFC0#,
608
      xirq => CFG_IRQ_ETHMAC,
609
      memtech => CFG_MEMTECH,
610
      mdcscaler => 60,  --! System Bus clock in MHz
611
      enable_mdio => 1,
612
      fifosize => 16,
613
      nsync => 1,
614
      edcl => 1,
615
      edclbufsz => 16,
616
      macaddrh => 16#20789#,
617
      macaddrl => 16#123#,
618
      ipaddrh => 16#C0A8#,
619
      ipaddrl => 16#0033#,
620
      phyrstadr => 7,
621
      enable_mdint => 1,
622
      maxsize => 1518
623
   ) port map (
624
      rst => w_glob_nrst,
625
      clk => w_clk_bus,
626
      msti => aximi(CFG_NASTI_MASTER_ETHMAC),
627
      msto => aximo(CFG_NASTI_MASTER_ETHMAC),
628
      mstcfg => mst_cfg(CFG_NASTI_MASTER_ETHMAC),
629
      msto2 => open,    -- EDCL separate access is disabled
630
      mstcfg2 => open,  -- EDCL separate access is disabled
631
      slvi => axisi(CFG_NASTI_SLAVE_ETHMAC),
632
      slvo => axiso(CFG_NASTI_SLAVE_ETHMAC),
633
      slvcfg => slv_cfg(CFG_NASTI_SLAVE_ETHMAC),
634
      ethi => eth_i,
635
      etho => eth_o,
636
      irq => irq_pins(CFG_IRQ_ETHMAC)
637
    );
638
 
639
  end generate;
640
  --! Ethernet disabled
641
  eth0_dis : if not CFG_ETHERNET_ENABLE generate
642
      slv_cfg(CFG_NASTI_SLAVE_ETHMAC) <= nasti_slave_config_none;
643
      axiso(CFG_NASTI_SLAVE_ETHMAC) <= nasti_slave_out_none;
644
      mst_cfg(CFG_NASTI_MASTER_ETHMAC) <= nasti_master_config_none;
645
      aximo(CFG_NASTI_MASTER_ETHMAC) <= nasti_master_out_none;
646
      irq_pins(CFG_IRQ_ETHMAC) <= '0';
647
      eth_o   <= eth_out_none;
648
  end generate;
649
 
650
 
651
  emdio_pad : iobuf_tech generic map(
652
      CFG_PADTECH
653
  ) port map (
654
      o  => eth_i.mdio_i,
655
      io => io_emdio,
656
      i  => eth_o.mdio_o,
657
      t  => eth_o.mdio_oe
658
  );
659
  o_egtx_clk <= eth_i.gtx_clk;--eth_i.tx_clk_90;
660
  o_etxd <= eth_o.txd;
661
  o_etx_en <= eth_o.tx_en;
662
  o_etx_er <= eth_o.tx_er;
663
  o_emdc <= eth_o.mdc;
664
  o_erstn <= w_glob_nrst;
665
 
666
 
667
  --! @brief Plug'n'Play controller of the current configuration with the
668
  --!        AXI4 interface.
669
  --! @details Map address:
670
  --!          0xfffff000..0xffffffff (4 KB total)
671
  pnp0 : nasti_pnp generic map (
672
    xaddr   => 16#fffff#,
673
    xmask   => 16#fffff#,
674
    tech    => CFG_MEMTECH,
675
    hw_id   => CFG_HW_ID
676
  ) port map (
677
    sys_clk => w_clk_bus,
678
    adc_clk => w_clk_adc,
679
    nrst   => w_glob_nrst,
680
    mstcfg => mst_cfg,
681
    slvcfg => slv_cfg,
682
    cfg    => slv_cfg(CFG_NASTI_SLAVE_PNP),
683
    i      => axisi(CFG_NASTI_SLAVE_PNP),
684
    o      => axiso(CFG_NASTI_SLAVE_PNP)
685
  );
686
 
687
 
688
end arch_riscv_soc_gnss;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.