Electronic – ny difference between using a decoder for the alu op code vs using a multiplexer

aludecodermultiplexer

I am a programming student studying electrical engineering fundamentals on the side. I have come across two different methods for getting the result of an operation onto the bus.

  1. A decoder accepts the op code. Each operation has an enabler attached to the output. All operations are performed and the results are stored in the enablers. The enabler that is selected gives the output of the operation.
  2. The output of each operation provides the input for a multiplexer. The op code is the selection input for the multiplexer. The output of the multiplexer is then put onto the bus.

Is there anything functionally different between these two variants? What are the advantages and disadvantages?

Best Answer

What you refer to as "enablers" are called "bus drivers" and are used to selectively gate a particular value onto a bus. They are also called "tri-state" drivers since they have three different output states: driving low, driving high, and not driving at all. Sometimes these come with integrated flip-flops which act as memory forming a "register".

Yes, the overall logic is the same either way, and a bunch of tri-state drivers onto a bus is essentially a multiplexer. The only difference is whether the multiplexing is done inside a IC or you are doing outside at the macro level with separate chips. Doing it inside a single IC allows the operations to be faster, and of course takes up less space.

As a separate point, ALUs don't necessarily work the way you describe. Some functions are performed in parallel, then the result of the right one selected. However, some similar functions may only differ in small ways, and the opcode could be used to select different input data paths along the way. There are various ways to make a ALU, and various ways to optimize one since there are various criteria for what is optimal.