1
ECE 15A
Fundamentals of Logic Design
Lecture 16
Malgorzata Marek-Sadowska
Electrical and Computer Engineering Department
UCSB
2
Today: overview
Subtraction with complements
Arithmetic circuits
Examples
ROM-based circuits
MUX-based circuits
LUTs as circuit elements
PLA-based circuits
Test pattern generation
Data transfer
3
Subtraction with Complements
M,N are n-digit numbers, base r
n
n
r
N
M
N
r
M
+
−
=
−
+
)
(
We want to compute M-N
1.
r’s complement
2.
.
,
,
left
is
N
M
discarded
is
which
r
carry
end
N
M
If
n
−
⇒
→
≥
3.
.
'
)
(
'
)
(
complement
s
r
take
M
N
of
complement
s
r
an
is
M
N
r
carry
end
no
N
M
If
n
⇒
−
−
−
→
→
<
4
Example
g
One’s complement of a binary number is found by
subtracting the binary number to be complemented from
a binary number made up of all 1s.
Find the one’s complement of 10110010
11111111
-10110010
01001101
One’s complement of a binary number: change 1
to 0 and 0 to 1 in the original number.
g
Application:
10110011
<=>
1 0 1
1 0 0 1
1
-01101101
+ 1 0 0 1 0 0 1
0
1 0 1 0 0 0 1 0
1
1
0 10 0 0 1 1 0
(
one’s complement)
(end around carry)
The difference
The carry out of the MSB is added to LSB
(end around carry)
5
Two’s complement of a binary number
g
Add 1 to the one’s complement
Example: Find two’s complement of
1 0 0 1
1
1 0
1
one’s complement:
0 1
1 0 0 0 1 0
+
1
0 1 1 0
0 0 1 1
(two’s complement)
Application:
01100111
-01001010
<=>
0 1
1 0 0 1 1 1
+
1 0
1
1 0 1 1 0
1 0 0 0 1
1
1 0 1
(answer)
The carry resulting from the most significant bit is ignored.
6
Signed binary number
Sign: leftmost position
0 - positive
1 - negative
Example of a Signed Magnitude System
01011
is
(11)
if assumed unsigned binary
10
or
+ (11)
if signed binary
10
11011
is
(27)
if assumed unsigned binary
10
or
- (11)
if signed binary
10

This ** preview** has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*