I am modifying a multiplier and I am having trouble running it on an FPGA. In Modelsim, the simulation are all correct. I have the following which gives the wrong result on FPGA: Outside of the process statement, I have the following concurrent statement
(I have omitted the signal declarations)
architecture behavioral of multiplier is
...
...
begin
a_argument <= a1_neg when booth = "110"
else a2_plus when booth = "011";
The value of a1_neg and a2_plus are precomputed in a process statement when entering a multiplication state:
when MULT_SIGNED_MULT =>
a1_plus(33 downto 0) <= a(31) & a(31) & a;
a1_neg(33 downto 0) <= not a(31) & not a(31) &bv_negate(a);
a2_plus(33 downto 0) <= a(31) & a & "0";
a2_neg(33 downto 0)<= not a(31) &bv_negate(a) & "0";
And then it enters a stage where multiplier computes new values of booth which influence the a_argument signal
On the other hand, when I don't precompute the values and directly enter everything into the concurrent statement as follows:
a_argument <= not a(31) & not a(31) &bv_negate(a) when booth = "110"
else not a(31) &bv_negate(a) & "0" when booth = "011";
The FPGA will produce a correct result. Also, Modelsim will give the correct result regardless of the difference betewen these two.
I was wondering why one option gives the correct result on FPGA and the other doesn't.
I think your concurrent statement is wrong :
You should have another else statement when booth is different from "110" and "011". An example of a good concurrent statement :
But the default value (others => '0') is maybe not what you want. Maybe you really want a latch, so you should place the assignment of a_argument into a clocked process where the latch of a_argument is done when booth is different from "110" and "011" :