Altera_Forum
Honored Contributor
14 years agoFIFO usedw signal optimization
Hello,
I have a design that use FIFO to store data. Everything works fine if I check fifo_empty='0' before my FSM starts, but I want to have some space and use fifo_usedw signal. To check the half-full FIFO flag, I use the MSB of the usedw signal, but seems like synthesizer removes the signal, thus my FSM collapses with the whole design. How come rdusedw signal is optimized, if I use it to check for a certain value?
case read_state is
when wait_for_fifo => -- Begin fifo read state machine
coe_ts_valid <= '0';
coe_ts_start <= '0';
fifo_rdreq <= '0';
if(fifo_usedw(13)='1') then -- fifo_empty='0' -- Check for half full flag, instead of not empty
read_state <= start;
else
read_state <= wait_for_fifo;
end if;
when start => -- ack fifo and begin data read
fifo_rdreq <= '1';
coe_ts_start <= '1';
coe_ts_valid <= '1';
read_state <= count_end;
when count_end => -- check for certain packet number
fifo_rdreq <= '1';
coe_ts_start <= '0';
if(octets_counter=186) then
octets_counter <= (others => '0');
read_state <= wait_for_fifo;
--octets_valid <= '0';
else
octets_counter <= octets_counter + 1;
read_state <= count_end;
end if;
end case;
FIFO is instantiated like this:
aclr => csi_reset,
wrclk => csi_clk,
rdclk => csi_clk,
data(31 downto 24) => asi_data(7 downto 0),
data(23 downto 16) => asi_data(15 downto 8),
data(15 downto 8) => asi_data(23 downto 16),
data(7 downto 0) => asi_data(31 downto 24),
rdreq => fifo_rdreq,
wrreq => fifo_wrreq,
rdempty => fifo_empty,
wrfull => fifo_wrfull,
q => coe_ts_data,
rdusedw => fifo_usedw
I thought that if I instantiate the rdusedw signal with too short signal or use other short values, then ir could be removed, but I've double checked all the signals, all of them are 14 bits as required.