M
Mike
Guest
We've come across a problem that we can't explain. Our simulators have no
problem with this, but our formal verification tool found that our
synthesizer produces different code on case 2.3 in the examples below. All
other cases produce identical results in simulation and synthesis.
In the first example, everything comes out the way we expect: in all three
cases, B = A + 1. In the second example, our simulators produce B = A + 1
in all cases. If the original value of A is 14'h0, then B = 14'h1, with
B[2] = 1. However, our synthesizer produces something different in case 2.3
(I'm not sure exactly what, but it's clearly different than the logic
produced in case 2.2, and our formal verification tool says the 2.2 result
is okay, and the 2.3 result is not).
So, the question is, what's going on here? My mental model for the order of
events is this:
1. A gets right justified from [15:2] to [13:0].
2. 1 gets left padded with zeros to 14'h1, or
16'h1 gets left truncated to 14'h1, or
14'h1 gets used as is.
3. A gets added to 14'h1.
4. The result is assigned to B.
Clearly, our synthesizer is having problems with this sequence in case 2.3,
but oddly enough, not in case 2.2. I am confused.
Can anyone help?
// Example 1
reg [13:0] A,B;
A <= somevalue;
B <= A + 1; // 1.1 ok
B <= A + 16'h1; // 1.2 ok
B <= A + 14'h1; // 1.3 ok
// Example 2
reg [15:2] A,B;
A <= somevalue;
B <= A + 1; // 2.1 ok
B <= A + 16'h1; // 2.2 ok
B <= A + 14'h1; // 2.3 not ok
-- Mike --
problem with this, but our formal verification tool found that our
synthesizer produces different code on case 2.3 in the examples below. All
other cases produce identical results in simulation and synthesis.
In the first example, everything comes out the way we expect: in all three
cases, B = A + 1. In the second example, our simulators produce B = A + 1
in all cases. If the original value of A is 14'h0, then B = 14'h1, with
B[2] = 1. However, our synthesizer produces something different in case 2.3
(I'm not sure exactly what, but it's clearly different than the logic
produced in case 2.2, and our formal verification tool says the 2.2 result
is okay, and the 2.3 result is not).
So, the question is, what's going on here? My mental model for the order of
events is this:
1. A gets right justified from [15:2] to [13:0].
2. 1 gets left padded with zeros to 14'h1, or
16'h1 gets left truncated to 14'h1, or
14'h1 gets used as is.
3. A gets added to 14'h1.
4. The result is assigned to B.
Clearly, our synthesizer is having problems with this sequence in case 2.3,
but oddly enough, not in case 2.2. I am confused.
Can anyone help?
// Example 1
reg [13:0] A,B;
A <= somevalue;
B <= A + 1; // 1.1 ok
B <= A + 16'h1; // 1.2 ok
B <= A + 14'h1; // 1.3 ok
// Example 2
reg [15:2] A,B;
A <= somevalue;
B <= A + 1; // 2.1 ok
B <= A + 16'h1; // 2.2 ok
B <= A + 14'h1; // 2.3 not ok
-- Mike --