Open the ALU dialog (popup-menu, edit-component) to select the bit-width and the operation mapping of the ALU. Just select a new operation from the pulldown-menu of each function opcode to change the behaviour of the ALU. The following image shows the default mapping used in this applet:
For example, the value function=9 selects the basic addition
A+B
, while function=11
selects the A+B+Cin
addition with separate carry-input,
and function=15
selects the bitwise logical A OR B
operation.
Besides the main n-bit result value, the ALU also provides five single-bit outputs: carry-out, zero, negative (two's-complement), A=B (A equals B), and OVERFLOW.
Run the applet | Run the editor (via Webstart)