1 |
5 |
sergeykhbr |
-----------------------------------------------------------------------------
|
2 |
|
|
--! @file
|
3 |
|
|
--! @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
|
4 |
|
|
--! @author Sergey Khabarov - sergeykhbr@gmail.com
|
5 |
|
|
--! @brief "River" CPU library external interfaces
|
6 |
|
|
-----------------------------------------------------------------------------
|
7 |
|
|
|
8 |
|
|
--! Standard library.
|
9 |
|
|
library ieee;
|
10 |
|
|
use ieee.std_logic_1164.all;
|
11 |
|
|
use ieee.numeric_std.all;
|
12 |
|
|
library commonlib;
|
13 |
|
|
use commonlib.types_common.all;
|
14 |
|
|
--! AMBA system bus specific library.
|
15 |
|
|
library ambalib;
|
16 |
|
|
--! AXI4 configuration constants.
|
17 |
|
|
use ambalib.types_amba4.all;
|
18 |
|
|
--! RIVER CPU specific library.
|
19 |
|
|
library riverlib;
|
20 |
|
|
--! RIVER CPU configuration constants.
|
21 |
|
|
use riverlib.river_cfg.all;
|
22 |
|
|
|
23 |
|
|
--! @brief Declaration of components visible on SoC top level.
|
24 |
|
|
package types_river is
|
25 |
|
|
|
26 |
|
|
type dport_in_type is record
|
27 |
|
|
valid : std_logic;
|
28 |
|
|
write : std_logic;
|
29 |
|
|
region : std_logic_vector(1 downto 0);
|
30 |
|
|
addr : std_logic_vector(11 downto 0);
|
31 |
|
|
wdata : std_logic_vector(RISCV_ARCH-1 downto 0);
|
32 |
|
|
end record;
|
33 |
|
|
|
34 |
|
|
constant dport_in_none : dport_in_type := (
|
35 |
|
|
'0', '0', (others => '0'), (others => '0'), (others => '0'));
|
36 |
|
|
|
37 |
|
|
type dport_out_type is record
|
38 |
|
|
ready : std_logic;
|
39 |
|
|
rdata : std_logic_vector(RISCV_ARCH-1 downto 0);
|
40 |
|
|
end record;
|
41 |
|
|
|
42 |
|
|
--! @brief Declaration of the Debug Support Unit with the AXI interface.
|
43 |
|
|
--! @details This module provides access to processors CSRs via HostIO bus.
|
44 |
|
|
--! @param[in] clk System clock (BUS/CPU clock).
|
45 |
|
|
--! @param[in] rstn Reset signal with active LOW level.
|
46 |
|
|
--! @param[in] i_axi Slave slot input signals.
|
47 |
|
|
--! @param[out] o_axi Slave slot output signals.
|
48 |
|
|
--! @param[out] o_dporti Debug port output signals connected to River CPU.
|
49 |
|
|
--! @param[in] i_dporto River CPU debug port response signals.
|
50 |
|
|
--! @param[out] o_soft_rstn Software reset CPU and interrupt controller. Active HIGH
|
51 |
|
|
--! @param[in] i_miss_irq Miss access counter update signal
|
52 |
|
|
--! @param[in] i_miss_addr Miss accessed memory address
|
53 |
|
|
--! @param[in] i_bus_util_w Write bus access utilization per master statistic
|
54 |
|
|
--! @param[in] i_bus_util_r Write bus access utilization per master statistic
|
55 |
|
|
component axi_dsu is
|
56 |
|
|
generic (
|
57 |
|
|
xaddr : integer := 0;
|
58 |
|
|
xmask : integer := 16#fffff#
|
59 |
|
|
);
|
60 |
|
|
port
|
61 |
|
|
(
|
62 |
|
|
clk : in std_logic;
|
63 |
|
|
nrst : in std_logic;
|
64 |
|
|
o_cfg : out nasti_slave_config_type;
|
65 |
|
|
i_axi : in nasti_slave_in_type;
|
66 |
|
|
o_axi : out nasti_slave_out_type;
|
67 |
|
|
o_dporti : out dport_in_type;
|
68 |
|
|
i_dporto : in dport_out_type;
|
69 |
|
|
o_soft_rst : out std_logic;
|
70 |
|
|
i_miss_irq : in std_logic;
|
71 |
|
|
i_miss_addr : in std_logic_vector(CFG_NASTI_ADDR_BITS-1 downto 0);
|
72 |
|
|
i_bus_util_w : in std_logic_vector(CFG_NASTI_MASTER_TOTAL-1 downto 0);
|
73 |
|
|
i_bus_util_r : in std_logic_vector(CFG_NASTI_MASTER_TOTAL-1 downto 0)
|
74 |
|
|
);
|
75 |
|
|
end component;
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
--! @brief RIVER CPU component declaration.
|
79 |
|
|
--! @details This module implements Risc-V CPU Core named as
|
80 |
|
|
--! "RIVER" with AXI interface.
|
81 |
|
|
--! @param[in] xindex AXI master index
|
82 |
|
|
--! @param[in] i_rstn Reset signal with active LOW level.
|
83 |
|
|
--! @param[in] i_clk System clock (BUS/CPU clock).
|
84 |
|
|
--! @param[in] i_msti Bus-to-Master device signals.
|
85 |
|
|
--! @param[out] o_msto CachedTile-to-Bus request signals.
|
86 |
|
|
--! @param[in] i_ext_irq Interrupts line supported by Rocket chip.
|
87 |
|
|
component river_amba is
|
88 |
|
|
port (
|
89 |
|
|
i_nrst : in std_logic;
|
90 |
|
|
i_clk : in std_logic;
|
91 |
|
|
i_msti : in nasti_master_in_type;
|
92 |
|
|
o_msto : out nasti_master_out_type;
|
93 |
|
|
o_mstcfg : out nasti_master_config_type;
|
94 |
|
|
i_dport : in dport_in_type;
|
95 |
|
|
o_dport : out dport_out_type;
|
96 |
|
|
i_ext_irq : in std_logic
|
97 |
|
|
);
|
98 |
|
|
end component;
|
99 |
|
|
|
100 |
|
|
end; -- package body
|