12. Binary adder
1) If you want to build a computer, then the first thing you can calculate the sum of two number of devices (in fact, the original addition calculation is the only work the computer to do).
2) adder = wire + switch + bulb + battery + relay (fully used in binary calculation)
3) Addition and carry in the adder is separate, the result of the addition of the two binary numbers is by the XOR gate (XOR gate xor:1 and 0 does not appear at the same time is 1; otherwise 0) the output is given, and the carry bit is given by the output of the gate.
4) Full/half adder: The half adder does not include the previously added possible carry bit into the next operation
5) Reform: relays--Vacuum tubes---> transistors (smaller transistors, less noise, lower energy consumption, cheaper)
13. How to Implement Subtraction
1) addition is always calculated from the leftmost column of the two addend to the leftmost column, and the carry of each column is added to the next column. There is no rounding in the subtraction, only borrow. But borrow's implementation is complicated, so here's a little trick to avoid borrow.
When the meiosis is greater than the meiosis, (253-176), the 999-176+253+1-1000 is used first.
When the meiosis is greater than minuend, it is negative (176-253), 999-(999-253+176)
2) Sub and Co signal control overflow underflow
3) Negative number: 10 of the complement, 1 is the beginning of the expression is negative-128 to 127
Code-hidden in the language behind the computer-reading notes (V): binary addition & Subtraction