Guest
I am working on a project where synthesis of my design is claiming
that a bit is unused and I'm assuming is optimizing it away. I'm not
sure it is actually being optimized away because the design has timing
problems in another area, so I am unable to test it. But my
experience has been that if a synthesis tool says that something is
unused and you know it isn't, then problems are going to happen .
First I'll post the relevant section:
-- Not the real declarations, but these are needed to understand the
code below.
signal highbit : unsigned(3 downto 0);
constant inBits : positive := 10;
constant outBits : positive := 4;
...........
architecture behavior of bitselector_1 is
type bit_sel_array is array (0 to inBits - outBits) of
signed(outBits-2 downto 0);
signal bit_selections : bit_sel_array;
begin
............
-- Select the appropriate range of bits based on highbit
process(bit_selections, highbit) is
variable subset_sel : integer range 0 to inBits - outBits;
begin
subset_sel := to_integer(highbit - (outBits-1));
output(outBits-2 downto 0) <= bit_selections(subset_sel);
end process;
............
end behavior;
I'm using an older version of Synplify Pro (8.1). It claims that
highbit(3) is unused. Now my guess is that it looks at the
bit_selections array and sees that there are only 7 elements, meaning
only 3-bits are needed to address the array. Since highbit is 4-bits
wide, it assumes that the most significant bit is unnecessary. The
problem is that highbit ranges from 3 to 9, which means that all four
bits are necessary. The tool doesn't realize that the input is 4-
bits, but is reduced to 3-bits by the subtraction to create
subset_sel.
I'm looking for the best way to modify this so that the tool does not
optimize away necessary hardware. The first thing that popped in my
mind was to modify the array to range from 3 to 9 instead of 0 to 6.
This would eliminate the need for subtraction and highbit could be
used directly. The downside that I see is that you now have a 4-bit
address instead of a 3-bit. Ideally, I would want a 4-bit subtracter
that subtracts 3 from highbit and then only the lower 3 bits are used
to address. I tried this solution once in simulation, but ran into
trouble because highbit is unknown at the beginning of the simulation,
which causes to_integer to return 0, which is outside the range of the
array.
Does my solution make sense and does anyone have any better ideas?
Thanks,
Matt
that a bit is unused and I'm assuming is optimizing it away. I'm not
sure it is actually being optimized away because the design has timing
problems in another area, so I am unable to test it. But my
experience has been that if a synthesis tool says that something is
unused and you know it isn't, then problems are going to happen .
First I'll post the relevant section:
-- Not the real declarations, but these are needed to understand the
code below.
signal highbit : unsigned(3 downto 0);
constant inBits : positive := 10;
constant outBits : positive := 4;
...........
architecture behavior of bitselector_1 is
type bit_sel_array is array (0 to inBits - outBits) of
signed(outBits-2 downto 0);
signal bit_selections : bit_sel_array;
begin
............
-- Select the appropriate range of bits based on highbit
process(bit_selections, highbit) is
variable subset_sel : integer range 0 to inBits - outBits;
begin
subset_sel := to_integer(highbit - (outBits-1));
output(outBits-2 downto 0) <= bit_selections(subset_sel);
end process;
............
end behavior;
I'm using an older version of Synplify Pro (8.1). It claims that
highbit(3) is unused. Now my guess is that it looks at the
bit_selections array and sees that there are only 7 elements, meaning
only 3-bits are needed to address the array. Since highbit is 4-bits
wide, it assumes that the most significant bit is unnecessary. The
problem is that highbit ranges from 3 to 9, which means that all four
bits are necessary. The tool doesn't realize that the input is 4-
bits, but is reduced to 3-bits by the subtraction to create
subset_sel.
I'm looking for the best way to modify this so that the tool does not
optimize away necessary hardware. The first thing that popped in my
mind was to modify the array to range from 3 to 9 instead of 0 to 6.
This would eliminate the need for subtraction and highbit could be
used directly. The downside that I see is that you now have a 4-bit
address instead of a 3-bit. Ideally, I would want a 4-bit subtracter
that subtracts 3 from highbit and then only the lower 3 bits are used
to address. I tried this solution once in simulation, but ran into
trouble because highbit is unknown at the beginning of the simulation,
which causes to_integer to return 0, which is outside the range of the
array.
Does my solution make sense and does anyone have any better ideas?
Thanks,
Matt