Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Is Floor function from math_real package is synthesizable.

Status
Not open for further replies.

rakeshk.r

Member level 2
Joined
Nov 12, 2013
Messages
47
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
421
Is Floor function from math_real package synthesizable.

I have to do floor((index-1)*0.5), where index is a signal of integer type. I would like to know whether FLOOR function from math_real package is synthesizable, if not then i will have to think for an alternate solution. I use Quartus II version 11.1 synthesis tool. In addition to this i got a general question, does the functions in math_real package used only for simulation purpose or does it have any functions which can be synthesized ? Thank you.
 

Forget math_real for synthesizeable code. Also forget about multiplying with 0.5, divide by 2 instead.
If (index-1) can't be negative you can just write (index-1)/2.
If (index-1) can be negative, you should write a function to do it, with integer argument and return value.
 

I am doing multiplication with 0.5 to avoid division operator because division is a slow process and consumes lot of hardware. I need the integer part of the answer. So, all I wanted to know is, whether floor is a synthesizable vhdl statement. By the way the index is not negative.
 

most compilers and synthesis tools will convert division by a power of two into a right shift operator. VHDL has a definition for division where (-a)/b = -(a/b), so for signed types, it cannot infer a simple shift from a division by a power of two.

math.real has limited use in synthesizable code. It is mostly used to generate integer constants.
 
You can use math_real to to initialisation (like setting up initial values, constants, or generate statements) but cannot use used any anything that generates logic.
so floor((index-1)*0.5) is fine, as long as it defines a constant or initial value, but you cannot assign it to a signal or variable inside a process.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top