(Usage hints for this presentation)
IT Systems, Summer Term 2024
Dr. Jens Lechtenbörger (License Information)
Add16
)Inc16
)ALU
Prior knowledge
We add digits from right to left, possibly with “carry”
In decimal
4242
+ 6789
Carry: 11110
-----
11031
In binary
10110111
+ 11000101
Carry: 100000110
---------
101111100
Note
Both sample results are 1 digit larger than the inputs
Consider \(n\)-bit number \(k\)
\(k_c = 2^n - k\) is 2’s complement of \(k\) (and vice versa)
If most significant bit is 1, interpret bit pattern as negative number: \(k = -k_c\)
\(2^n\) signed numbers between \(-2^{n-1}\) and \(2^{n-1} - 1\)
0 0000
1 0001 1111 -1
2 0010 1110 -2
3 0011 1101 -3
4 0100 1100 -4
5 0101 1011 -5
6 0110 1010 -6
7 0111 1001 -7
1000 -8
Example
2-5 = 2 + (-5): 0010
+ 1011
----
1101 = -3
HalfAdder
: Adds two bits, produces two output bitsFullAdder
: Adds three bits, produces two output bitsAdd16
: Adds two 16-bit numbers, produces 16-bit outputa | b | carry | sum |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 0 | 1 |
1 | 0 | 0 | 1 |
1 | 1 | 1 | 0 |
sum = Xor(a, b)
carry = And(a, b)
a | b | c | carry | sum |
---|---|---|---|---|
0 | 0 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 1 |
0 | 1 | 0 | 0 | 1 |
0 | 1 | 1 | 1 | 0 |
1 | 0 | 0 | 0 | 1 |
1 | 0 | 1 | 1 | 0 |
1 | 1 | 0 | 1 | 0 |
1 | 1 | 1 | 1 | 1 |
Source files are available on GitLab (check out embedded submodules) under free licenses. Icons of custom controls are by @fontawesome, released under CC BY 4.0.
Except where otherwise noted, the work “Combinational Circuits I”, © 2024 Jens Lechtenbörger, is published under the Creative Commons license CC BY-SA 4.0.