Search code examples
vhdlsynthesisvivado

Unused sequential element


I get a warning

[Synth 8-6014] Unused sequential element count_reg was removed. 

when I synthesize the following code:

SPECCOUNT: process (clk, load_cnt)
  variable count : integer := 0;
begin
  if (rising_edge(clk)) then
    if (count = load_cnt) then
      count := count + 1;
      overflow <= '0';
    else
      count := 0;
      overflow <= '1';
    end if;  
  end if;      
end process SPECCOUNT;

The warning means that the Synthesizer doesn't need the variable to synthesize the code. Is this correct?

When yes, how is this possible?

When no, is it a error that need to be fixed?


Solution

  • Synthesis is doing exactly as expected (assuming "load_cnt" is something other than 0; if this was an [MCVE] we could see whether or not it was)

    Write a testbench and simulate this unit, and you will find out why it can eliminate "count" altogether.