Electronic – Do ALUs perform all/most N operations before running through the multiplexer

alucircuitsdigital-logic

I'm doing some self-study on hardware and currently implementing an ALU. The way I'm designing it is such that I have an N:1 MUX (N inputs yield a single output (16 bit number) based on selector bits). I feed in 2 16-bit numbers with a series of control bits to get my output.

My question is that I have a bunch of gates that execute before they hit the MUX and then the MUX says "based on these control bits I'll output this calculation". Just wondering if it is inefficient to execute all these operations even if they aren't used/outputted.

For example, if I simply want to negate A, the circuit will still perform other arithmetic operations despite not using them at all in the final result. It seems like it would increase the time to get the desired result since you're running through more gates.

Best Answer

Using any modern synthesis tool you can be reasonably sure it'll optimise away any redundancy it possibly can, to the point of sometimes eliminating the entire design if it wasn't tested properly in simulation first.

So, yes this is inefficient; but synth will fix that.

Better to keep what you write simple, clean and clear. 16 ops and a 16:1 MUX fills that bill.