Bilgisayar Mimarisi 2 - Sayı Sistemleri Ve Dönüşümler
Bilgisayar Mimarisi 2 - Sayı Sistemleri Ve Dönüşümler
Kaynak:
Oğuz Ergin - Bilgisayar Mimarisi
Kitap: Computer Organization and Design, Fifth Edition: The Hardware/Software Interface
Binary, Octal and Hexadecimal Number Systems
Converting binary to decimal
(96)10 = ( ? )2
Binary, Octal and Hexadecimal Number Systems
Converting octal to decimal
(145)8 = ( ? )10
Binary, Octal and Hexadecimal Number Systems
Converting decimal to octal
(96)10 = ( ? )8
Binary, Octal and Hexadecimal Number Systems
Converting hexadecimal to decimal
(19F)16 = ( ? )10
Binary, Octal and Hexadecimal Number Systems
Converting decimal to hexadecimal
(96)10 = ( ? )16
Binary, Octal and Hexadecimal Number Systems
Converting hexadecimal to binary
(A96)16 = ( ? )2
Binary, Octal and Hexadecimal Number Systems
Converting binary to hexadecimal
Nibble (4 bits)
Byte (8 bits)
Ex. How many Megabytes (MB) of data per second can be downloaded with 24
Mb/s internet speed?
ASCII
ASCII (American Standard Code for Information Interchange) data represent alphanumeric characters in
the memory of a computer system. The standard ASCII code is a 7-bit code.
ASCII
BCD Data
Binary-coded decimal (BCD) information is stored in either packed or unpacked forms. Packed
BCD data are stored as two digits per byte and unpacked BCD data are stored as one digit per
byte. The range of a BCD digit extends from 0000 to 1001, or 0–9 decimal.
Byte-sized data
Byte-sized data are stored as unsigned and signed integers.
The difference in these forms is the weight of the leftmost bit position. Its value is 128 for the
unsigned integer and minus 128 for the signed integer.
The least significant byte is always stored in the lowest-numbered memory location, and the most
significant byte is stored in the highest. This method of storing a number is called the little endian
format.
In the 80386 through the Core2, memory and registers are also 32 bits in width.
Doubleword-sized data
Real numbers
Because many high-level languages use the Intel family of microprocessors, real numbers are
often encountered.
A real number, or a floating-point number, as it is often called, contains two parts: a mantissa,
significand, or fraction; and an exponent.
Real numbers
these steps to represent the number +12 as a real number (floating point) in IEEE 754 standard
single precision format. IEEE 754 single precision format uses 32 bits, with 1 bit for the sign, 8 bits
for the exponent, and 23 bits for the mantissa (fraction).
1. Determine the Sign Bit:
○ Since the number is positive, the sign bit will be 0.
2. Convert the Number to Binary:
○ The binary representation of 12 is 1100.
3. Normalize the Binary Number:
○ Normalization is done by expressing the number in 1.xxxxx format.
○ The binary 1100 is normalized to 1.100 (in binary) and is equivalent to 1.100 x 2^3 because we moved the decimal
point three places to the left.
4. Calculate the Exponent and Apply Bias:
○ In IEEE 754, the exponent is stored with a bias. For single precision, this bias is 127.
○ Since the actual exponent is +3 (from 1.100 x 2^3), the biased exponent is 3 + 127 = 130.
○ The binary representation of 130 is 10000010.
Real numbers
these steps to represent the number +12 as a real number (floating point) in IEEE 754 standard
single precision format. IEEE 754 single precision format uses 32 bits, with 1 bit for the sign, 8 bits
for the exponent, and 23 bits for the mantissa (fraction).
1. Determine the Mantissa:
○ The mantissa is the fractional part after normalization, which is 100 in this case (from 1.100).
○ In IEEE 754, the leading 1 (before the decimal point) is implicit and not stored. So, we only store 100.
○ This needs to be represented in 23 bits, so we pad it with zeros on the right: 10000000000000000000000.
2. Combine the Parts:
○ The final IEEE 754 representation consists of the sign bit, the 8-bit exponent, and the 23-bit mantissa.
○ Sign bit: 0
○ Exponent: 10000010
○ Mantissa: 10000000000000000000000
Therefore, the IEEE 754 single precision representation of the number +12 is:
0 10000010 10000000000000000000000
This binary sequence represents the number +12 in IEEE 754 floating-point format.
Real numbers
Single-precision numbers are 32-bit numbers, use the DD directive.
Use the define quadword(s), or DQ, directive to define 64-bit double-precision real numbers.
Optional directives for real numbers are REAL4, REAL8, and REAL10 for defining single-, double-,
and extended precision real numbers.