What happens when ALU has less bits than the result

30 Views Asked by At

If 2 inputs are given to a 12 bit ALU to perform subtraction.

Eg Input A is 0xC8, Input is OxB4, output = 0x14 (8 bits)

If the 2 inputs are given to 8 bit ALU to perform subtraction -> 14 is still possible since it has 8 bits.

But what if the ALU was only a 4-bit ALU.

What would happen?

1

There are 1 best solutions below

0
David Grayson On

The ALU has a certain number of input and output signals, no matter what data you are feeding to it. If you are trying to feed 8-bit data into a 14-bit ALU, you have a few options. The simplest one is probably to just zero-extend your values, so the top 6 bits on the inputs are always 0. Then you might ignore the top 6 bits of the output as well.