Line 9... |
Line 9... |
-- # Even when all processor-internal memories and IO devices are disabled, the EXTERNAL address #
|
-- # Even when all processor-internal memories and IO devices are disabled, the EXTERNAL address #
|
-- # space ENDS at address 0xffff0000 (begin of internal BOOTROM address space). #
|
-- # space ENDS at address 0xffff0000 (begin of internal BOOTROM address space). #
|
-- # ********************************************************************************************* #
|
-- # ********************************************************************************************* #
|
-- # 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 77... |
Line 77... |
ack_o : out std_ulogic; -- transfer acknowledge
|
ack_o : out std_ulogic; -- transfer acknowledge
|
err_o : out std_ulogic; -- transfer error
|
err_o : out std_ulogic; -- transfer error
|
tmo_o : out std_ulogic; -- transfer timeout
|
tmo_o : out std_ulogic; -- transfer timeout
|
priv_i : in std_ulogic_vector(01 downto 0); -- current CPU privilege level
|
priv_i : in std_ulogic_vector(01 downto 0); -- current CPU privilege level
|
ext_o : out std_ulogic; -- active external access
|
ext_o : out std_ulogic; -- active external access
|
|
-- xip configuration --
|
|
xip_en_i : in std_ulogic; -- XIP module enabled
|
|
xip_page_i : in std_ulogic_vector(03 downto 0); -- XIP memory page
|
-- wishbone interface --
|
-- wishbone interface --
|
wb_tag_o : out std_ulogic_vector(02 downto 0); -- request tag
|
wb_tag_o : out std_ulogic_vector(02 downto 0); -- request tag
|
wb_adr_o : out std_ulogic_vector(31 downto 0); -- address
|
wb_adr_o : out std_ulogic_vector(31 downto 0); -- address
|
wb_dat_i : in std_ulogic_vector(31 downto 0); -- read data
|
wb_dat_i : in std_ulogic_vector(31 downto 0); -- read data
|
wb_dat_o : out std_ulogic_vector(31 downto 0); -- write data
|
wb_dat_o : out std_ulogic_vector(31 downto 0); -- write data
|
Line 101... |
Line 104... |
|
|
-- access control --
|
-- access control --
|
signal int_imem_acc : std_ulogic;
|
signal int_imem_acc : std_ulogic;
|
signal int_dmem_acc : std_ulogic;
|
signal int_dmem_acc : std_ulogic;
|
signal int_boot_acc : std_ulogic;
|
signal int_boot_acc : std_ulogic;
|
|
signal xip_acc : std_ulogic;
|
signal xbus_access : std_ulogic;
|
signal xbus_access : std_ulogic;
|
|
|
-- bus arbiter
|
-- bus arbiter
|
type ctrl_state_t is (IDLE, BUSY);
|
type ctrl_state_t is (IDLE, BUSY);
|
type ctrl_t is record
|
type ctrl_t is record
|
Line 158... |
Line 162... |
-- access to processor-internal IMEM or DMEM? --
|
-- access to processor-internal IMEM or DMEM? --
|
int_imem_acc <= '1' when (addr_i(31 downto index_size_f(MEM_INT_IMEM_SIZE)) = imem_base_c(31 downto index_size_f(MEM_INT_IMEM_SIZE))) and (MEM_INT_IMEM_EN = true) else '0';
|
int_imem_acc <= '1' when (addr_i(31 downto index_size_f(MEM_INT_IMEM_SIZE)) = imem_base_c(31 downto index_size_f(MEM_INT_IMEM_SIZE))) and (MEM_INT_IMEM_EN = true) else '0';
|
int_dmem_acc <= '1' when (addr_i(31 downto index_size_f(MEM_INT_DMEM_SIZE)) = dmem_base_c(31 downto index_size_f(MEM_INT_DMEM_SIZE))) and (MEM_INT_DMEM_EN = true) else '0';
|
int_dmem_acc <= '1' when (addr_i(31 downto index_size_f(MEM_INT_DMEM_SIZE)) = dmem_base_c(31 downto index_size_f(MEM_INT_DMEM_SIZE))) and (MEM_INT_DMEM_EN = true) else '0';
|
-- access to processor-internal BOOTROM or IO devices? --
|
-- access to processor-internal BOOTROM or IO devices? --
|
int_boot_acc <= '1' when (addr_i(31 downto 16) = boot_rom_base_c(31 downto 16)) else '0'; -- hacky!
|
int_boot_acc <= '1' when (addr_i(31 downto 16) = boot_rom_base_c(31 downto 16)) else '0'; -- hacky!
|
|
-- XIP access? --
|
|
xip_acc <= '1' when (xip_en_i = '1') and (addr_i(31 downto 28) = xip_page_i) else '0';
|
-- actual external bus access? --
|
-- actual external bus access? --
|
xbus_access <= (not int_imem_acc) and (not int_dmem_acc) and (not int_boot_acc);
|
xbus_access <= (not int_imem_acc) and (not int_dmem_acc) and (not int_boot_acc) and (not xip_acc);
|
|
|
|
|
-- Bus Arbiter -----------------------------------------------------------------------------
|
-- Bus Arbiter -----------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
bus_arbiter: process(rstn_i, clk_i)
|
bus_arbiter: process(rstn_i, clk_i)
|