Forum Discussion
Altera_Forum
Honored Contributor
12 years agoThe logic generated depends on the function, and where it is called. A function cannot have pipelining of itself, but can be called inside a clocked process to place a register on the return value of the function.
So, as with any code, too many operations between registers leads to poorer timing performance. A function is usually just a way of wrapping up code so that can be easily reused, or tidy up some messy type conversions that would actually be free in logic. The third case is as Dave mentions - creating compile time constants/generics. So for fairly straight forward operations, like generating a sin table for a ROM, you can use a function instead of manually creating a large array. Or you could use generics in some complicated formula to create other generics. Remember that constants are created at compile time and hence require 0 logic.