The logic circuit from lecture 5 can be drawn as a single block called
a full adder.
If four of these devices are cascaded together, then we have a four bit adder.
Subtraction can be performed in a similar way.
An adder can be used for subtraction because A-B == A+(-B). To get -B, complement B (using NOT gates) and add one to the result (two's complement). Adding one to the result can be done by making C0 = 1.
Inside the central processing unit of a computer there will be a device that performs a number of arithmetic and logic functions. E.g. Add,Sub,And,Or,Xor,Not.
This is called the Arithmetic Logic Unit or ALU.
A, B and S are n bit numbers. F is a binary code to indicate the function to be performed. O is status output from the operation, including Carry, Overflow etc..
If we allow a device to have an output that depends not only on the present input but on previous inputs (or outputs) then it is called sequential logic.
Now the output depends on the present input and the state. The box contains a combinational logic circuit.
This device can have a "memory", and we can use it to store bits.
It can also be used to control a complex sequence of operations.