Forum Discussion
Altera_Forum
Honored Contributor
15 years agoFor a start, why add two constants in code (hardware) when you can just insert a precomputed result. This is a basic resource usage principle.
However, if you want to add two values then sign extend the inputs by one bit and add up to a result one bit wider than input. Result <= A(7) & A + B(7) & B; -- assuming 8 bit inputs also be warned that if you add up in every case statement then you are asking for an adder instant per case. The compiler is not clever enough to use fewer adders with inputs switching.