| alu | (Ainput,Binput,control),(output,statussignals),options |
Ainput, Binput, and output may each be n width-1 signals or one width-n bus. Control may be from four to six width-1 signals or a bus of width from four to six. The size of the control field depends on the options. Options have the same format as for registers and counters. The options are as follows.
| control= | carryin cenable |
These options increase the size of the control field from a default of four to either five or six depending on whether one control option or two has been specified. The exact position of the carryin and carry enable signals really doesn't matter since the ALU simulator considers the control field to be one n-bit field.
| status= | all_zero all_ones carryout |
These options add status signals to the statussignals field.
| function= | (number, name , ... ) |
This parameter indicates which function is selected for each value of the control inputs. The control field is treated as an n-bit binary number where n is either 4, 5, or 6. Function name must be one of the following. During simulation, when the control field has the value "number" the function indicated by "name" is performed on "Ainput" and "Binput" and placed into "output." The available functions are:
| Name | Function | |
| one | 1 | |
| zero | 0 | |
| a | a | |
| b | b | |
| not_a | a' | |
| not_b | b' | |
| and | a&b | |
| or | a|b | |
| xor | (a&b')|(a'&b) | |
| nand | a'|b' | |
| nor | a'&b' | |
| xnor | (a&b)|(a'&b') | |
| a_and_not_b | a&b' | |
| a_or_not_b | a|b' | |
| not_a_and_b | a'&b | |
| not_a_or_b | a'|b | |
| subtract | a-b | |
| add | a+b | |
| incr_a | a+1 | |
| incr_b | b+1 | |
| decr_a | a-1 | |
| decr_b | b-1 | |
| b_minus_a | b-a |