Forum Discussion
Altera_Forum
Honored Contributor
18 years agoThough I expect most synthesis tools to do a decent job optimizing my arithmetic, I don't expect miracles. I almost always specify a precise dynamic range if I use integer types. If you use INTEGER all over the place, I see two problems:
First, most tools extract single hierarchies, which are later merged and optimized. Initially, the tool extracts 32-bits for every INTEGER object. If you know something only stores 8-bits of data, that's a lot of wasted bits that consume runtime and memory. Second, if you use Incremental Compilation flow, you will find the all-INTEGER approach unworkable. If a partition boundary contains a 32-bit INTEGER port, then it will take 32-bits in the final netlist - the tool can't use the dynamic range of the input to optimize the arithmetic. I prefer unsigned/signed because they force me to think about the size of my data path, and it's easy to access specific bits in the value. PS: I think my_ram(addr) looks much better than my_ram(to_integer(addr)) :)