The ALUS library consists of the following 4 generic components :
addN : N-bit adder
subN : N-bit subtractor
adsbN : N-bit adder / subtractor
aluNf : N-bit general purpose ALU with flags
The ALUS library can be verified with this testbench : test_alus

These particular components implements all the logical and arithmetic operations,
such as addition and substraction, with a variable word length of the operands.
In the next two tables, the general's ALU operations encoding is shown.

Arithmetic operations :

Operation Expression Mnemonic Op Code
Add A + B + CIN ADD 1001111
Subtract A + B~ + CIN SUB 1000111
Reverse Subtract B - A - CIN~ SBR 1001101
Negate A A~ + CIN NEGA 1000001
Negate B B~ + CIN NEGB 1000100
Increment A A + CIN INCA 1000011
Increment B B + CIN INCB 1001100
Decrement A A - CIN~ DECA 1001011
Decrement B B - CIN~ DECB 1001110
Negated Add A~ + B~ + CIN NADD 1000101
Decrement Not A A~ + CIN~ NDECA 1001001
Decrement Not B B~ + CIN~ NDECB 1000110


Logical Operations :

Operation Expression Mnemonic Op Code
Ones -1 ONES 0100000
Zeros 0 ZEROS 0100010
Pass A A EQUA 0100011
Pass B B EQUB 0101100
Not A A~ NOTA 0100001
Not B B~ NOTB 0100100
And A * B AND 1010101
And Complement A A~ * B ANDCA 1010111
And Complement B A * B~ ANDCB 1011110
Nand (A * B)~ NAND 0010101
Or A + B OR 0011111
Or Complement A A~ + B ORCA 0011101
Or Complement b A + B~ ORCB 0010111
Nor (A + B)~ NOR 1011111
Exclusive Or A ^ B XOR 0101111
Exclusive Nor (A ^ B)~ XNOR 1101111