Professional Documents
Culture Documents
Electrical Engineering
Integer Representation
Range of integers
Taxonomy of Integers
Range of Unsigned Integers
# of Bits Range
--------- -------------------------------------
8 0 255
16 0 65,535
Example
Ex..
Store 7 in an 8-bit memory location.
Solution
First change the number to binary 111. Add five 0s to make a total of N
(8) bits, 00000111. The number is stored in the memory location.
Example
Ex..
Store 258 in a 16-bit memory location.
Solution
First change the number to binary 100000010. Add seven 0s to make a
total of N (16) bits, 0000000100000010. The number is stored in the
memory location
Example
Ex..
Interpret 00101011 in decimal if the number was stored as an unsigned
integer.
Solution
00101011 the number in decimal is 43
Range of Sign and Magnitude Integers
# of Bits Range
---------- -------------------------------------------------------
8 -127 -0 +0 +127
16 -32767 -0 +0 +32767
32 -2,147,483,647 -0 +0 +2,147,483,647
Sign-and-Magnitude Representation
Definition
In sign-and-magnitude representation, the leftmost
bit defines the sign of the number. If it is 0, the
number is positive. If it is 1, the number is negative
Sign-and-Magnitude Representation
There are two representation in sign-and-
magnitude
representation: positive and negative.
In an 8-bit allocation:
+0 00000000
-0 10000000
Example
Ex..
Store –258 in a 16-bit memory location using sign-and-magnitude
representation.
Solution
First change the number to binary 100000010. Add six 0s to make a total of N-
1 (15) bits, 000000100000010. Add an extra 1 because the number is
negative. The result is:
1000000100000010
Exampleof storing sign-and-magnitude
integers in two computers
Solution
Ignoring the leftmost bit, the remaining bits are 0111011. This number
in decimal is 59. The leftmost bit is 1, so the number is –59.
One’s Complement
# of Bits Range
--------- -------------------------------------------------------
8 -127 -0 +0 +127
16 -32767 -0 +0 +32767
32 -2,147,483,647 -0 +0 +2,147,483,647
One’s Complement
0 0 0 1 1 0 0 1 = +25
1 1 1 0 0 1 1 1 = -25
Two’s Complement (without One’s
Complement)
Ex..
specify a negative value of +28!!
0 0 0 1 1 1 0 0 = +28
1 1 1 0 0 1 0 0 = -28
Summation of Two’s Complement
Ex..
Count 5 + 2…
Carryout
+5 0 1 0 1
+2 0 0 1 0+
+7 0 1 1 1
Summation of Two’s Complement
Ex..
Count 5 + (-2)…
Carryout 1 1
+5 0 1 0 1
-2 1 1 1 0+
+3 1 0 0 1 1
Summation of Two’s Complement
Ex..
Count (-5) + 2…
Carryout
-5 1 0 1 1
+2 0 0 1 0+
-3 1 1 0 1
Summation of Two’s Complement
Ex..
Count (-5) + (-2)…
Carryout 1 1 1
-5 1 0 1 1
-2 1 1 1 0+
-7 1 0 0 1
Exercises
Store in 8 bit allocation Data and count exercises below…
a. 10+(-5)
b. (-15)+ 4
c. (-13)+(-2)
d. 8+(-14)
Exercises
Store in 8 bit allocation Data and count exercises below…
a. 12+(-5)
b. (-15)+ 4
c. (-9)+(-1)
d. 11+(-4)
Combinational Circuits
Introduction
• Logic circuits for digital systems may be either combinational or
sequential.
• A combinational circuit consists of logic gates whose output anytime
are determined from only the present combination input
Combinational Circuit
• n of input values
• 2 possible combination
• Spesific function
• Adders
• Substractor m output
n input Combinational
• Comparator variables Logic Circuit variables
• Decoder
• Encoder
• Multiplexer
• Demux
Adder
Penjumlah atau Adder adalah komponen elektronika digital yang
dipakai untuk menjumlahkan dua buah angka dalam sistem bilangan
biner. Dalam komputer dan mikroprosesor, Adder biasanya berada di
bagian ALU (Arithmetic Logic Unit)
1-Bit Half Adder
Half adder
0 + 0 = 0 ; 0 + 1 = 1 ; 1 + 0 = 1 ; 1 + 1 = (10)2
two input variables: x, y
truth table
S = x'y+xy'=xy= (x+y)(x'+y')
C = xy= (x'+y')'
S' = xy+x'y'
S = (C+x'y')'
Logic Diagram of 1-Bit
Half Adder
1-Bit Full Adder
Full-Adder
The arithmetic sum of three
input bits
three input bits
x, y: two significant bits
z: the carry bit from the
previous lower significant bit
Two output bits: C, S
Sum Carry
A0 B0 D0 C 1 A0
D0
0 0 0 0 B0
0 1 1 1
1 0 1 0
1 1 0 0
C1
0
-1
1
Full Subtractor
Ci Ai Bi Di Ci+1 AiBi
Ci 00 01 11 10
0 0 0 0 0
0 0 1 1 1 0 1 1
0 1 0 1 0
0 1 1 0 0
1 1 1
1 0 0 1 1
1 0 1 0 1
1
1
1
1
0
1
0
1
0
1
Di
Di = Ci $ (Ai $ Bi)
0 0 0 0 0 0 1
0 0 1 1 1
0 1 0 1 0
0 1 1 0 0 1 1 1 1
1 0 0 1 1
1 0 1 0 1
1 1 0 0 0
Ci+1
1 1 1 1 1
Full Subtractor
Di = Ci $ (Ai $ Bi)
Ci
Ai Di
Bi
C i+1
half subtractor
half subtractor
Note for Half Exam
• Point B
• All close ex. Cheat sheet
• Cheat Sheet
• A4
• Write feel free
• Material
• Mccluskey
• Arithmatic Circuit
• Combinational Circuit
• NO PLAGIARISM