cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
1,609 Views
Registered: ‎07-24-2016

Best way to implement arithmetic operations

Hi ,

 

I want to implement some arithmetic operations as shown below using VHDL/verilog.

 

res = a + b + c

d = a* b* c

f = d / e

 

Which is the best way to implement (optimized interms of power/resource) above expressions in VIVADO tool?

Can I use Xilinx adder / multiplirer / divider IP cores OR

Direct usage of expressions as shown below enough ?

 

res <= a + b + c;

d    <= a* b* c;

f     <= d / e;

0 Kudos
3 Replies
Highlighted
Scholar
Scholar
1,589 Views
Registered: ‎02-27-2008

Re: Best way to implement arithmetic operations

"Best"

 

Is vague.  Power/resources is still vague.  Just try it both ways.  Examine the results.  See what is done.

 

 

Austin Lesea
Principal Engineer
Xilinx San Jose
0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
1,578 Views
Registered: ‎08-01-2008

Re: Best way to implement arithmetic operations

yes you can use Xilinx adder/substractor , multiplier and divider core .

choose the correct strategy to synthesis /design implementation . One approach is, run synthesis with default settings and observe the run results, the generated netlist to check timing results and utilization(and more factors). After the analysis, if you find that generated netlist can be improved in terms of runtime, area or timing then you can select the strategy based on your analysis.

You can find all the details in below user guide:
https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_2/ug901-vivado-synthesis.pdf

Hope it may help you
Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
0 Kudos
Highlighted
1,560 Views
Registered: ‎06-21-2017

Re: Best way to implement arithmetic operations

You probably need to use a core for division.  f = d/e is generally not synthesizable.  You may be able to write RTL to  perform division but you are very unlikely to do any better than the core. 

 

The rest of this post is mostly personal opinion.  If you write your adder, subractor code in VHDL or Verilog, the synthesis tool will generally use fabric for this.  The synthesis tool and the fast carry resources make this a good option.  The core may give you explicit options for using a DSP slice but you can do this with an attribute if you take the time to look up the syntax.  Writing the adder/subtractor in RTL does make the code more portable.

 

The synthesizer will almost always put a multiplication in a DSP slice if you write RTL and have a DSP available.  A nice thing about the core GUI is that it will remind you that you need a couple pipeline delays for the DSP slice to work at a reasonable frequency.  The synthesis tool is generally good enough to use the DSP registers if they are present in your RTL.  So if you have enough experience to put enough registers before and after the multiplication and want portable code, write RTL.  If you're just getting started, the multiplication core will help keep you on the right track.

0 Kudos