- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi to all
if anybody having coding for division please do help meLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here is division in VHDL:
a <= b / c;- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DOes the quartus supply the special circuit for division?
What's the restriction or result fomat for a ,b and c on condition of a<=b/c?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
he only wanted division in VHDL - he never said anything about synthesising it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aha! But I want to know if both the dividend and divider are integer, if so the result must be integer too?
Many hardware and synthesis tools support the division implementation, and also many have special IP division module where the synthesis should be implemented. So,if use a<=b/c,is the tool to implement in IP ?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With ieee.numeric_std, Quartus actually infers signed and unsigned dividers from HDL code, so you don't necessarily need to instantiate a divider MegaFunction. If you want multiple pipeline stages or other special features, you still need the Megafunction. With ieee.std_logic_arith, dividers are apparently only infered for the integer data type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but when i use quartus it is not accepting the division(/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- quartus it is not accepting the division(/) --- Quote End --- It does, under the conditions I told. (Valid at least for V9.0 and later).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- but when i use quartus it is not accepting the division(/) --- Quote End --- are you trying to divide std_logic_vectors? you cant do that. a std_logic_vector is not a number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For division between unsigned, you need "USE ieee.numeric_std.all;" in VHDL (I think)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if you want to do division of any significant bitwidth (>3~4 bits num and den), you need to instantiate the divider megafunction and then configure it to have several pipe stages. This will allow it to meet timing when you actually try to compile it.
If you want some fractional bits in your answer, then you need to tack on some zeros in the numerator (similar to left shifting the number in c eg. shifted_num = num << frac_bits).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- if you want to do division of any significant bitwidth (>3~4 bits num and den), you need to instantiate the divider megafunction --- Quote End --- Cyclone III achieves > 50 MHz for a 8:8 Bit signed and > 40 MHz for a 12:8 Bit unsigned divider (between registers). This is at least a significant bitwidth at reasonable clock frequency, I think. If you want more, you need divider internal pipelining and the alt_div MegaFunction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can try adding some extra registers and turning on register retiming, but lpm_divide seems to have significantly better performance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- you can try adding some extra registers and turning on register retiming --- Quote End --- Sounds like poor mans pipelining, but an interesting suggestion though. Seriously, if the infered divider doesn't achieve the intended speed, you should use an explicite instantiation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- It does, under the conditions I told. (Valid at least for V9.0 and later). --- Quote End --- If i use version 9 or later will it accept the division . i have not yet used version 9.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Divider interference works with previous Quartus versions as well, I checked V6.0 and V8.1. I guess, you ignored the other points that have been said in the above discussion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or the best solution is to redesign the algorithm so that you dont have to do the divide in the first place - stick to multiplies instead.
a/b = a * 1/b. Do the 1/b function on something else (like a processor) if you can.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Or the best solution is to redesign the algorithm so that you dont have to do the divide in the first place - stick to multiplies instead. a/b = a * 1/b. Do the 1/b function on something else (like a processor) if you can. --- Quote End --- but 1/b also has a division then how can it accept?. or how to do it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- but 1/b also has a division then how can it accept?. or how to do it --- Quote End --- Hence why I said take it off FPGA onto something like a processor. Division can be done fine on an FPGA, it just eats through resources.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If speed is not important you could fall back on a serial divider mechanism, doing 'long division' in binary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Sounds like poor mans pipelining, but an interesting suggestion though. --- Quote End --- if by poor you mean lazy, certainly. :) it would be nice if register retiming could meet the fmax of an lpm function. i haven't found it to do so with wide multipliers (24 bit) in CIII either.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page