litedram: Pipeline store acks in L2

There is a long timing path to generate the ack signal from
the L2 cache as it's fully combinational for stores, including
signals coming from litedram.

Instead, pipeline the store acks. This will introduce a cycle
latency but should improve timing. Also the core will eventually
be smart enough not to wait for store acks to complete them anyway.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
pull/198/head
Benjamin Herrenschmidt 5 years ago
parent 5ae5f76558
commit 05bbbf0772

@ -245,13 +245,17 @@ architecture behaviour of litedram_wrapper is
signal wb_stash : wishbone_master_out := wishbone_master_out_init; signal wb_stash : wishbone_master_out := wishbone_master_out_init;


-- Read pipeline (to handle cache RAM latency) -- Read pipeline (to handle cache RAM latency)
signal read_ack_0 : std_ulogic; signal read_ack_0 : std_ulogic := '0';
signal read_ack_1 : std_ulogic; signal read_ack_1 : std_ulogic := '0';
signal read_ad3_0 : std_ulogic; signal read_ad3_0 : std_ulogic;
signal read_ad3_1 : std_ulogic; signal read_ad3_1 : std_ulogic;
signal read_way_0 : way_t; signal read_way_0 : way_t;
signal read_way_1 : way_t; signal read_way_1 : way_t;


-- Store ack pipeline
signal store_ack_0 : std_ulogic := '0';
signal store_ack_1 : std_ulogic := '0';

-- Async signals decoding latched request -- Async signals decoding latched request
type req_op_t is (OP_NONE, type req_op_t is (OP_NONE,
OP_LOAD_HIT, OP_LOAD_HIT,
@ -625,7 +629,6 @@ begin
-- Stall when stash is full -- Stall when stash is full
wb_out.stall <= wb_stash.cyc; wb_out.stall <= wb_stash.cyc;


--
-- --
-- Read response pipeline -- Read response pipeline
-- --
@ -657,6 +660,16 @@ begin
end if; end if;
end process; end process;


--
-- Store acks pipeline
--
store_ack_pipe: process(system_clk)
begin
if rising_edge(system_clk) then
store_ack_1 <= store_ack_0;
end if;
end process;

wb_reponse: process(all) wb_reponse: process(all)
variable rdata : std_ulogic_vector(DRAM_DBITS-1 downto 0); variable rdata : std_ulogic_vector(DRAM_DBITS-1 downto 0);
variable store_done : std_ulogic; variable store_done : std_ulogic;
@ -717,15 +730,16 @@ begin
store_done := '0'; store_done := '0';
end if; end if;


-- Generate ACKs on read hits and store complete -- Pipeline store acks
store_ack_0 <= store_done;

-- Generate Wishbone ACKs on read hits and store complete
-- --
-- XXXX TODO: This can happen on store right behind loads ! -- This can happen on store right behind loads ! This is why
-- This probably need to be fixed by putting store acks in -- we don't accept a new store right behind a load ack above.
-- the same pipeline as the read acks. TOOD: Create a testbench
-- to exercise those corner cases as the core can't yet.
-- --
wb_out.ack <= read_ack_1 or store_done; wb_out.ack <= read_ack_1 or store_ack_1;
assert read_ack_0 = '0' or store_done = '0' report assert read_ack_1 = '0' or store_ack_1 = '0' report
"Read ack and store ack collision !" "Read ack and store ack collision !"
severity failure; severity failure;
end process; end process;

Loading…
Cancel
Save