- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is Quartus able to infer Cyclone II carry chains automatically in synthesis from user Verilog code, or only within Altera's own library modules? I'm using 10.1SP1 web edition on Linux.
I've written a simple ripple-carry adder which should be an obvious case for using carry chains. I've used Settings to set Auto Carry Chains on globally (in fact it's the default), and also used the Assignment Editor to set Auto Carry Chains on for the adder module. But the Technology Map Viewer shows that the generated LEs are connected via COMBOUT, not COUT. The description of the Auto Carry Chains option in Quartus Settings says "Allows the Compiler to create carry chains automatically by inserting CARRY_SUM buffers into the design". In other forum threads asking about carry chains, it seems people have only had success by inserting the CARRY_SUMs by hand into their HDL code. Is there any way to get Quartus to do it automatically instead?Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try using a + sign? I don't know how you did a ripple-carry adder but I'm guessing it might have been too low-level for synthesis to understand your intent. Just a guess. Also, open your verilog in Quartus and go to Edit -> Insert Template -> Verilog -> Full Designs -> Arithmetic. These should all get optimal synthesis(i.e. carry chain).
I haven't seen anyone manually instantiate carry_sum in many years.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Did you try using a + sign? I don't know how you did a ripple-carry adder but I'm guessing it might have been too low-level for synthesis to understand your intent. Just a guess. --- Quote End --- As an experiment I was constructing the adder at a very low level, out of full-adder units:
module full_adder(
input a, b, cin,
output s, cout);
assign s = a^b^cin;
assign cout = a&b | cin&(a^b);
endmodule
When I join these together with CARRY_SUM buffers, the LEs are configured in arithmetic mode with COUT/CIN chaining. Without the CARRY_SUMs, they aren't. Maybe I'm expecting too much of "automatically"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tnink that option is related to the use of the CARRY primitive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently Quartus isn't able to utilize the carry chain respectively LEs in arithmetic mode for synthesis, if the problem isn't presented in the expected way. I recently posted a small code example for demonstration: http://www.alteraforum.com/forum/showthread.php?t=27881
As already mentioned by Rysc, this isn't a problem for arithmetical problems, that are perfectly recognized by the Quartus synthesis. Except for educational purposes, there's no reasonable purpose to implement a low-level adder, I think. As my example shows, there are other problems, that could be considerably speeded up by using arithmetic mode, but apparently Quartus misses the chance. P.S.: I forgot to mention, that a speedwise satisfying solution for the priority problem can be found using an adder, it's also suggested in the Stratix advanced synthesis cookbook. But it involves a doubled LE amount compared to a straightforward carry chain implementation.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Except for educational purposes, there's no reasonable purpose to implement a low-level adder, I think. As my example shows, there are other problems, that could be considerably speeded up by using arithmetic mode, but apparently Quartus misses the chance. --- Quote End --- I agree. I was using the adder as an example to try to find how to get carry chains generated, so I could use this capability for other purposes later. Cyclone II handbook says: --- Quote Start --- The Quartus® II software, in conjunction with parameterized functions such as library of parameterized modules (LPM) functions, automatically chooses the appropriate mode for common functions such as counters, adders, subtractors, and arithmetic functions. If required, you can also create special-purpose functions that specify which LE operating mode to use for optimal performance. --- Quote End --- So, does anyone know how to tell Quartus to use arithmetic mode?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I read from the quoted handbook statetement, that the carry chain is correctly used with LPM functions, (e.g. adder), which can be confirmed, or speacial functions are needed, which apparently means low-level primitives.
I used cycloneiii_lcell_comb, which also corresponds to the suggestion in the Advanced Synthesis Handbook, that WYSIWYG primitives are the clearest way to specify carry in- and outputs explicitely. With the lcell_comb WYSIWYG primitives, arithmetic mode is automatically used, if you connect cout. P.S.: As a special point with WYSIWYG primitives you have to specify the LUT function by a binary mask. I was able to figure out some codes needed for my tests with Cyclone III, but was wondering if there is any complete document. Now I noticed a comment in a Cookbook file (arithmetic/basic_adder.v): --- Quote Start --- Detailed information on the programming of WYSIWYG cells is available through the Altera University Program (for CAD tools research). --- Quote End --- Does anyone know about the details?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A further experimental observation:
Using '+' operator (with data more than 1 bit wide), or LPM_ADD_SUB module, results in COUT/CIN carry chains being used, even when Auto Carry Chains option is turned off. So I'm still looking for an example where Auto Carry Chains option actually does something.- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page