KJ wrote:
>
> First of all, use a simulator.
I was using it, but the testbench hided the error because wasn't
properly designed.
> My interpretation of your code from your
> description is...
> ...
> signal vectorA: unsigned(7 downto 0); -- Some size vector, by your
> assignment statement it must've been unsigned
> signal vectorB: std_logic_vector(6 downto 0); -- Some different sized
> vector, by your assignment it must not have been unsigned
> begin
> vectorA <= unsigned (vectorB);
> ....
correct.
>
> Surprising that Synplify doesn't complain, but Modelsim gives the following
> error (not warning) which is expected since the vectors are different sizes.
As I said, I'm not sure that Synplify didn't complain because I didn't
check carefully all the type of warnings (basically I have a lot of them
complaining because not all the global registers I declared in the
package were used by each entity, but this didn't really bother me).
>
> Error:
> C:/Sim/ZPOC_Sim/HDL/ZFpga_Common/Avl_Track_Controller/Track_Controller/Track_Controller.vhd(265):
> Length of expected is 8; length of actual is 7.
>
Once synthesized I usually simulate a post-synthesis and a post-layout
file, which will not show the problem anymore
> Assuming that the vectors are the size that you really do want them to be
> then the proper assignment is...
unfortunately this is not true, the problem was just that I forgot to
change the length in vectorB declaration, so this led me to the problem.
Being just a warning (maybe), mixed up in several other meaningless
warning, didn't really catch my attention, that's why I was wondering if
it exists a conversion function which give you error when length are not
the same (as conv_unsigned in the std_logic_arith library) when
converting from a std_logic_vector to unsigned.
Maybe is an issue for the Synplify compiler...
>
> vectorA <= ieee.numeric_std.resize(unsigned(vectorB), vectorA'length);
> or
> vectorA <= resize(unsigned(vectorB), vectorA'length);
> if you've already got a "use ieee.numeric_std.all" statement in your code.
>
that's good to know, I've never used the function "resize". Thanks
> KJ
>
>
--
Alessandro Basili
CERN, PH/UGC
Hardware Designer
|