Line 122... |
Line 122... |
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- The CFS can be reset using the global rstn_i signal. This signal should be used as asynchronous reset and is active-low.
|
-- The CFS can be reset using the global rstn_i signal. This signal should be used as asynchronous reset and is active-low.
|
-- Note that rstn_i can be asserted by an external reset and also by a watchdog-cause reset.
|
-- Note that rstn_i can be asserted by an external reset and also by a watchdog-cause reset.
|
--
|
--
|
-- Most default peripheral devices of the NEORV32 do NOT use a dedicated reset at all. Instead, these units are reset by writing ZERO
|
-- Most default peripheral devices of the NEORV32 do NOT use a dedicated reset at all. Instead, these units are reset by writing ZERO
|
-- to a specific "control register" located right at the beginning of the devices's address space (so this register is cleared at first).
|
-- to a specific "control register" located right at the beginning of the device's address space (so this register is cleared at first).
|
-- The crt0 start-up code write ZERO to every single address in the processor's IO space - including the CFS.
|
-- The crt0 start-up code write ZERO to every single address in the processor's IO space - including the CFS.
|
-- Make sure that this clearing does not cause any unintended actions in the CFS.
|
-- Make sure that this clearing does not cause any unintended actions in the CFS.
|
|
|
|
|
-- Clock System ---------------------------------------------------------------------------
|
-- Clock System ---------------------------------------------------------------------------
|
Line 208... |
Line 208... |
-- ack_o <= rden; -- use this construct if your CFS is read-only
|
-- ack_o <= rden; -- use this construct if your CFS is read-only
|
-- ack_o <= wren; -- use this construct if your CFS is write-only
|
-- ack_o <= wren; -- use this construct if your CFS is write-only
|
-- ack_o <= ... -- or define the ACK by yourself (example: some registers are read-only, some others can only be written, ...)
|
-- ack_o <= ... -- or define the ACK by yourself (example: some registers are read-only, some others can only be written, ...)
|
|
|
-- write access --
|
-- write access --
|
for i in 0 to 3 loop
|
|
if (wren = '1') then -- word-wide write-access only!
|
if (wren = '1') then -- word-wide write-access only!
|
case addr is -- make sure to use the internal 'addr' signal for the read/write interface
|
case addr is -- make sure to use the internal "addr" signal for the read/write interface
|
when cfs_reg0_addr_c => cfs_reg_wr(0) <= data_i; -- for example: control register
|
when cfs_reg0_addr_c => cfs_reg_wr(0) <= data_i; -- for example: control register
|
when cfs_reg1_addr_c => cfs_reg_wr(1) <= data_i; -- for example: data in/out fifo
|
when cfs_reg1_addr_c => cfs_reg_wr(1) <= data_i; -- for example: data in/out fifo
|
when cfs_reg2_addr_c => cfs_reg_wr(2) <= data_i; -- for example: command fifo
|
when cfs_reg2_addr_c => cfs_reg_wr(2) <= data_i; -- for example: command fifo
|
when cfs_reg3_addr_c => cfs_reg_wr(3) <= data_i; -- for example: status register
|
when cfs_reg3_addr_c => cfs_reg_wr(3) <= data_i; -- for example: status register
|
when others => NULL;
|
when others => NULL;
|
end case;
|
end case;
|
end if;
|
end if;
|
end loop; -- i
|
|
|
|
-- read access --
|
-- read access --
|
data_o <= (others => '0'); -- the output has to be zero if there is no actual read access
|
data_o <= (others => '0'); -- the output has to be zero if there is no actual read access
|
if (rden = '1') then -- the read access is always a full 32-bit word wide; if required, the byte/half-word select/masking is done in the CPU
|
if (rden = '1') then -- the read access is always a full 32-bit word wide; if required, the byte/half-word select/masking is done in the CPU
|
case addr is -- make sure to use the internal 'addr' signal for the read/write interface
|
case addr is -- make sure to use the internal 'addr' signal for the read/write interface
|