Line 1... |
Line 1... |
-- #################################################################################################
|
-- #################################################################################################
|
-- # << NEORV32 - Processor Top Entity with Resolved Port Signals (std_logic/std_logic_vector) >> #
|
-- # << NEORV32 - Processor Top Entity with Resolved Port Signals (std_logic/std_logic_vector) >> #
|
-- # ********************************************************************************************* #
|
-- # ********************************************************************************************* #
|
-- # BSD 3-Clause License #
|
-- # BSD 3-Clause License #
|
-- # #
|
-- # #
|
-- # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
-- # Copyright (c) 2022, Stephan Nolting. All rights reserved. #
|
-- # #
|
-- # #
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
-- # Redistribution and use in source and binary forms, with or without modification, are #
|
-- # permitted provided that the following conditions are met: #
|
-- # permitted provided that the following conditions are met: #
|
-- # #
|
-- # #
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
-- # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
Line 112... |
Line 112... |
IO_CFS_EN : boolean := false; -- implement custom functions subsystem (CFS)?
|
IO_CFS_EN : boolean := false; -- implement custom functions subsystem (CFS)?
|
IO_CFS_CONFIG : std_ulogic_vector(31 downto 0); -- custom CFS configuration generic
|
IO_CFS_CONFIG : std_ulogic_vector(31 downto 0); -- custom CFS configuration generic
|
IO_CFS_IN_SIZE : positive := 32; -- size of CFS input conduit in bits
|
IO_CFS_IN_SIZE : positive := 32; -- size of CFS input conduit in bits
|
IO_CFS_OUT_SIZE : positive := 32; -- size of CFS output conduit in bits
|
IO_CFS_OUT_SIZE : positive := 32; -- size of CFS output conduit in bits
|
IO_NEOLED_EN : boolean := true; -- implement NeoPixel-compatible smart LED interface (NEOLED)?
|
IO_NEOLED_EN : boolean := true; -- implement NeoPixel-compatible smart LED interface (NEOLED)?
|
IO_GPTMR_EN : boolean := false -- implement general purpose timer (GPTMR)?
|
IO_GPTMR_EN : boolean := false; -- implement general purpose timer (GPTMR)?
|
|
IO_XIP_EN : boolean := false -- implement execute in place module (XIP)?
|
);
|
);
|
port (
|
port (
|
-- Global control --
|
-- Global control --
|
clk_i : in std_logic := '0'; -- global clock, rising edge
|
clk_i : in std_logic := '0'; -- global clock, rising edge
|
rstn_i : in std_logic := '0'; -- global reset, low-active, async
|
rstn_i : in std_logic := '0'; -- global reset, low-active, async
|
Line 139... |
Line 140... |
wb_ack_i : in std_logic := '0'; -- transfer acknowledge
|
wb_ack_i : in std_logic := '0'; -- transfer acknowledge
|
wb_err_i : in std_logic := '0'; -- transfer error
|
wb_err_i : in std_logic := '0'; -- transfer error
|
-- Advanced memory control signals (available if MEM_EXT_EN = true) --
|
-- Advanced memory control signals (available if MEM_EXT_EN = true) --
|
fence_o : out std_logic; -- indicates an executed FENCE operation
|
fence_o : out std_logic; -- indicates an executed FENCE operation
|
fencei_o : out std_logic; -- indicates an executed FENCEI operation
|
fencei_o : out std_logic; -- indicates an executed FENCEI operation
|
|
-- XIP (execute in place via SPI) signals (available if IO_XIP_EN = true) --
|
|
xip_csn_o : out std_logic; -- chip-select, low-active
|
|
xip_clk_o : out std_logic; -- serial clock
|
|
xip_sdi_i : in std_logic := 'L'; -- device data input
|
|
xip_sdo_o : out std_logic; -- controller data output
|
-- TX stream interfaces (available if SLINK_NUM_TX > 0) --
|
-- TX stream interfaces (available if SLINK_NUM_TX > 0) --
|
slink_tx_dat_o : out sdata_8x32r_t; -- output data
|
slink_tx_dat_o : out sdata_8x32r_t; -- output data
|
slink_tx_val_o : out std_logic_vector(7 downto 0); -- valid output
|
slink_tx_val_o : out std_logic_vector(7 downto 0); -- valid output
|
slink_tx_rdy_i : in std_logic_vector(7 downto 0) := (others => '0'); -- ready to send
|
slink_tx_rdy_i : in std_logic_vector(7 downto 0) := (others => '0'); -- ready to send
|
-- RX stream interfaces (available if SLINK_NUM_RX > 0) --
|
-- RX stream interfaces (available if SLINK_NUM_RX > 0) --
|
Line 169... |
Line 175... |
spi_csn_o : out std_logic_vector(07 downto 0); -- SPI CS
|
spi_csn_o : out std_logic_vector(07 downto 0); -- SPI CS
|
-- TWI (available if IO_TWI_EN = true) --
|
-- TWI (available if IO_TWI_EN = true) --
|
twi_sda_io : inout std_logic; -- twi serial data line
|
twi_sda_io : inout std_logic; -- twi serial data line
|
twi_scl_io : inout std_logic; -- twi serial clock line
|
twi_scl_io : inout std_logic; -- twi serial clock line
|
-- PWM (available if IO_PWM_NUM_CH > 0) --
|
-- PWM (available if IO_PWM_NUM_CH > 0) --
|
pwm_o : out std_logic_vector(IO_PWM_NUM_CH-1 downto 0); -- pwm channels
|
pwm_o : out std_logic_vector(59 downto 0); -- pwm channels
|
-- Custom Functions Subsystem IO (available if IO_CFS_EN = true) --
|
-- Custom Functions Subsystem IO (available if IO_CFS_EN = true) --
|
cfs_in_i : in std_logic_vector(IO_CFS_IN_SIZE-1 downto 0); -- custom inputs
|
cfs_in_i : in std_logic_vector(IO_CFS_IN_SIZE-1 downto 0); -- custom inputs
|
cfs_out_o : out std_logic_vector(IO_CFS_OUT_SIZE-1 downto 0); -- custom outputs
|
cfs_out_o : out std_logic_vector(IO_CFS_OUT_SIZE-1 downto 0); -- custom outputs
|
-- NeoPixel-compatible smart LED interface (available if IO_NEOLED_EN = true) --
|
-- NeoPixel-compatible smart LED interface (available if IO_NEOLED_EN = true) --
|
neoled_o : out std_logic; -- async serial data line
|
neoled_o : out std_logic; -- async serial data line
|
-- System time --
|
-- System time --
|
mtime_i : in std_logic_vector(63 downto 0) := (others => '0'); -- current system time from ext. MTIME (if IO_MTIME_EN = false)
|
mtime_i : in std_logic_vector(63 downto 0) := (others => '0'); -- current system time from ext. MTIME (if IO_MTIME_EN = false)
|
mtime_o : out std_logic_vector(63 downto 0); -- current system time from int. MTIME (if IO_MTIME_EN = true)
|
mtime_o : out std_logic_vector(63 downto 0); -- current system time from int. MTIME (if IO_MTIME_EN = true)
|
-- External platform interrupts (available if XIRQ_NUM_CH > 0) --
|
-- External platform interrupts (available if XIRQ_NUM_CH > 0) --
|
xirq_i : in std_logic_vector(XIRQ_NUM_CH-1 downto 0) := (others => '0'); -- IRQ channels
|
xirq_i : in std_logic_vector(31 downto 0) := (others => '0'); -- IRQ channels
|
-- CPU Interrupts --
|
-- CPU Interrupts --
|
mtime_irq_i : in std_logic := '0'; -- machine timer interrupt, available if IO_MTIME_EN = false
|
mtime_irq_i : in std_logic := '0'; -- machine timer interrupt, available if IO_MTIME_EN = false
|
msw_irq_i : in std_logic := '0'; -- machine software interrupt
|
msw_irq_i : in std_logic := '0'; -- machine software interrupt
|
mext_irq_i : in std_logic := '0' -- machine external interrupt
|
mext_irq_i : in std_logic := '0' -- machine external interrupt
|
);
|
);
|
Line 218... |
Line 224... |
signal wb_err_i_int : std_ulogic;
|
signal wb_err_i_int : std_ulogic;
|
--
|
--
|
signal fence_o_int : std_ulogic;
|
signal fence_o_int : std_ulogic;
|
signal fencei_o_int : std_ulogic;
|
signal fencei_o_int : std_ulogic;
|
--
|
--
|
|
signal xip_csn_o_int : std_ulogic;
|
|
signal xip_clk_o_int : std_ulogic;
|
|
signal xip_sdi_i_int : std_ulogic;
|
|
signal xip_sdo_o_int : std_ulogic;
|
|
--
|
signal slink_tx_dat_o_int : sdata_8x32_t;
|
signal slink_tx_dat_o_int : sdata_8x32_t;
|
signal slink_tx_val_o_int : std_logic_vector(7 downto 0);
|
signal slink_tx_val_o_int : std_logic_vector(7 downto 0);
|
signal slink_tx_rdy_i_int : std_logic_vector(7 downto 0);
|
signal slink_tx_rdy_i_int : std_logic_vector(7 downto 0);
|
signal slink_rx_dat_i_int : sdata_8x32_t;
|
signal slink_rx_dat_i_int : sdata_8x32_t;
|
signal slink_rx_val_i_int : std_logic_vector(7 downto 0);
|
signal slink_rx_val_i_int : std_logic_vector(7 downto 0);
|
Line 243... |
Line 254... |
signal spi_sck_o_int : std_ulogic;
|
signal spi_sck_o_int : std_ulogic;
|
signal spi_sdo_o_int : std_ulogic;
|
signal spi_sdo_o_int : std_ulogic;
|
signal spi_sdi_i_int : std_ulogic;
|
signal spi_sdi_i_int : std_ulogic;
|
signal spi_csn_o_int : std_ulogic_vector(07 downto 0);
|
signal spi_csn_o_int : std_ulogic_vector(07 downto 0);
|
--
|
--
|
signal pwm_o_int : std_ulogic_vector(IO_PWM_NUM_CH-1 downto 0);
|
signal pwm_o_int : std_ulogic_vector(59 downto 0);
|
--
|
--
|
signal cfs_in_i_int : std_ulogic_vector(IO_CFS_IN_SIZE-1 downto 0);
|
signal cfs_in_i_int : std_ulogic_vector(IO_CFS_IN_SIZE-1 downto 0);
|
signal cfs_out_o_int : std_ulogic_vector(IO_CFS_OUT_SIZE-1 downto 0);
|
signal cfs_out_o_int : std_ulogic_vector(IO_CFS_OUT_SIZE-1 downto 0);
|
--
|
--
|
signal neoled_o_int : std_ulogic;
|
signal neoled_o_int : std_ulogic;
|
--
|
--
|
signal mtime_i_int : std_ulogic_vector(63 downto 0);
|
signal mtime_i_int : std_ulogic_vector(63 downto 0);
|
signal mtime_o_int : std_ulogic_vector(63 downto 0);
|
signal mtime_o_int : std_ulogic_vector(63 downto 0);
|
--
|
--
|
signal xirq_i_int : std_ulogic_vector(XIRQ_NUM_CH-1 downto 0);
|
signal xirq_i_int : std_ulogic_vector(31 downto 0);
|
--
|
--
|
signal mtime_irq_i_int : std_ulogic;
|
signal mtime_irq_i_int : std_ulogic;
|
signal msw_irq_i_int : std_ulogic;
|
signal msw_irq_i_int : std_ulogic;
|
signal mext_irq_i_int : std_ulogic;
|
signal mext_irq_i_int : std_ulogic;
|
|
|
Line 338... |
Line 349... |
IO_CFS_EN => IO_CFS_EN, -- implement custom functions subsystem (CFS)?
|
IO_CFS_EN => IO_CFS_EN, -- implement custom functions subsystem (CFS)?
|
IO_CFS_CONFIG => IO_CFS_CONFIG_INT, -- custom CFS configuration generic
|
IO_CFS_CONFIG => IO_CFS_CONFIG_INT, -- custom CFS configuration generic
|
IO_CFS_IN_SIZE => IO_CFS_IN_SIZE, -- size of CFS input conduit in bits
|
IO_CFS_IN_SIZE => IO_CFS_IN_SIZE, -- size of CFS input conduit in bits
|
IO_CFS_OUT_SIZE => IO_CFS_OUT_SIZE, -- size of CFS output conduit in bits
|
IO_CFS_OUT_SIZE => IO_CFS_OUT_SIZE, -- size of CFS output conduit in bits
|
IO_NEOLED_EN => IO_NEOLED_EN, -- implement NeoPixel-compatible smart LED interface (NEOLED)?
|
IO_NEOLED_EN => IO_NEOLED_EN, -- implement NeoPixel-compatible smart LED interface (NEOLED)?
|
IO_GPTMR_EN => IO_GPTMR_EN -- implement general purpose timer (GPTMR)?
|
IO_GPTMR_EN => IO_GPTMR_EN, -- implement general purpose timer (GPTMR)?
|
|
IO_XIP_EN => IO_XIP_EN -- implement execute in place module (XIP)?
|
)
|
)
|
port map (
|
port map (
|
-- Global control --
|
-- Global control --
|
clk_i => clk_i_int, -- global clock, rising edge
|
clk_i => clk_i_int, -- global clock, rising edge
|
rstn_i => rstn_i_int, -- global reset, low-active, async
|
rstn_i => rstn_i_int, -- global reset, low-active, async
|
Line 365... |
Line 377... |
wb_ack_i => wb_ack_i_int, -- transfer acknowledge
|
wb_ack_i => wb_ack_i_int, -- transfer acknowledge
|
wb_err_i => wb_err_i_int, -- transfer error
|
wb_err_i => wb_err_i_int, -- transfer error
|
-- Advanced memory control signals (available if MEM_EXT_EN = true) --
|
-- Advanced memory control signals (available if MEM_EXT_EN = true) --
|
fence_o => fence_o_int, -- indicates an executed FENCE operation
|
fence_o => fence_o_int, -- indicates an executed FENCE operation
|
fencei_o => fencei_o_int, -- indicates an executed FENCEI operation
|
fencei_o => fencei_o_int, -- indicates an executed FENCEI operation
|
|
-- XIP (execute in place via SPI) signals (available if IO_XIP_EN = true) --
|
|
xip_csn_o => xip_csn_o_int, -- chip-select, low-active
|
|
xip_clk_o => xip_clk_o_int, -- serial clock
|
|
xip_sdi_i => xip_sdi_i_int, -- device data input
|
|
xip_sdo_o => xip_sdo_o_int, -- controller data output
|
-- TX stream interfaces (available if SLINK_NUM_TX > 0) --
|
-- TX stream interfaces (available if SLINK_NUM_TX > 0) --
|
slink_tx_dat_o => slink_tx_dat_o_int, -- output data
|
slink_tx_dat_o => slink_tx_dat_o_int, -- output data
|
slink_tx_val_o => slink_tx_val_o_int, -- valid output
|
slink_tx_val_o => slink_tx_val_o_int, -- valid output
|
slink_tx_rdy_i => slink_tx_rdy_i_int, -- ready to send
|
slink_tx_rdy_i => slink_tx_rdy_i_int, -- ready to send
|
-- RX stream interfaces (available if SLINK_NUM_RX > 0) --
|
-- RX stream interfaces (available if SLINK_NUM_RX > 0) --
|
Line 437... |
Line 454... |
wb_err_i_int <= std_ulogic(wb_err_i);
|
wb_err_i_int <= std_ulogic(wb_err_i);
|
|
|
fence_o <= std_logic(fence_o_int);
|
fence_o <= std_logic(fence_o_int);
|
fencei_o <= std_logic(fencei_o_int);
|
fencei_o <= std_logic(fencei_o_int);
|
|
|
|
xip_csn_o <= std_logic(xip_csn_o_int);
|
|
xip_clk_o <= std_logic(xip_clk_o_int);
|
|
xip_sdi_i_int <= std_ulogic(xip_sdi_i);
|
|
xip_sdo_o <= std_logic(xip_sdo_o_int);
|
|
|
slink_tx_val_o <= std_logic_vector(slink_tx_val_o_int);
|
slink_tx_val_o <= std_logic_vector(slink_tx_val_o_int);
|
slink_tx_rdy_i_int <= std_ulogic_vector(slink_tx_rdy_i);
|
slink_tx_rdy_i_int <= std_ulogic_vector(slink_tx_rdy_i);
|
slink_rx_val_i_int <= std_ulogic_vector(slink_rx_val_i);
|
slink_rx_val_i_int <= std_ulogic_vector(slink_rx_val_i);
|
slink_rx_rdy_o <= std_logic_vector(slink_rx_rdy_o_int);
|
slink_rx_rdy_o <= std_logic_vector(slink_rx_rdy_o_int);
|
|
|