What's the most efficient way to perform an "equal to zero" operation in a V2 chip? What I've been doing is ANDing all the bits together in a binary tree and relying on the mapper to put that into LUTs correctly. Is this a good way to do it?
equal to zero
Hi,
use a 4 input AND gate (for every 4 inputs you need to instantiate a LUT and don't forget the INIT value to program the LUT to behave as an
4AND) and if you need more inputs chain the LUTs with the dedicated carry chain. using this approach the you'll keep the logic levels down to 1 + carry chain propagation delay.if you have EDK you can check the address decoders in the file pselect.vhd (same tehnique presented above)
Aurash
Typically the best way to do a comparison to zero is to use (checkMe==0). The synthesizer is typically aware of the tradeoffs in your target architecture. Most often a simple tree of cascaded elements is simple. Sometimes the carry chain is a better way to go for a very wide comparison but those tradeoffs are hard to know with a pencil and paper.
The advantage of leaving it to the synthesizer is that your code is much more readable. Have you ever walked up to code you wrote more than a year ago and wonder what the heck you were trying to do? Imagine what it's like for others.
The AND you mention works on the inverted "checkMe" in my example: &(~checkMe)
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required