use work.utils.all;
use work.wishbone_types.all;
+--- verilator access TODO
+
--! @brief Simple memory module for use in Wishbone-based systems.
entity wishbone_bram_wrapper is
generic(
bram_we : out std_ulogic;
bram_re : out std_ulogic;
bram_addr : out std_logic_vector(log2ceil(MEMORY_SIZE) - 3- 1 downto 0);
- bram_di : inout std_logic_vector(63 downto 0);
- bram_do : out std_logic_vector(63 downto 0);
+ bram_di : out std_logic_vector(63 downto 0);
+ bram_do : in std_logic_vector(63 downto 0);
bram_sel : out std_logic_vector(7 downto 0)
);
end entity wishbone_bram_wrapper;
architecture behaviour of wishbone_bram_wrapper is
- constant ram_addr_bits : integer := log2ceil(MEMORY_SIZE-1) - 3;
+ constant ram_addr_bits : integer := log2ceil(MEMORY_SIZE) - 3;
-- RAM interface
signal ram_addr : std_logic_vector(ram_addr_bits - 1 downto 0);
begin
-- Actual RAM template
+ sim_ram: if SIM_MAIN_BRAM = true generate
ram_0: entity work.main_bram
generic map(
WIDTH => 64,
re => ram_re,
we => ram_we
);
+ end generate;
+
+ -- Verilator access to bram signals
+ bram_sel <= wishbone_in.sel;
+ wishbone_out.dat <= bram_do;
+ bram_di <= wishbone_in.dat;
+ bram_addr <= ram_addr;
+ bram_we <= ram_we;
+ bram_re <= ram_re;
-- Wishbone interface
ram_addr <= wishbone_in.adr(ram_addr_bits - 1 downto 0);