1 0 1 0 1 0

advertisement
Computer Architecture
Data Representation
Mark S. Staveley
Mark.Staveley@mun.ca
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
3127
110011010001
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
3217/2 = 1608
R 1 (Least Significant Bit)
R0
3217 1608/2 = 804
804/2 = 402
R0
402/2
= 201
R0
110011010001
201/2 = 100
R1
100/2 = 50
R0
50/2 = 25
R 0 6271
25/2 = 12
R1
B38
12/2 =
6
R0
6/2 =
3
R0
Complete the3/2
following
Each
=
1table. R
1 row represents a
specific unsigned
different
radix forms
1/2 =integer
0 valueR in
1 the(Most
Significant
Bit)
listed in the table. For example, 1210 can be written as 11002,
148 or C16. 321710 = 1100100100012
Binary Coded Decimal Representation
Decimal
Binary
3217
110010010001
Octal
Hexadecimal
110011010001
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
3217/8 = 402
R1
3217 402/8
110010010001
= 50
R2
50/8 =
6
R2
110011010001
6/8
=
0
R6
321710 = 62218
Octal
Hexadecimal
(Least Significant Bit)
(Most Significant Bit)
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
3217
110010010001
6221
Hexadecimal
110011010001
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
3217/16 = 201
R 1 (Least Significant Bit)
3217 201/16
110010010001
= 12
R 6 6221
2/16 =
0
R C (1210 Most Significant Bit)
110011010001
321710 = C6116
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
3217
110010010001
6221
C91
110011010001
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
3217
110010010001
6221
C91
110011010001
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
B3816
3217
110010010001
B16 – 10112
Octal
Hexadecimal
6221
316 – 0011
2
110011010001
816 – 10002
6271
1011001110002
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
1011001110002
3217
110010010001
Split on 3-bits (base 8)
Octal
Hexadecimal
6221
1012 –110011010001
58
1002 – 48
1112 – 78
0002 – 08
101100111000
54708
6271
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
1011001110002 =
3217
110010010001
6221
0 x 20 + 0 X 21 + 0 X 22 + 1 X 23 + 1 x 24 + 1 x 25 + 0
x 26 + 0 x 27 + 1 x 28 + 1 x 29 + 0 x 210 + 1 x 211
110011010001
= 287210
2872
101100111000
6271
5470
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Binary Coded Decimal Representation
Decimal
Binary
Octal
Hexadecimal
3217
110010010001
6221
C91
3281
110011010001
6321
CD1
3257
110010111001
6271
CB9
2872
101100111000
5470
B38
Complete the following table. Each row represents a
specific unsigned integer value in the different radix forms
listed in the table. For example, 1210 can be written as 11002,
148 or C16.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
-17
+14
-32
+31
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
011111
011111
011111
111110
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
+21110001
(convert to Sign
& Magnitude) 101111
101110
001110
-17
Sign = + = 1
+14
21 001110
convert to 5-bit 001110
representation =001110
10101
101101
-32
N/A
N/A
100000
N/A
+31
011111
011111
011111
111110
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
+21110001
(convert to One’s
Complement)
101110
101111
001110
+14
Result = same as normal because it is
positive
= 010101 001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
011111
011111
011111
111110
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
+21110001
(convert to Two’s
Complement)
101110
101111
001110
+14
Result = same as normal because it is
positive
= 010101 001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
011111
011111
011111
111110
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
+21110001
(Convert to Excess
31)
101110
101111
001110
+14
Positive and negative representations of a number are
obtained
by adding001110
a bias to the two’s
complement101101
001110
001110
representation, ignoring any carry out from the most
-32
significant
N/A digit.
N/A
100000
N/A
21 in Two’s Complement = 010101
+31
011111
Bias
= 31 = 011111011111
011111
111110
010101 + 011111 = 110100
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
011111
011111
011111
111110
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
-32011111
(convert to Sign011111
& Magnitude) 011111
111110
Sign = - = 1
Complete the32
table
below
6-bit representation
convert
tousing
5-bit representation
= Error for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
Greatest
number
represented
5 different data
row in the tableWhy?
is to show
a specific
numerical
valuewith
in the
is 31
32 Note
is outthat
of range.
representationsbits
listed
in (11111)
the table.
for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
+31
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
011111
111110
+31
-32011111
(One’s Complement)
011111
Sign = - = 1
Complete the32
table
below
6-bit representation
convert
tousing
5-bit representation
= Error for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
Greatest
number
represented
5 different data
row in the tableWhy?
is to show
a specific
numerical
valuewith
in the
is 31
32 Note
is outthat
of range.
representationsbits
listed
in (11111)
the table.
for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
-32011111
(convert to Two’s
Complement)011111
011111
111110
Minimum 2's complement value = -2n-1
Complete theMaximum
table below
6-bit representation
for sign and
2'susing
complement
value = 2n-1 – 1
magnitude, ones’ complement, two’s complement, and excess 31. Each
6=
Maxa=specific
+31, Min
= -32 value in the different data
row in the tablenis=to
show
numerical
representations-32
listed
in the table.
Note that for each numeric value listed
converted
= 100000
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
011111
111110
+31
-32011111
(Convert to Excess
31)
011111
Largest Negative Number = 000000 = - 31
Complete theLargest
table below
using
6-bit representation
Positive
Number
= 111111 = + 32for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
Range
= N/A numerical value in the different data
row in the tableOut
is toofshow
a specific
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
011111
011111
011111
111110
Complete the table below using 6-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
row in the table is to show a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
-17011111
(convert to Sign011111
& Magnitude) 011111
111110
Sign = - = 1
Complete the17
table
below
6-bit representation
for sign and
convert
tousing
5-bit representation
= 10001
magnitude, ones’ complement, two’s complement, and excess 31. Each
= 110001
row in the tableResult
is to show
a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
+31
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
011111
111110
+31
-17011111
(One’s Complement)
011111
Sign = - = 1
Complete the17
table
below
6-bit representation
for sign and
convert
tousing
5-bit representation
= 10001
magnitude, ones’ complement, two’s complement, and excess 31. Each
bit numerical
= 01110 value in the different data
row in the tableComplement
is to show a each
specific
representationsResult
listed =
in101110
the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
001110
001110
001110
101101
-32
N/A
N/A
100000
N/A
+31
-17011111
(convert to Two’s
Complement)011111
011111
111110
Add One to One’s Complement
Complete the101110
table below
+ 1 = using
011116-bit representation for sign and
magnitude, ones’ complement, two’s complement, and excess 31. Each
= 101111
row in the tableResult
is to show
a specific numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Decimal
Sign &
Magnitude
One’s
Complement
Two’s
Complement
Excess 31
+21
010101
010101
010101
110100
-17
110001
101110
101111
001110
+14
-17001110
(Convert to Excess
31)
001110
001110
101101
-32
Positive and negative representations of a number are
obtained
bias to the two’s
complement N/A
N/A by adding aN/A
100000
representation, ignoring any carry out from the most
+31
significant
011111digit.
011111
011111
111110
17 in Two’s Complement = 101111
Complete the Bias
table=below
using 6-bit representation for sign and
31 = 011111
magnitude, ones’ complement, two’s complement, and excess 31. Each
+ 011111
= 001110
row in the table 101111
is to show
a specific
numerical value in the different data
representations listed in the table. Note that for each numeric value listed
below, it may not be possible to represent that value in all the data
representations – in these cases just specify ‘N/A’.
Fill in the following steps to find the representation for –17.5
in the IEEE single-precision floating-point standard.
IEEE-754 Floating Point Standard
° Developed in 1985. It can be supported in hardware, or a
mixture of hardware and software.
Excess-127
Excess-1023
Hidden bit
Hidden bit
° There are also single extended, and double extended
formats (80 bits wide, 15-bit exponent, and 64-bit fraction).
Fill in the following steps to find the representation for –17.5
in the IEEE single-precision floating-point standard.
a) Convert –17.5 to base 2:
b) Express the value from (a) in binary scientific notation:
c) Convert the exponent from (b) to excess 127:
d) IEEE single point precision representation:
Fill in the following steps to find the representation for –17.5
in the IEEE single-precision floating-point standard.
a) Convert –17.5 to base 2: –10001.12
Fill in the following steps to find the representation for –17.5
in the IEEE single-precision floating-point standard.
b) Express the value from (a) in binary scientific notation:
–1.000112 * 24
Fill in the following steps to find the representation for –17.5
in the IEEE single-precision floating-point standard.
c) Convert the exponent from (b) to excess 127:
12710 + 410 = 11111112 + 1002 = 100000112
Fill in the following steps to find the representation for –17.5
in the IEEE single-precision floating-point standard.
d) IEEE single point precision representation:
Sine Bit = Negative = 1
Exponent = 12710+410 = 13110 = 100000112
Fraction = 1.000112 (leading 1 of fraction is hidden)
= 00011000000000000000000
1 10000011 00011000000000000000000
Convert the following floating point numbers represented in
IEEE single precision floating point representation to both
binary and decimal representations in scientific notation,
where feasible.
1 10100001 11001000000000000000000
101000012 = 16110;
161 – 127 = 34;
–1.110012 * 234
Convert the following floating point numbers represented in
IEEE single precision floating point representation to both
binary and decimal representations in scientific notation,
where feasible.
0 01111010 00000000000000000000000
011110102 = 12210;
122 – 127 = –5;
1.02 * 2–5 = 1.010 * 2–5 = 0.03125 = 3.125 * 10-2
Convert the following floating point numbers represented in
IEEE single precision floating point representation to both
binary and decimal representations in scientific notation,
where feasible.
0 10000001 10100000000000000000000
100000012 = 12910;
129 – 127 = 2;
1.10102 * 22 = 110.102 = 6.5 = 6.5 * 100
Convert the following floating point numbers represented in
IEEE single precision floating point representation to both
binary and decimal representations in scientific notation,
where feasible.
1 11100000 01100111 000000000000000
111000002 = 22410;
224 – 127 = 97;
–1.011001112 * 297
Do the following using two’s complement arithmetic and indicate the
carry (C) and overflow (V) values.
(e.g., “C = 1” if there is a carry, “C = 0” otherwise).
a)
010111
+ 010011
b) 0 1 1 0 0 0
c) 1 0 1 1 0 1
-
-
011100
101001
C=
C=
C=
V=
V=
V=
d) 1 1 0 0 1 1
e) 1 0 1 1 0 0
f) 0 1 1 1 1 1
-
+
+ 101010
000001
100110
C=
C=
C=
V=
V=
V=
Do the following using two’s complement arithmetic and indicate the
carry (C) and overflow (V) values.
(e.g., “C = 1” if there is a carry, “C = 0” otherwise).
a)
010111
b) 0 1 1 0 0 0
c) 1 0 1 1 0 1
+ 010011
-
011100
-
101010
=
011000
+
100100
101001
000100
111100
C = 0 (no carry)
C=0
C= 1
V = 1 (sum out of range) V = 0
V= 0
Note: When the CPU adds two binary integers, if their sum is out of
range when interpreted in the two’s complement representation, then V
is set to 1. Otherwise V is cleared to 0
Do the following using two’s complement arithmetic and indicate the
carry (C) and overflow (V) values.
(e.g., “C = 1” if there is a carry, “C = 0” otherwise).
d) 1 1 0 0 1 1
e) 1 0 1 1 0 0
f) 0 1 1 1 1 1
-
+
100110
+ 101010
010010
001001
000001
110010
C=1
C=1
C=1
V=0
V=1
V=0
Download