Tentative Notes from February 27 – Monday

bugenigmaΛογισμικό & κατασκευή λογ/κού

30 Οκτ 2013 (πριν από 3 χρόνια και 5 μήνες)

66 εμφανίσεις

Notes from
April 15



Mon
day



The following is a discussion concerning IEEE (Institute of Electronic and
Electrical Engineers)
32
-
bit single precision
floating point formats.

The
description of the 32

bits is: 1 sign bit,
8
-
bit excess
-
127

exponent and a
23
+
1 bit normalized fraction. The normalized fraction is in the form 1.nf,
therefore, the leading 1 is never stored, only the
23
-
bit nf is stored.
Thus, the
23
+1 nomenclature. The sign bit is for the sign of the number.
The “excess
-
1
27
” format is defined so

there is no need for the sign of the
exponent, 1
27

is subtracted from the
8
-
bit integer exp so half of its value
is negative and the other half positive.

The floating point number, N,
based on the definition, is then


N= (
-
1)^s * 2^(exp
-
127
) *

1.nf

and the
32

bits are stored as


seee eeee efff ffff ffff ffff ffff ffff

Since the bits for s, e and f do not fit nicely in the first 3 HEX digits, the
manipulation of the bits is more challenging that the double precision
format.



Example, convert

47.11 to IEEE
Sing
le Precision format. Step 1,

normalize 47.11 by doing 47.11/32*32, in which 32 is a 2^5. The
normalized number is then 1.4721875 x 2^5. The sign is positive, so
s=0. The number exp
-
1
27
=5, therefore, exp=1
27
+5=1
32
=8
4
HEX.

For
this part
icular case, it is better to write exp in binary, i.e., 1000 0100
using the Hex to Binary table. With the sign bit, the first 9 bits are 0100
0010 0. The first two HEX digit is 42HEX. The third HEX digit must draw
the first 3 bits from
.
nf
=.4721875
.

Mu
ltiply .nf by 8 to obtain 3.7775 or
3.nf’. With these 3 bits, the third HEX digit is 0011. Obtain from .nf’ 5
more HEX digits by multiply it by 16 each time. The values of .nf’ in HEX
is .C70A4 (with a round up). The packed format is then:


4
23C70A4

T
his answer can be obtained easily using the matlab command
num2hex(
single(
47.11
)
).



From the above example, if
-
47.11 is converted, only the sign but would
change. The first HEX digit of 0100 would then be 1100 due to the sign
change. The first HEX digit
would then be C instead of 4. The IEEE
single
precision
representation of
-
47.11 is then

C
23C70A4
.



Another binary pattern that is stored in the memory is the memory
addresses. Since the main computer memory bank is so large today, to
fetch from or store
to the memory requires a memory address. If there is
one megabyte of memory, i.e., 2^(20) memory cells, a 20
-
bit address is
needed. The first IBM
-
PC, using the Intel
-
8088 chip, has a 20
-
bit address
bus. The Intel
-
80486 chip has a 24
-
bit address bus, the
refore, it was
able to address 2^4*2^(20), or 16MB. Then came the 32
-
bit machines,
it was able to address 2^2*2^(30) bytes, i.e., 4GB. With the memory
price keeps dropping, 4GB is no longer an unreasonable requirement.
Now there are 64
-
bit operating syst
em, built for future where memory
banks could be even larger. Just imagine, a Terabyte uses 40
-
bit
addresses, 64
-
bit addresses should be around for many more years.



If you look at the specifications of the “64
-
bit” processor chips, the
address bus is actua
lly not 64
-
bit yet. Some have 36
-
bit address buses
and that would be able to address (2^6)*(2^30) or 64GB. Some might
have 40 or 44 bits for their address buses, but none of them has a 64
-
bit
address bus yet. It is too premature to have such a capabilit
y when the
capacity of memory banks is still developing.



Longer addresses are not better. That means the computer have to read
through many bytes of addresses just to find out where to fetch the data
from.

That also means the computer instructions are lo
nger since part of
the instruction involve the memory address
. For example, the instruction
might be “fetch from memory location A” and it would require 64 bits or 8
bytes just to specify A; that is in addition to the instruction code itself.
Another ins
truction might be “Add the content of Register 4 to data
stored in memory location B and the three bytes after that.” Again, long
memory addresses slow down the computer.



Most fast processors use small memory banks, like those in smart bombs
and other def
ense
-
related robots.



To see what an instruction set look like, check out the file on the class
website for the Motorola 68020 chip (it was used in the original Apple
MacIntosh computer). It’s companion chip for numeric processing was
the Motorola 68881.