Commit 4f56571d authored by Dimitris Lampridis's avatar Dimitris Lampridis

hdl: fix bug in BFM not respecting P2L_RDY during DMA writes

Signed-off-by: Dimitris Lampridis's avatarDimitris Lampridis <dimitris.lampridis@cern.ch>
parent d0c2399b
......@@ -630,7 +630,7 @@ CMD <= f_cmd_to_string(CMD_INT);
--=========================================================================--
-- Generate the Internal LCLK
--=========================================================================--
process
gen_int_clk: process
begin
CLK0o <= '0';
CLK90o <= '0';
......@@ -647,7 +647,7 @@ CMD <= f_cmd_to_string(CMD_INT);
wait until(CMD_CLOCK_EN'event and CMD_CLOCK_EN and PRIMARY);
end if;
end loop;
end process;
end process gen_int_clk;
PRIMARY <= MODE_PRIMARY;
SECONDARY <= not MODE_PRIMARY;
......@@ -915,7 +915,7 @@ CMD <= f_cmd_to_string(CMD_INT);
-- (Handles TX from the BFM: P2L for Primary and L2P for secondary)
--
--#########################################################################--
process
p_out_fsm: process
--file OUT_FILE : text is out "STD_OUTPUT";
file OUT_FILE : text open write_mode is "NullFile";
variable OUTPUT_LINE : line;
......@@ -2187,7 +2187,14 @@ writeline(OUT_FILE, OUTPUT_LINE);
OUT_VALID <= '1';
OUT_DFRAME <= '1';
wait until(CLK'event and (CLK = '1'));
-- Do not proceed if the FPGA is not ready
loop
wait until(CLK'event and (CLK = '1'));
if (P2L_RDY = '1') then
exit;
end if;
OUT_VALID <= '0';
end loop;
-- See if we want to insert random wait states
if(IWAIT_RANDOM > 0) then -- Insert wait states
......@@ -2236,7 +2243,16 @@ writeline(OUT_FILE, OUTPUT_LINE);
OUT_DFRAME <= '0';
end if;
wait until(CLK'event and (CLK = '1'));
OUT_VALID <= '1';
-- Do not proceed if the FPGA is not ready
loop
wait until(CLK'event and (CLK = '1'));
if (P2L_RDY = '1') then
exit;
end if;
OUT_VALID <= '0';
end loop;
CPL_POP_PTR(CPL_CID) := CPL_POP_PTR(CPL_CID) + 1;
......@@ -2275,7 +2291,7 @@ writeline(OUT_FILE, OUTPUT_LINE);
end if;
end loop;
end process;
end process p_out_fsm;
--#########################################################################--
--
......@@ -2284,7 +2300,7 @@ writeline(OUT_FILE, OUTPUT_LINE);
-- (Handles RX to the BFM: L2P for Primary and P2L for secondary)
--
--#########################################################################--
process
p_in_fsm: process
--file OUT_FILE : text is out "STD_OUTPUT";
file OUT_FILE : text open write_mode is "NullFile";
variable OUTPUT_LINE : line;
......@@ -2618,7 +2634,7 @@ writeline(OUT_FILE, OUTPUT_LINE);
end loop;
end process;
end process p_in_fsm;
--#########################################################################--
--
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment