I have a problem when synthesizing code with generics : My entity is :
entity MyEntity is
generic(
OUTWIDTH : integer range 8 to 64;
NBREG : integer range 2 to 8);
port(
port1 ....
port2 ....
);
end entity;
architecture rtl of MyEntity is
constant KEEP_VAL : std_logic_vector(OUTWIDTH/8-1 downto 0) := (others=>'1'); -- used to compare my signal with (others=>'1')
signal keep : std_logic_vector((NBREG*OUTWIDTH/8)-1 downto 0);
begin
process(clk)
variable v1 : integer range 0 to NBREG-1
begin
if(rising_edge(clk)) then
--SOME CODE
....
....
-- The comparison I want to do :
if(keep((v1+1)*(OUTWIDTH/8)-1 downto v1*(OUTWIDTH/8)) = KEEP_VAL) then -- the line where the error appears
-- DO sthg
end if;
end process;
end rtl;
To resume, I want to know if all the bits of a signal with a generic width (OUTWIDTH) are '1'. The previous code works well in simulations but doesn't whant to be synthesized. synplify for Libero : @E: CD289 : Expecting constant expression
I assume I could do it with a function (for loop on each bit and compare with '1') but is there an other "direct" option ?
Thank you.