2. Data types
• Registers contain either data or control information
Control information is a bit or group of bits used to specify the sequence of
command signals needed for data manipulation
Data are numbers and other binary-coded information that are operated on
• Possible data types in registers:
Numbers used in computations
Letters of the alphabet used in data processing
Other discrete symbols used for specific purposes
2
3. All types of data, except binary numbers, are represented in binary-coded
form
A number system of base, or radix, r is a system that uses distinct symbols
for r digits
Numbers are represented by a string of digit symbols
The string of digits 724.5 represents the quantity
3
4. Cont.…
There are four types of numbering system. Those are:
Decimal: base 10
Binary: base 2
Octal: base 8
Hexadecimal: base 16
4
6. Cont.…
The string of digits 101101 in the binary number system represents the
quantity
We will also use the octal (radix 8) and hexadecimal (radix 16) number
systems
6
7. Conversion from decimal to radix r system
Conversion from decimal to radix r system is carried out by separating the
number into its integer and fraction parts and converting each part separately
Divide the integer successively by r and accumulate the remainders from
bottom to top
Multiply the fraction successively by r until the fraction becomes zero and
accumulate the integers from top to bottom.
Example convert 41.6875 to binary.
7
9. Example: decimal number 32 converting to base r.
32/2=16 r 0
16/2=8 r 0
8/2=4 r 0
4/2=2 r 0
2/2=1 r 0
½=0 r 1
32=(1000000)2
32/8=4 r 0
4/8=0 r 4
32=(40)8
32/16=2 r 0
2/16=0 r 2
32=(20)16
9
10. Conversion from radix r(2,8,16) to decimal system
o Exercise
o (100000)2=?
o (40)8=?
o (20)16=?
o Binary (101101)2 = 1 x 25
+ 0 x 24
+ 1 x 23
+ 1 x 22
+ 0 x 21
+ 1 x 20
=
(45 )10
o Octal (736.4)8 = 7 x 82
+ 3 x 81
+ 6 x 80
+ 4 x 8-1 =
(478.5)10
o Hexadecimal (F3)16 = F x 161
+ 3 x 160
= (243)10
10
11. Convert from binary numbing system to octal and
hexadecimal
Each octal digit corresponds to three binary digits
Each hexadecimal digit corresponds to four binary digits
Rather than specifying numbers in binary form, refer to them in octal or
hexadecimal and reduce the number of digits by 1/3 or ¼, respectively.
11
12. Converting from octal and hexadecimal to binary
Octal to Binary
• Step 1 − Convert each octal digit to a 3 digit binary number (the octal
digits may be treated as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 3 digits each) into a
single binary number.
Hexadecimal to Binary
• Step 1 − Convert each hexadecimal digit to a 4 digit binary number (the
hexadecimal digits may be treated as decimal for this conversion).
• Step 2 − Combine all the resulting binary groups (of 4 digits each) into a
single binary number.
12
14. Converting octal to hexadecimal and vice versa
To convert octal to hexadecimal
We convert each octal to 3 digit bit binary number means that convert to
binary number then we can convert it to corresponding hexadecimal by
grouping 4 digits of binary number
(63)8
110 011
110011
0011 0011
3 3
(33)16
14
15. Complements
• Complements are used in digital computers for simplifying subtraction and
logical manipulation
• Two types of complements for each base r system:
or’s complement and
o(r – 1)’s complement
• Given a number N in base r having n digits, the (r – 1)’s complement of N is
defined as
(rn
– 1) – N
• For decimal, the 9’s complement of N is (10n
– 1) – N
15
16. Example
• The 9’s complement of 546700 is 999999 – 546700 = 453299
• The 9’s complement of 453299 is 999999 – 453299 = 546700
• For binary, the 1’s complement of N is (2n
– 1) – N
• The 1’s complement of 1011001 is 1111111 – 1011001 = 0100110
The 1’s complement is the true complement of the number just toggle all bits.
16
17. Cont.…
• The r’s complement of an n-digit number N in base r is defined as rn
–
N
• This is the same as adding 1 to the (r – 1)’s complement
The 10’s complement of 2389 is 7610 + 1 =
7611
The 2’s complement of 101100 is 010011 + 1 =
010100
17
18. Fixed-Point Representation
• Positive integers and zero can be represented by unsigned
numbers
• Negative numbers must be represented by signed numbers
since + and – signs are not available, only 1’s and 0’s is.
• Signed numbers have msb as 0 for positive and 1 for
negative – msb is the sign bit
• Two ways to designate binary point position in a register
Fixed point position
Floating-point representation
18
19. Cont.…
• Fixed point position usually uses one of the two
following positions
A binary point in the extreme left of the register to make
it a fraction
A binary point in the extreme right of the register to
make it an integer
In both cases, a binary point is not actually present
19
20. Cont.…
• The floating-point representations use a second register to
designate the position of the binary point in the first register
When an integer is positive, the msb, or sign bit, is 0 and the
remaining bits represent the magnitude
• When an integer is negative, the msb, or sign bit, is 1, but the
rest of the number can be represented in one of three ways
Signed-magnitude representation
Signed-1’s complement representation
Signed-2’s complement representation
20
21. Example
• Consider an 8-bit register and the number +14
• The only way to represent it is 00001110
• Consider an 8-bit register and the number –14
o Signed magnitude: 1 0001110
o Signed 1’s complement: 1 1110001
Signed 2’s complement: 1 1110010
21