Merge pull request #206 from Jbalkind/icachecleanup

Icache constants cleanup
pull/219/head
Paul Mackerras 4 years ago committed by GitHub
commit 419c9a68e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,6 +32,12 @@ entity icache is
SIM : boolean := false; SIM : boolean := false;
-- Line size in bytes -- Line size in bytes
LINE_SIZE : positive := 64; LINE_SIZE : positive := 64;
-- BRAM organisation: We never access more than wishbone_data_bits at
-- a time so to save resources we make the array only that wide, and
-- use consecutive indices for to make a cache "line"
--
-- ROW_SIZE is the width in bytes of the BRAM (based on WB, so 64-bits)
ROW_SIZE : positive := wishbone_data_bits / 8;
-- Number of lines in a set -- Number of lines in a set
NUM_LINES : positive := 32; NUM_LINES : positive := 32;
-- Number of ways -- Number of ways
@ -65,19 +71,14 @@ entity icache is
end entity icache; end entity icache;


architecture rtl of icache is architecture rtl of icache is
-- BRAM organisation: We never access more than wishbone_data_bits at constant ROW_SIZE_BITS : natural := ROW_SIZE*8;
-- a time so to save resources we make the array only that wide, and
-- use consecutive indices for to make a cache "line"
--
-- ROW_SIZE is the width in bytes of the BRAM (based on WB, so 64-bits)
constant ROW_SIZE : natural := wishbone_data_bits / 8;
-- ROW_PER_LINE is the number of row (wishbone transactions) in a line -- ROW_PER_LINE is the number of row (wishbone transactions) in a line
constant ROW_PER_LINE : natural := LINE_SIZE / ROW_SIZE; constant ROW_PER_LINE : natural := LINE_SIZE / ROW_SIZE;
-- BRAM_ROWS is the number of rows in BRAM needed to represent the full -- BRAM_ROWS is the number of rows in BRAM needed to represent the full
-- icache -- icache
constant BRAM_ROWS : natural := NUM_LINES * ROW_PER_LINE; constant BRAM_ROWS : natural := NUM_LINES * ROW_PER_LINE;
-- INSN_PER_ROW is the number of 32bit instructions per BRAM row -- INSN_PER_ROW is the number of 32bit instructions per BRAM row
constant INSN_PER_ROW : natural := wishbone_data_bits / 32; constant INSN_PER_ROW : natural := ROW_SIZE_BITS / 32;
-- Bit fields counts in the address -- Bit fields counts in the address


-- INSN_BITS is the number of bits to select an instruction in a row -- INSN_BITS is the number of bits to select an instruction in a row
@ -118,7 +119,7 @@ architecture rtl of icache is
subtype row_in_line_t is unsigned(ROW_LINEBITS-1 downto 0); subtype row_in_line_t is unsigned(ROW_LINEBITS-1 downto 0);


-- The cache data BRAM organized as described above for each way -- The cache data BRAM organized as described above for each way
subtype cache_row_t is std_ulogic_vector(wishbone_data_bits-1 downto 0); subtype cache_row_t is std_ulogic_vector(ROW_SIZE_BITS-1 downto 0);


-- The cache tags LUTRAM has a row per set. Vivado is a pain and will -- The cache tags LUTRAM has a row per set. Vivado is a pain and will
-- not handle a clean (commented) definition of the cache tags as a 3d -- not handle a clean (commented) definition of the cache tags as a 3d
@ -363,7 +364,7 @@ begin
way: entity work.cache_ram way: entity work.cache_ram
generic map ( generic map (
ROW_BITS => ROW_BITS, ROW_BITS => ROW_BITS,
WIDTH => wishbone_data_bits WIDTH => ROW_SIZE_BITS
) )
port map ( port map (
clk => clk, clk => clk,

Loading…
Cancel
Save