Line 1... |
Line 1... |
-- #################################################################################################
|
-- #################################################################################################
|
-- # << NEORV32 - Custom Functions Subsystem (CFS) >> #
|
-- # << NEORV32 - Custom Functions Subsystem (CFS) >> #
|
-- # ********************************************************************************************* #
|
-- # ********************************************************************************************* #
|
-- # For tightly-coupled custom co-processors. Provides 32x32-bit memory-mapped registers. This is #
|
-- # For tightly-coupled custom co-processors. Provides 32x32-bit memory-mapped registers. #
|
-- # just an "example/illustration template". Modify this file to implement your own custom design #
|
-- # This is just an "example/illustration template". Modify this file to implement your own #
|
-- # logic. #
|
-- # custom design logic. #
|
-- # ********************************************************************************************* #
|
-- # ********************************************************************************************* #
|
-- # BSD 3-Clause License #
|
-- # BSD 3-Clause License #
|
-- # #
|
-- # #
|
-- # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
-- # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
-- # #
|
-- # #
|
Line 60... |
Line 60... |
data_o : out std_ulogic_vector(31 downto 0); -- data out
|
data_o : out std_ulogic_vector(31 downto 0); -- data out
|
ack_o : out std_ulogic; -- transfer acknowledge
|
ack_o : out std_ulogic; -- transfer acknowledge
|
-- clock generator --
|
-- clock generator --
|
clkgen_en_o : out std_ulogic; -- enable clock generator
|
clkgen_en_o : out std_ulogic; -- enable clock generator
|
clkgen_i : in std_ulogic_vector(07 downto 0); -- "clock" inputs
|
clkgen_i : in std_ulogic_vector(07 downto 0); -- "clock" inputs
|
-- CPU state --
|
|
sleep_i : in std_ulogic; -- set if cpu is in sleep mode
|
|
-- interrupt --
|
-- interrupt --
|
irq_o : out std_ulogic; -- interrupt request
|
irq_o : out std_ulogic; -- interrupt request
|
-- custom io (conduits) --
|
-- custom io (conduits) --
|
cfs_in_i : in std_ulogic_vector(CFS_IN_SIZE-1 downto 0); -- custom inputs
|
cfs_in_i : in std_ulogic_vector(CFS_IN_SIZE-1 downto 0); -- custom inputs
|
cfs_out_o : out std_ulogic_vector(CFS_OUT_SIZE-1 downto 0) -- custom outputs
|
cfs_out_o : out std_ulogic_vector(CFS_OUT_SIZE-1 downto 0) -- custom outputs
|
Line 163... |
Line 161... |
-- Make sure to deactivate the CFS's clkgen_en_o if no clocks are required in here to reduce dynamic power consumption.
|
-- Make sure to deactivate the CFS's clkgen_en_o if no clocks are required in here to reduce dynamic power consumption.
|
|
|
clkgen_en_o <= '0'; -- not used for this minimal example
|
clkgen_en_o <= '0'; -- not used for this minimal example
|
|
|
|
|
-- Further Power Optimization -------------------------------------------------------------
|
|
-- -------------------------------------------------------------------------------------------
|
|
-- The CFS can decide to go into low-power mode (by disabling all switching activity) when the CPU enters sleep mode.
|
|
-- The sleep_i signal is high when the CPU is in sleep mode. Any interrupt including the CFS's irq_o interrupt request signal
|
|
-- will wake up the CPU again.
|
|
|
|
-- sleep_i
|
|
|
|
|
|
-- Interrupt ------------------------------------------------------------------------------
|
-- Interrupt ------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- The CFS features a single interrupt signal. This interrupt is connected to the CPU's "fast interrupt" channel 1.
|
-- The CFS features a single interrupt signal, which is connected to the CPU's "fast interrupt" channel 1.
|
-- The interrupt is single-shot. Setting the irq_o signal high for one cycle will generate an interrupt request.
|
-- The interrupt is high-level-active. When set, the interrupt appears as "pending" in the CPU's mie register
|
-- It is recommended to implement some CFS mechanisms (like a register that needs to be written) in order to allow
|
-- ready to trigger execution of the according interrupt handler.
|
-- another generation on an interrupt request (simple acknowledgement).
|
-- Once set, the irq_o signal **has to stay set** until explicitly acknowledged by the CPU
|
|
-- (for example by reading/writing from/to a specific CFS interface register address).
|
|
|
irq_o <= '0'; -- not used for this minimal example
|
irq_o <= '0'; -- not used for this minimal example
|
|
|
|
|
-- Read/Write Access ----------------------------------------------------------------------
|
-- Read/Write Access ----------------------------------------------------------------------
|