T
Tom Gardner
Guest
On 23/11/16 16:33, Richard Damon wrote:
Agreed.
On 11/21/16 5:07 AM, Tom Gardner wrote:
On 20/11/16 22:43, Tim Wescott wrote:
On Sat, 19 Nov 2016 14:15:18 -0800, Kevin Neilson wrote:
Here's an interesting synthesis result. I synthesized this with Vivado
for Virtex-7:
reg [68:0] x;
reg x_neq_0;
always@(posedge clk) x_neq_0 <= x!=0; // version 1
Then I rephrased the logic:
reg [68:0] x;
reg x_neq_0;
always@(posedge clk) x_neq_0 <= |x; // version 2
These should be the same, right?
Version 1 uses 23 3-input LUTs on the first level followed by a 23-long
carry chain (6 CARRY4 blocks). This is twice as big as it should be.
Version 2 is 3 levels of LUTs, 12 6-input LUTs on the first level, 15
total.
Neither is optimal. What I really want is a combination, 12 6-input
LUTs followed by 3 CARRY4s.
This is supposed to be the era of high-level synthesis...
I'm not enough of an FPGA guy to make really deep comments, but this
looks like the state of C compilers about 20 or so years ago. When I
started coding in C one had to write the code with an eye to the assembly
that the thing was spitting out. Now, if you've got a good optimizer
(and the gnu C optimizer is better than I am on all but a very few of the
processors I've worked with recently), you just express your intent and
the compiler makes it happen most efficiently.
Clearly, that's not yet the case, at least for that particular synthesis
tool. It's a pity.
Of course sometimes you don't want optimisation.
Consider, for example, bridging terms in an asynchronous
circuit.
If you are thinking in terms of an AND-OR tree for the typical LUT based FPGA,
you aren't going to get it right. Most FPGA's now use the LUT, which, at least
for a single LUT, are normally guaranteed to be glitch free for single line
transitions (so no need for the bridging terms). If you need more inputs than a
single LUT provides, and you need need the glitch free performance, than trying
to force a massive AND-OR tree is normally going to be very inefficient, and I
find it worth building the exact structure I need with the Low Level, vendor
provided fundamental LUT/Carry primatives.
Agreed.