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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [system_integration/] [neorv32_ProcessorTop_stdlogic.vhd] - Blame information for rev 72

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 63 zero_gravi
-- #################################################################################################
2
-- # << NEORV32 - Processor Top Entity with Resolved Port Signals (std_logic/std_logic_vector) >>  #
3
-- # ********************************************************************************************* #
4
-- # BSD 3-Clause License                                                                          #
5
-- #                                                                                               #
6 70 zero_gravi
-- # Copyright (c) 2022, Stephan Nolting. All rights reserved.                                     #
7 63 zero_gravi
-- #                                                                                               #
8
-- # Redistribution and use in source and binary forms, with or without modification, are          #
9
-- # permitted provided that the following conditions are met:                                     #
10
-- #                                                                                               #
11
-- # 1. Redistributions of source code must retain the above copyright notice, this list of        #
12
-- #    conditions and the following disclaimer.                                                   #
13
-- #                                                                                               #
14
-- # 2. Redistributions in binary form must reproduce the above copyright notice, this list of     #
15
-- #    conditions and the following disclaimer in the documentation and/or other materials        #
16
-- #    provided with the distribution.                                                            #
17
-- #                                                                                               #
18
-- # 3. Neither the name of the copyright holder nor the names of its contributors may be used to  #
19
-- #    endorse or promote products derived from this software without specific prior written      #
20
-- #    permission.                                                                                #
21
-- #                                                                                               #
22
-- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS   #
23
-- # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF               #
24
-- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE    #
25
-- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,     #
26
-- # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
27
-- # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED    #
28
-- # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     #
29
-- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  #
30
-- # OF THE POSSIBILITY OF SUCH DAMAGE.                                                            #
31
-- # ********************************************************************************************* #
32
-- # The NEORV32 Processor - https://github.com/stnolting/neorv32              (c) Stephan Nolting #
33
-- #################################################################################################
34
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
 
39
library neorv32;
40
use neorv32.neorv32_package.all;
41
 
42
entity neorv32_ProcessorTop_stdlogic is
43
  generic (
44
    -- General --
45
    CLOCK_FREQUENCY              : natural := 0;      -- clock frequency of clk_i in Hz
46
    INT_BOOTLOADER_EN            : boolean := true;   -- boot configuration: true = boot explicit bootloader; false = boot from int/ext (I)MEM
47
    HW_THREAD_ID                 : natural := 0;      -- hardware thread id (32-bit)
48
    -- On-Chip Debugger (OCD) --
49
    ON_CHIP_DEBUGGER_EN          : boolean := false;  -- implement on-chip debugger
50
    -- RISC-V CPU Extensions --
51
    CPU_EXTENSION_RISCV_A        : boolean := false;  -- implement atomic extension?
52 66 zero_gravi
    CPU_EXTENSION_RISCV_B        : boolean := false;  -- implement bit-manipulation extension?
53 63 zero_gravi
    CPU_EXTENSION_RISCV_C        : boolean := false;  -- implement compressed extension?
54
    CPU_EXTENSION_RISCV_E        : boolean := false;  -- implement embedded RF extension?
55
    CPU_EXTENSION_RISCV_M        : boolean := false;  -- implement muld/div extension?
56
    CPU_EXTENSION_RISCV_U        : boolean := false;  -- implement user mode extension?
57
    CPU_EXTENSION_RISCV_Zfinx    : boolean := false;  -- implement 32-bit floating-point extension (using INT reg!)
58
    CPU_EXTENSION_RISCV_Zicsr    : boolean := true;   -- implement CSR system?
59 66 zero_gravi
    CPU_EXTENSION_RISCV_Zicntr   : boolean := true;   -- implement base counters?
60
    CPU_EXTENSION_RISCV_Zihpm    : boolean := false;  -- implement hardware performance monitors?
61 63 zero_gravi
    CPU_EXTENSION_RISCV_Zifencei : boolean := false;  -- implement instruction stream sync.?
62 72 zero_gravi
    CPU_EXTENSION_RISCV_Zmmul    : boolean := false;  -- implement multiply-only M sub-extension?
63
    CPU_EXTENSION_RISCV_Zxcfu    : boolean := false;  -- implement custom (instr.) functions unit?
64 63 zero_gravi
    -- Extension Options --
65
    FAST_MUL_EN                  : boolean := false;  -- use DSPs for M extension's multiplier
66
    FAST_SHIFT_EN                : boolean := false;  -- use barrel shifter for shift operations
67
    CPU_CNT_WIDTH                : natural := 64;     -- total width of CPU cycle and instret counters (0..64)
68
    -- Physical Memory Protection (PMP) --
69
    PMP_NUM_REGIONS              : natural := 0;      -- number of regions (0..64)
70
    PMP_MIN_GRANULARITY          : natural := 64*1024; -- minimal region granularity in bytes, has to be a power of 2, min 8 bytes
71
    -- Hardware Performance Monitors (HPM) --
72
    HPM_NUM_CNTS                 : natural := 0;      -- number of implemented HPM counters (0..29)
73
    HPM_CNT_WIDTH                : natural := 40;     -- total size of HPM counters (0..64)
74
    -- Internal Instruction memory --
75
    MEM_INT_IMEM_EN              : boolean := true;   -- implement processor-internal instruction memory
76
    MEM_INT_IMEM_SIZE            : natural := 16*1024; -- size of processor-internal instruction memory in bytes
77
    -- Internal Data memory --
78
    MEM_INT_DMEM_EN              : boolean := true;   -- implement processor-internal data memory
79
    MEM_INT_DMEM_SIZE            : natural := 8*1024; -- size of processor-internal data memory in bytes
80
    -- Internal Cache memory --
81
    ICACHE_EN                    : boolean := false;  -- implement instruction cache
82
    ICACHE_NUM_BLOCKS            : natural := 4;      -- i-cache: number of blocks (min 1), has to be a power of 2
83
    ICACHE_BLOCK_SIZE            : natural := 64;     -- i-cache: block size in bytes (min 4), has to be a power of 2
84
    ICACHE_ASSOCIATIVITY         : natural := 1;      -- i-cache: associativity / number of sets (1=direct_mapped), has to be a power of 2
85
    -- External memory interface --
86
    MEM_EXT_EN                   : boolean := false;  -- implement external memory bus interface?
87
    MEM_EXT_TIMEOUT              : natural := 255;    -- cycles after a pending bus access auto-terminates (0 = disabled)
88
    MEM_EXT_PIPE_MODE            : boolean := false;  -- protocol: false=classic/standard wishbone mode, true=pipelined wishbone mode
89
    MEM_EXT_BIG_ENDIAN           : boolean := false;  -- byte order: true=big-endian, false=little-endian
90
    MEM_EXT_ASYNC_RX             : boolean := false;  -- use register buffer for RX data when false
91
    -- Stream link interface --
92
    SLINK_NUM_TX                 : natural := 0;      -- number of TX links (0..8)
93
    SLINK_NUM_RX                 : natural := 0;      -- number of TX links (0..8)
94
    SLINK_TX_FIFO                : natural := 1;      -- TX fifo depth, has to be a power of two
95
    SLINK_RX_FIFO                : natural := 1;      -- RX fifo depth, has to be a power of two
96
    -- External Interrupts Controller (XIRQ) --
97
    XIRQ_NUM_CH                  : natural := 0;      -- number of external IRQ channels (0..32)
98
    XIRQ_TRIGGER_TYPE            : std_logic_vector(31 downto 0) := (others => '1'); -- trigger type: 0=level, 1=edge
99
    XIRQ_TRIGGER_POLARITY        : std_logic_vector(31 downto 0) := (others => '1'); -- trigger polarity: 0=low-level/falling-edge, 1=high-level/rising-edge
100
    -- Processor peripherals --
101
    IO_GPIO_EN                   : boolean := true;   -- implement general purpose input/output port unit (GPIO)?
102
    IO_MTIME_EN                  : boolean := true;   -- implement machine system timer (MTIME)?
103
    IO_UART0_EN                  : boolean := true;   -- implement primary universal asynchronous receiver/transmitter (UART0)?
104 65 zero_gravi
    IO_UART0_RX_FIFO             : natural := 1;      -- RX fifo depth, has to be a power of two, min 1
105
    IO_UART0_TX_FIFO             : natural := 1;      -- TX fifo depth, has to be a power of two, min 1
106 63 zero_gravi
    IO_UART1_EN                  : boolean := true;   -- implement secondary universal asynchronous receiver/transmitter (UART1)?
107 65 zero_gravi
    IO_UART1_RX_FIFO             : natural := 1;      -- RX fifo depth, has to be a power of two, min 1
108
    IO_UART1_TX_FIFO             : natural := 1;      -- TX fifo depth, has to be a power of two, min 1
109 63 zero_gravi
    IO_SPI_EN                    : boolean := true;   -- implement serial peripheral interface (SPI)?
110
    IO_TWI_EN                    : boolean := true;   -- implement two-wire interface (TWI)?
111
    IO_PWM_NUM_CH                : natural := 4;      -- number of PWM channels to implement (0..60); 0 = disabled
112
    IO_WDT_EN                    : boolean := true;   -- implement watch dog timer (WDT)?
113
    IO_TRNG_EN                   : boolean := false;  -- implement true random number generator (TRNG)?
114
    IO_CFS_EN                    : boolean := false;  -- implement custom functions subsystem (CFS)?
115
    IO_CFS_CONFIG                : std_ulogic_vector(31 downto 0); -- custom CFS configuration generic
116
    IO_CFS_IN_SIZE               : positive := 32;    -- size of CFS input conduit in bits
117
    IO_CFS_OUT_SIZE              : positive := 32;    -- size of CFS output conduit in bits
118 67 zero_gravi
    IO_NEOLED_EN                 : boolean := true;   -- implement NeoPixel-compatible smart LED interface (NEOLED)?
119 70 zero_gravi
    IO_GPTMR_EN                  : boolean := false;  -- implement general purpose timer (GPTMR)?
120
    IO_XIP_EN                    : boolean := false   -- implement execute in place module (XIP)?
121 63 zero_gravi
  );
122
  port (
123
    -- Global control --
124
    clk_i          : in  std_logic := '0'; -- global clock, rising edge
125
    rstn_i         : in  std_logic := '0'; -- global reset, low-active, async
126
    -- JTAG on-chip debugger interface (available if ON_CHIP_DEBUGGER_EN = true) --
127
    jtag_trst_i    : in  std_logic := '0'; -- low-active TAP reset (optional)
128
    jtag_tck_i     : in  std_logic := '0'; -- serial clock
129
    jtag_tdi_i     : in  std_logic := '0'; -- serial data input
130
    jtag_tdo_o     : out std_logic;        -- serial data output
131
    jtag_tms_i     : in  std_logic := '0'; -- mode select
132
    -- Wishbone bus interface (available if MEM_EXT_EN = true) --
133
    wb_tag_o       : out std_logic_vector(02 downto 0); -- tag
134
    wb_adr_o       : out std_logic_vector(31 downto 0); -- address
135
    wb_dat_i       : in  std_logic_vector(31 downto 0) := (others => '0'); -- read data
136
    wb_dat_o       : out std_logic_vector(31 downto 0); -- write data
137
    wb_we_o        : out std_logic; -- read/write
138
    wb_sel_o       : out std_logic_vector(03 downto 0); -- byte enable
139
    wb_stb_o       : out std_logic; -- strobe
140
    wb_cyc_o       : out std_logic; -- valid cycle
141
    wb_lock_o      : out std_logic; -- exclusive access request
142
    wb_ack_i       : in  std_logic := '0'; -- transfer acknowledge
143
    wb_err_i       : in  std_logic := '0'; -- transfer error
144
    -- Advanced memory control signals (available if MEM_EXT_EN = true) --
145
    fence_o        : out std_logic; -- indicates an executed FENCE operation
146
    fencei_o       : out std_logic; -- indicates an executed FENCEI operation
147 70 zero_gravi
    -- XIP (execute in place via SPI) signals (available if IO_XIP_EN = true) --
148
    xip_csn_o      : out std_logic; -- chip-select, low-active
149
    xip_clk_o      : out std_logic; -- serial clock
150
    xip_sdi_i      : in  std_logic := 'L'; -- device data input
151
    xip_sdo_o      : out std_logic; -- controller data output
152 63 zero_gravi
    -- TX stream interfaces (available if SLINK_NUM_TX > 0) --
153
    slink_tx_dat_o : out sdata_8x32r_t; -- output data
154
    slink_tx_val_o : out std_logic_vector(7 downto 0); -- valid output
155
    slink_tx_rdy_i : in  std_logic_vector(7 downto 0) := (others => '0'); -- ready to send
156
    -- RX stream interfaces (available if SLINK_NUM_RX > 0) --
157
    slink_rx_dat_i : in  sdata_8x32r_t := (others => (others => '0')); -- input data
158
    slink_rx_val_i : in  std_logic_vector(7 downto 0) := (others => '0'); -- valid input
159
    slink_rx_rdy_o : out std_logic_vector(7 downto 0); -- ready to receive
160
    -- GPIO (available if IO_GPIO_EN = true) --
161
    gpio_o         : out std_logic_vector(63 downto 0); -- parallel output
162
    gpio_i         : in  std_logic_vector(63 downto 0) := (others => '0'); -- parallel input
163
    -- primary UART0 (available if IO_UART0_EN = true) --
164
    uart0_txd_o    : out std_logic; -- UART0 send data
165
    uart0_rxd_i    : in  std_logic := '0'; -- UART0 receive data
166
    uart0_rts_o    : out std_logic; -- hw flow control: UART0.RX ready to receive ("RTR"), low-active, optional
167
    uart0_cts_i    : in  std_logic := '0'; -- hw flow control: UART0.TX allowed to transmit, low-active, optional
168
    -- secondary UART1 (available if IO_UART1_EN = true) --
169
    uart1_txd_o    : out std_logic; -- UART1 send data
170
    uart1_rxd_i    : in  std_logic := '0'; -- UART1 receive data
171
    uart1_rts_o    : out std_logic; -- hw flow control: UART1.RX ready to receive ("RTR"), low-active, optional
172
    uart1_cts_i    : in  std_logic := '0'; -- hw flow control: UART1.TX allowed to transmit, low-active, optional
173
    -- SPI (available if IO_SPI_EN = true) --
174
    spi_sck_o      : out std_logic; -- SPI serial clock
175
    spi_sdo_o      : out std_logic; -- controller data out, peripheral data in
176
    spi_sdi_i      : in  std_logic := '0'; -- controller data in, peripheral data out
177
    spi_csn_o      : out std_logic_vector(07 downto 0); -- SPI CS
178
    -- TWI (available if IO_TWI_EN = true) --
179
    twi_sda_io     : inout std_logic; -- twi serial data line
180
    twi_scl_io     : inout std_logic; -- twi serial clock line
181
    -- PWM (available if IO_PWM_NUM_CH > 0) --
182 70 zero_gravi
    pwm_o          : out std_logic_vector(59 downto 0); -- pwm channels
183 63 zero_gravi
    -- Custom Functions Subsystem IO (available if IO_CFS_EN = true) --
184
    cfs_in_i       : in  std_logic_vector(IO_CFS_IN_SIZE-1  downto 0); -- custom inputs
185
    cfs_out_o      : out std_logic_vector(IO_CFS_OUT_SIZE-1 downto 0); -- custom outputs
186
    -- NeoPixel-compatible smart LED interface (available if IO_NEOLED_EN = true) --
187
    neoled_o       : out std_logic; -- async serial data line
188
    -- System time --
189
    mtime_i        : in  std_logic_vector(63 downto 0) := (others => '0'); -- current system time from ext. MTIME (if IO_MTIME_EN = false)
190
    mtime_o        : out std_logic_vector(63 downto 0); -- current system time from int. MTIME (if IO_MTIME_EN = true)
191
    -- External platform interrupts (available if XIRQ_NUM_CH > 0) --
192 70 zero_gravi
    xirq_i         : in  std_logic_vector(31 downto 0) := (others => '0'); -- IRQ channels
193 63 zero_gravi
    -- CPU Interrupts --
194
    mtime_irq_i    : in  std_logic := '0'; -- machine timer interrupt, available if IO_MTIME_EN = false
195
    msw_irq_i      : in  std_logic := '0'; -- machine software interrupt
196
    mext_irq_i     : in  std_logic := '0'  -- machine external interrupt
197
  );
198
end entity;
199
 
200
architecture neorv32_ProcessorTop_stdlogic_rtl of neorv32_ProcessorTop_stdlogic is
201
 
202
  -- type conversion --
203
  constant IO_CFS_CONFIG_INT         : std_ulogic_vector(31 downto 0) := std_ulogic_vector(IO_CFS_CONFIG);
204
  constant XIRQ_TRIGGER_TYPE_INT     : std_ulogic_vector(31 downto 0) := std_ulogic_vector(XIRQ_TRIGGER_TYPE);
205
  constant XIRQ_TRIGGER_POLARITY_INT : std_ulogic_vector(31 downto 0) := std_ulogic_vector(XIRQ_TRIGGER_POLARITY);
206
  --
207
  signal clk_i_int       : std_ulogic;
208
  signal rstn_i_int      : std_ulogic;
209
  --
210
  signal jtag_trst_i_int :std_ulogic;
211
  signal jtag_tck_i_int  :std_ulogic;
212
  signal jtag_tdi_i_int  :std_ulogic;
213
  signal jtag_tdo_o_int  :std_ulogic;
214
  signal jtag_tms_i_int  :std_ulogic;
215
  --
216
  signal wb_tag_o_int    : std_ulogic_vector(02 downto 0);
217
  signal wb_adr_o_int    : std_ulogic_vector(31 downto 0);
218
  signal wb_dat_i_int    : std_ulogic_vector(31 downto 0);
219
  signal wb_dat_o_int    : std_ulogic_vector(31 downto 0);
220
  signal wb_we_o_int     : std_ulogic;
221
  signal wb_sel_o_int    : std_ulogic_vector(03 downto 0);
222
  signal wb_stb_o_int    : std_ulogic;
223
  signal wb_cyc_o_int    : std_ulogic;
224
  signal wb_lock_o_int   : std_ulogic;
225
  signal wb_ack_i_int    : std_ulogic;
226
  signal wb_err_i_int    : std_ulogic;
227
  --
228
  signal fence_o_int     : std_ulogic;
229
  signal fencei_o_int    : std_ulogic;
230
  --
231 70 zero_gravi
  signal xip_csn_o_int   : std_ulogic;
232
  signal xip_clk_o_int   : std_ulogic;
233
  signal xip_sdi_i_int   : std_ulogic;
234
  signal xip_sdo_o_int   : std_ulogic;
235
  --
236 63 zero_gravi
  signal slink_tx_dat_o_int : sdata_8x32_t;
237
  signal slink_tx_val_o_int : std_logic_vector(7 downto 0);
238
  signal slink_tx_rdy_i_int : std_logic_vector(7 downto 0);
239
  signal slink_rx_dat_i_int : sdata_8x32_t;
240
  signal slink_rx_val_i_int : std_logic_vector(7 downto 0);
241
  signal slink_rx_rdy_o_int : std_logic_vector(7 downto 0);
242
  --
243
  signal gpio_o_int      : std_ulogic_vector(63 downto 0);
244
  signal gpio_i_int      : std_ulogic_vector(63 downto 0);
245
  --
246
  signal uart0_txd_o_int : std_ulogic;
247
  signal uart0_rxd_i_int : std_ulogic;
248
  signal uart0_rts_o_int : std_ulogic;
249
  signal uart0_cts_i_int : std_ulogic;
250
  --
251
  signal uart1_txd_o_int : std_ulogic;
252
  signal uart1_rxd_i_int : std_ulogic;
253
  signal uart1_rts_o_int : std_ulogic;
254
  signal uart1_cts_i_int : std_ulogic;
255
  --
256
  signal spi_sck_o_int   : std_ulogic;
257
  signal spi_sdo_o_int   : std_ulogic;
258
  signal spi_sdi_i_int   : std_ulogic;
259
  signal spi_csn_o_int   : std_ulogic_vector(07 downto 0);
260
  --
261 70 zero_gravi
  signal pwm_o_int       : std_ulogic_vector(59 downto 0);
262 63 zero_gravi
  --
263
  signal cfs_in_i_int    : std_ulogic_vector(IO_CFS_IN_SIZE-1  downto 0);
264
  signal cfs_out_o_int   : std_ulogic_vector(IO_CFS_OUT_SIZE-1 downto 0);
265
  --
266
  signal neoled_o_int    : std_ulogic;
267
  --
268
  signal mtime_i_int     : std_ulogic_vector(63 downto 0);
269
  signal mtime_o_int     : std_ulogic_vector(63 downto 0);
270
  --
271 70 zero_gravi
  signal xirq_i_int      : std_ulogic_vector(31 downto 0);
272 63 zero_gravi
  --
273
  signal mtime_irq_i_int : std_ulogic;
274
  signal msw_irq_i_int   : std_ulogic;
275
  signal mext_irq_i_int  : std_ulogic;
276
 
277
begin
278
 
279
  -- The Core Of The Problem ----------------------------------------------------------------
280
  -- -------------------------------------------------------------------------------------------
281
  neorv32_top_inst: neorv32_top
282
  generic map (
283
    -- General --
284
    CLOCK_FREQUENCY              => CLOCK_FREQUENCY,    -- clock frequency of clk_i in Hz
285
    INT_BOOTLOADER_EN            => INT_BOOTLOADER_EN,  -- boot configuration: true = boot explicit bootloader; false = boot from int/ext (I)MEM
286
    HW_THREAD_ID                 => HW_THREAD_ID,       -- hardware thread id (hartid) (32-bit)
287
    -- On-Chip Debugger (OCD) --
288
    ON_CHIP_DEBUGGER_EN          => ON_CHIP_DEBUGGER_EN,          -- implement on-chip debugger
289
    -- RISC-V CPU Extensions --
290
    CPU_EXTENSION_RISCV_A        => CPU_EXTENSION_RISCV_A,        -- implement atomic extension?
291 66 zero_gravi
    CPU_EXTENSION_RISCV_B        => CPU_EXTENSION_RISCV_B,        -- implement bit-manipulation extension?
292 63 zero_gravi
    CPU_EXTENSION_RISCV_C        => CPU_EXTENSION_RISCV_C,        -- implement compressed extension?
293
    CPU_EXTENSION_RISCV_E        => CPU_EXTENSION_RISCV_E,        -- implement embedded RF extension?
294
    CPU_EXTENSION_RISCV_M        => CPU_EXTENSION_RISCV_M,        -- implement muld/div extension?
295
    CPU_EXTENSION_RISCV_U        => CPU_EXTENSION_RISCV_U,        -- implement user mode extension?
296
    CPU_EXTENSION_RISCV_Zfinx    => CPU_EXTENSION_RISCV_Zfinx,    -- implement 32-bit floating-point extension (using INT reg!)
297
    CPU_EXTENSION_RISCV_Zicsr    => CPU_EXTENSION_RISCV_Zicsr,    -- implement CSR system?
298 66 zero_gravi
    CPU_EXTENSION_RISCV_Zicntr   => CPU_EXTENSION_RISCV_Zicntr,   -- implement base counters?
299
    CPU_EXTENSION_RISCV_Zihpm    => CPU_EXTENSION_RISCV_Zihpm,    -- implement hardware performance monitors?
300 63 zero_gravi
    CPU_EXTENSION_RISCV_Zifencei => CPU_EXTENSION_RISCV_Zifencei, -- implement instruction stream sync.?
301 72 zero_gravi
    CPU_EXTENSION_RISCV_Zmmul    => CPU_EXTENSION_RISCV_Zmmul,    -- implement multiply-only M sub-extension?
302
    CPU_EXTENSION_RISCV_Zxcfu    => CPU_EXTENSION_RISCV_Zxcfu,    -- implement custom (instr.) functions unit?
303 63 zero_gravi
    -- Extension Options --
304
    FAST_MUL_EN                  => FAST_MUL_EN,        -- use DSPs for M extension's multiplier
305
    FAST_SHIFT_EN                => FAST_SHIFT_EN,      -- use barrel shifter for shift operations
306
    CPU_CNT_WIDTH                => CPU_CNT_WIDTH,      -- total width of CPU cycle and instret counters (0..64)
307
    -- Physical Memory Protection (PMP) --
308
    PMP_NUM_REGIONS              => PMP_NUM_REGIONS,    -- number of regions (0..64)
309
    PMP_MIN_GRANULARITY          => PMP_MIN_GRANULARITY, -- minimal region granularity in bytes, has to be a power of 2, min 8 bytes
310
    -- Hardware Performance Monitors (HPM) --
311
    HPM_NUM_CNTS                 => HPM_NUM_CNTS,       -- number of implemented HPM counters (0..29)
312
    HPM_CNT_WIDTH                => HPM_CNT_WIDTH,      -- total size of HPM counters (0..64)
313
    -- Internal Instruction memory --
314
    MEM_INT_IMEM_EN              => MEM_INT_IMEM_EN,    -- implement processor-internal instruction memory
315
    MEM_INT_IMEM_SIZE            => MEM_INT_IMEM_SIZE,  -- size of processor-internal instruction memory in bytes
316
    -- Internal Data memory --
317
    MEM_INT_DMEM_EN              => MEM_INT_DMEM_EN,    -- implement processor-internal data memory
318
    MEM_INT_DMEM_SIZE            => MEM_INT_DMEM_SIZE,  -- size of processor-internal data memory in bytes
319
    -- Internal Cache memory --
320
    ICACHE_EN                    => ICACHE_EN,          -- implement instruction cache
321
    ICACHE_NUM_BLOCKS            => ICACHE_NUM_BLOCKS,  -- i-cache: number of blocks (min 1), has to be a power of 2
322
    ICACHE_BLOCK_SIZE            => ICACHE_BLOCK_SIZE,  -- i-cache: block size in bytes (min 4), has to be a power of 2
323
    ICACHE_ASSOCIATIVITY         => ICACHE_ASSOCIATIVITY, -- i-cache: associativity / number of sets (1=direct_mapped), has to be a power of 2
324
    -- External memory interface --
325
    MEM_EXT_EN                   => MEM_EXT_EN,         -- implement external memory bus interface?
326
    MEM_EXT_TIMEOUT              => MEM_EXT_TIMEOUT,    -- cycles after a pending bus access auto-terminates (0 = disabled)
327
    MEM_EXT_PIPE_MODE            => MEM_EXT_PIPE_MODE,  -- protocol: false=classic/standard wishbone mode, true=pipelined wishbone mode
328
    MEM_EXT_BIG_ENDIAN           => MEM_EXT_BIG_ENDIAN, -- byte order: true=big-endian, false=little-endian
329
    MEM_EXT_ASYNC_RX             => MEM_EXT_ASYNC_RX,   -- use register buffer for RX data when false
330
    -- Stream link interface --
331
    SLINK_NUM_TX                 => SLINK_NUM_TX,       -- number of TX links (0..8)
332
    SLINK_NUM_RX                 => SLINK_NUM_RX,       -- number of TX links (0..8)
333
    SLINK_TX_FIFO                => SLINK_TX_FIFO,      -- TX fifo depth, has to be a power of two
334
    SLINK_RX_FIFO                => SLINK_RX_FIFO,      -- RX fifo depth, has to be a power of two
335
    -- External Interrupts Controller (XIRQ) --
336
    XIRQ_NUM_CH                  => XIRQ_NUM_CH, -- number of external IRQ channels (0..32)
337
    XIRQ_TRIGGER_TYPE            => XIRQ_TRIGGER_TYPE_INT, -- trigger type: 0=level, 1=edge
338
    XIRQ_TRIGGER_POLARITY        => XIRQ_TRIGGER_POLARITY_INT, -- trigger polarity: 0=low-level/falling-edge, 1=high-level/rising-edge
339
    -- Processor peripherals --
340
    IO_GPIO_EN                   => IO_GPIO_EN,         -- implement general purpose input/output port unit (GPIO)?
341
    IO_MTIME_EN                  => IO_MTIME_EN,        -- implement machine system timer (MTIME)?
342
    IO_UART0_EN                  => IO_UART0_EN,        -- implement primary universal asynchronous receiver/transmitter (UART0)?
343 65 zero_gravi
    IO_UART0_RX_FIFO             => IO_UART0_RX_FIFO,   -- RX fifo depth, has to be a power of two, min 1
344
    IO_UART0_TX_FIFO             => IO_UART0_TX_FIFO,   -- TX fifo depth, has to be a power of two, min 1
345 63 zero_gravi
    IO_UART1_EN                  => IO_UART1_EN,        -- implement secondary universal asynchronous receiver/transmitter (UART1)?
346 65 zero_gravi
    IO_UART1_RX_FIFO             => IO_UART1_RX_FIFO,   -- RX fifo depth, has to be a power of two, min 1
347
    IO_UART1_TX_FIFO             => IO_UART1_TX_FIFO,   -- TX fifo depth, has to be a power of two, min 1
348 63 zero_gravi
    IO_SPI_EN                    => IO_SPI_EN,          -- implement serial peripheral interface (SPI)?
349
    IO_TWI_EN                    => IO_TWI_EN,          -- implement two-wire interface (TWI)?
350
    IO_PWM_NUM_CH                => IO_PWM_NUM_CH,      -- number of PWM channels to implement (0..60); 0 = disabled
351
    IO_WDT_EN                    => IO_WDT_EN,          -- implement watch dog timer (WDT)?
352
    IO_TRNG_EN                   => IO_TRNG_EN,         -- implement true random number generator (TRNG)?
353
    IO_CFS_EN                    => IO_CFS_EN,          -- implement custom functions subsystem (CFS)?
354
    IO_CFS_CONFIG                => IO_CFS_CONFIG_INT,  -- custom CFS configuration generic
355
    IO_CFS_IN_SIZE               => IO_CFS_IN_SIZE,     -- size of CFS input conduit in bits
356
    IO_CFS_OUT_SIZE              => IO_CFS_OUT_SIZE,    -- size of CFS output conduit in bits
357 67 zero_gravi
    IO_NEOLED_EN                 => IO_NEOLED_EN,       -- implement NeoPixel-compatible smart LED interface (NEOLED)?
358 70 zero_gravi
    IO_GPTMR_EN                  => IO_GPTMR_EN,        -- implement general purpose timer (GPTMR)?
359
    IO_XIP_EN                    => IO_XIP_EN           -- implement execute in place module (XIP)?
360 63 zero_gravi
  )
361
  port map (
362
    -- Global control --
363
    clk_i          => clk_i_int,       -- global clock, rising edge
364
    rstn_i         => rstn_i_int,      -- global reset, low-active, async
365
    -- JTAG on-chip debugger interface (available if ON_CHIP_DEBUGGER_EN = true) --
366
    jtag_trst_i    => jtag_trst_i_int, -- low-active TAP reset (optional)
367
    jtag_tck_i     => jtag_tck_i_int,  -- serial clock
368
    jtag_tdi_i     => jtag_tdi_i_int,  -- serial data input
369
    jtag_tdo_o     => jtag_tdo_o_int,  -- serial data output
370
    jtag_tms_i     => jtag_tms_i_int,  -- mode select
371
    -- Wishbone bus interface (available if MEM_EXT_EN = true) --
372
    wb_tag_o       => wb_tag_o_int,    -- tag
373
    wb_adr_o       => wb_adr_o_int,    -- address
374
    wb_dat_i       => wb_dat_i_int,    -- read data
375
    wb_dat_o       => wb_dat_o_int,    -- write data
376
    wb_we_o        => wb_we_o_int,     -- read/write
377
    wb_sel_o       => wb_sel_o_int,    -- byte enable
378
    wb_stb_o       => wb_stb_o_int,    -- strobe
379
    wb_cyc_o       => wb_cyc_o_int,    -- valid cycle
380
    wb_lock_o      => wb_lock_o_int,   -- exclusive access request
381
    wb_ack_i       => wb_ack_i_int,    -- transfer acknowledge
382
    wb_err_i       => wb_err_i_int,    -- transfer error
383
    -- Advanced memory control signals (available if MEM_EXT_EN = true) --
384
    fence_o        => fence_o_int,     -- indicates an executed FENCE operation
385
    fencei_o       => fencei_o_int,    -- indicates an executed FENCEI operation
386 70 zero_gravi
    -- XIP (execute in place via SPI) signals (available if IO_XIP_EN = true) --
387
    xip_csn_o      => xip_csn_o_int,   -- chip-select, low-active
388
    xip_clk_o      => xip_clk_o_int,   -- serial clock
389
    xip_sdi_i      => xip_sdi_i_int,   -- device data input
390
    xip_sdo_o      => xip_sdo_o_int,   -- controller data output
391 63 zero_gravi
    -- TX stream interfaces (available if SLINK_NUM_TX > 0) --
392
    slink_tx_dat_o => slink_tx_dat_o_int, -- output data
393
    slink_tx_val_o => slink_tx_val_o_int, -- valid output
394
    slink_tx_rdy_i => slink_tx_rdy_i_int, -- ready to send
395
    -- RX stream interfaces (available if SLINK_NUM_RX > 0) --
396
    slink_rx_dat_i => slink_rx_dat_i_int, -- input data
397
    slink_rx_val_i => slink_rx_val_i_int, -- valid input
398
    slink_rx_rdy_o => slink_rx_rdy_o_int, -- ready to receive
399
    -- GPIO (available if IO_GPIO_EN = true) --
400
    gpio_o         => gpio_o_int,      -- parallel output
401
    gpio_i         => gpio_i_int,      -- parallel input
402
    -- primary UART0 (available if IO_UART0_EN = true) --
403
    uart0_txd_o    => uart0_txd_o_int, -- UART0 send data
404
    uart0_rxd_i    => uart0_rxd_i_int, -- UART0 receive data
405
    uart0_rts_o    => uart0_rts_o_int, -- hw flow control: UART0.RX ready to receive ("RTR"), low-active, optional
406
    uart0_cts_i    => uart0_cts_i_int, -- hw flow control: UART0.TX allowed to transmit, low-active, optional
407
    -- secondary UART1 (available if IO_UART1_EN = true) --
408
    uart1_txd_o    => uart1_txd_o_int, -- UART1 send data
409
    uart1_rxd_i    => uart1_rxd_i_int, -- UART1 receive data
410
    uart1_rts_o    => uart1_rts_o_int, -- hw flow control: UART1.RX ready to receive ("RTR"), low-active, optional
411
    uart1_cts_i    => uart1_cts_i_int, -- hw flow control: UART1.TX allowed to transmit, low-active, optional
412
    -- SPI (available if IO_SPI_EN = true) --
413
    spi_sck_o      => spi_sck_o_int,   -- SPI serial clock
414
    spi_sdo_o      => spi_sdo_o_int,   -- controller data out, peripheral data in
415
    spi_sdi_i      => spi_sdi_i_int,   -- controller data in, peripheral data out
416
    spi_csn_o      => spi_csn_o_int,   -- SPI CS
417
    -- TWI (available if IO_TWI_EN = true) --
418
    twi_sda_io     => twi_sda_io,      -- twi serial data line
419
    twi_scl_io     => twi_scl_io,      -- twi serial clock line
420
    -- PWM (available if IO_PWM_NUM_CH > 0) --
421
    pwm_o          => pwm_o_int,       -- pwm channels
422
    -- Custom Functions Subsystem IO (available if IO_CFS_EN = true) --
423
    cfs_in_i       => cfs_in_i_int,    -- custom inputs
424
    cfs_out_o      => cfs_out_o_int,   -- custom outputs
425
    -- NeoPixel-compatible smart LED interface (available if IO_NEOLED_EN = true) --
426
    neoled_o       => neoled_o_int,    -- async serial data line
427
    -- System time --
428
    mtime_i        => mtime_i_int,     -- current system time from ext. MTIME (if IO_MTIME_EN = false)
429
    mtime_o        => mtime_o_int,     -- current system time from int. MTIME (if IO_MTIME_EN = true)
430
    -- External platform interrupts (available if XIRQ_NUM_CH > 0) --
431
    xirq_i         => xirq_i_int,      -- IRQ channels
432
    -- CPU Interrupts --
433
    mtime_irq_i    => mtime_irq_i_int, -- machine timer interrupt, available if IO_MTIME_EN = false
434
    msw_irq_i      => msw_irq_i_int,   -- machine software interrupt
435
    mext_irq_i     => mext_irq_i_int   -- machine external interrupt
436
  );
437
 
438
  -- type conversion --
439
  clk_i_int       <= std_ulogic(clk_i);
440
  rstn_i_int      <= std_ulogic(rstn_i);
441
 
442
  jtag_trst_i_int <= std_ulogic(jtag_trst_i);
443
  jtag_tck_i_int  <= std_ulogic(jtag_tck_i);
444
  jtag_tdi_i_int  <= std_ulogic(jtag_tdi_i);
445
  jtag_tdo_o      <= std_logic(jtag_tdo_o_int);
446
  jtag_tms_i_int  <= std_ulogic(jtag_tms_i);
447
 
448
  wb_tag_o        <= std_logic_vector(wb_tag_o_int);
449
  wb_adr_o        <= std_logic_vector(wb_adr_o_int);
450
  wb_dat_i_int    <= std_ulogic_vector(wb_dat_i);
451
  wb_dat_o        <= std_logic_vector(wb_dat_o_int);
452
  wb_we_o         <= std_logic(wb_we_o_int);
453
  wb_sel_o        <= std_logic_vector(wb_sel_o_int);
454
  wb_stb_o        <= std_logic(wb_stb_o_int);
455
  wb_cyc_o        <= std_logic(wb_cyc_o_int);
456
  wb_lock_o       <= std_logic(wb_lock_o_int);
457
  wb_ack_i_int    <= std_ulogic(wb_ack_i);
458
  wb_err_i_int    <= std_ulogic(wb_err_i);
459
 
460
  fence_o         <= std_logic(fence_o_int);
461
  fencei_o        <= std_logic(fencei_o_int);
462
 
463 70 zero_gravi
  xip_csn_o       <= std_logic(xip_csn_o_int);
464
  xip_clk_o       <= std_logic(xip_clk_o_int);
465
  xip_sdi_i_int   <= std_ulogic(xip_sdi_i);
466
  xip_sdo_o       <= std_logic(xip_sdo_o_int);
467
 
468 63 zero_gravi
  slink_tx_val_o     <= std_logic_vector(slink_tx_val_o_int);
469
  slink_tx_rdy_i_int <= std_ulogic_vector(slink_tx_rdy_i);
470
  slink_rx_val_i_int <= std_ulogic_vector(slink_rx_val_i);
471
  slink_rx_rdy_o     <= std_logic_vector(slink_rx_rdy_o_int);
472
 
473
  slink_conv:
474
  for i in 0 to 7 generate
475
    slink_tx_dat_o(i)     <= std_logic_vector(slink_tx_dat_o_int(i));
476
    slink_rx_dat_i_int(i) <= std_ulogic_vector(slink_rx_dat_i(i));
477
  end generate;
478
 
479
  gpio_o          <= std_logic_vector(gpio_o_int);
480
  gpio_i_int      <= std_ulogic_vector(gpio_i);
481
 
482
  uart0_txd_o     <= std_logic(uart0_txd_o_int);
483
  uart0_rxd_i_int <= std_ulogic(uart0_rxd_i);
484 65 zero_gravi
  uart0_rts_o     <= std_logic(uart0_rts_o_int);
485
  uart0_cts_i_int <= std_ulogic(uart0_cts_i);
486 63 zero_gravi
  uart1_txd_o     <= std_logic(uart1_txd_o_int);
487
  uart1_rxd_i_int <= std_ulogic(uart1_rxd_i);
488 65 zero_gravi
  uart1_rts_o     <= std_logic(uart1_rts_o_int);
489
  uart1_cts_i_int <= std_ulogic(uart1_cts_i);
490 63 zero_gravi
 
491
  spi_sck_o       <= std_logic(spi_sck_o_int);
492
  spi_sdo_o       <= std_logic(spi_sdo_o_int);
493
  spi_sdi_i_int   <= std_ulogic(spi_sdi_i);
494
  spi_csn_o       <= std_logic_vector(spi_csn_o_int);
495
 
496
  pwm_o           <= std_logic_vector(pwm_o_int);
497
 
498
  cfs_in_i_int    <= std_ulogic_vector(cfs_in_i);
499
  cfs_out_o       <= std_logic_vector(cfs_out_o_int);
500
 
501
  neoled_o        <= std_logic(neoled_o_int);
502
 
503
  mtime_i_int     <= std_ulogic_vector(mtime_i);
504
  mtime_o         <= std_logic_vector(mtime_o_int);
505
 
506
  xirq_i_int      <= std_ulogic_vector(xirq_i);
507
 
508
  msw_irq_i_int   <= std_ulogic(msw_irq_i);
509
  mext_irq_i_int  <= std_ulogic(mext_irq_i);
510
 
511
 
512
end architecture;

powered by: WebSVN 2.1.0

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