Title: Introduction to Computer Design CMPT 150 Section: D100 9962
1Introduction to Computer Design CMPT 150
Section D100 9962
- Ch. 1 Digital Computers and Information
-
Characteristics of a Digital System is its
manipulation of discrete elements into
information. Digital Systems deal with signals
having a finite number of discrete values. In
electronic implementations, these discrete
elements can be represented by voltage intervals.
In Analog systems variables are measured over a
continuous range of intervals.
1
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
2Representation of discrete elements
Discrete elements of information are represented
in a digital system by physical quantities called
signals. These signals use two discrete values
and as a result are known to be binary.
Example High/Low True/False I/O
The set of values 0, 1 defines a "2-valued" or
"binary" alphabet. A sequence of symbols from a
given alphabet is called a codeword.
2
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
3Comparison of numbers in different bases
Decimals Binary Octals Hexadecimals
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
3
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
4Changing from other number bases to decimal
An ? 1 r n? 1 An ? 2 r n? 2 A1 r 1 A0 r
0 A ? 1 r ? 1 A? 2 r? 2 . A? m 1 r ? m
1 A? m r ? m
Each coefficient Ai is one of the digits of given
number system. The subscript value i gives the
position of the coefficient and , hence, the
weight r i by which the coefficient must be
multiplied.
(312.4)5 3 x 52 1 x 51 2 x 5 0 4 x 5? 1
(82.8)10
Note 210 Kilo, 220 Mega, 230
Giga
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
4
5Changing decimal integers to binary
This procedure requires division of decimal
integers by 2 and making a note of the remainder.
The first remainder obtained is referred to as
the Least Significant Digit (LSD) and the last
integer is referred to as the Most Significant
Digit (MSD).
2 26
2 13 rem 0 LSD
2 6 rem 1
2 3 rem 0
2 1 rem 1
0 rem 1 MSD
5
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
6Changing the fractional part of decimals to binary
If the fraction part is 0.375, then we multiply
the fractional by 2 and record the integer part
in each calculation. We continue to do this
until we obtain a string of zeros as our
fractional part or observe a repeating pattern.
Note The direction of LSD and MSD is reversed in
the fractional multiplication.
Integer Part
2 ? 0.375 0.75 0 MSD
2 ? 0.750 1.50 1
2 ? 0.500 1.0 1 LSD
6
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06,
SFU
7Arithmetical Operations , ?, ? on Binary
1 0 1 1 0 1 0 1 1 1 1 0 1 1 0 1
- 1 0 1 1
- ? 1 0 1
- 1 0 1 1
- 0 0 0 0 ?
- 1 0 1 1 ? ?
- 1 1 0 1 1 1
1 0 1 1 0 ? 1 0 0 1 0 0 0 1 0 0
7
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
8Base 2 Encodings
An encoding is an assignment of codewords in one
alphabet to each of the symbols in a second
alphabet. In the design of electrical circuits it
is desirable to use a binary alphabet to maximize
the voltage interval that can be associated with
each symbol in an "encoding" of characters by
voltage levels.
Base 2 Encoding Each integer is represented by
its corresponding value in base 2. As the value
of the integer gets larger, the number of bits
required gets longer. Thus the codewords vary in
length.
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06,
SFU
8
9Binary Coded Decimal (BCD)
In BCD each integer into binary, only the symbols
0 through 9 are represented by their
corresponding base-2 equivalents. Each binary
value is extended to four characters (bits) by
adding leading 0s to any binary value with fewer
than four bits. The resulting codewords are
N U M CODEWORD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
The BCD representation of an unsigned integer is
obtained by concatenating the corresponding
binary codes together. For example 9132 would
be encoded as 1001 0001 0011 0010. NOTE The
message is actually 16 bits long. Spaces are not
part of the encoding but are used to make clear
each codeword in the message.
9
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
10Gray Codes
The codewords for consecutive integers differ in
only one bit position. There are a number of
possible solutions. One such solution is
displayed in the table below.
N U M CODEWORD
0 0000
1 0001
2 0011
3 0010
4 0110
5 0111
6 0101
7 0100
8 1100
9 1101
The advantage of using Gray Codes is that the
amount of switching is minimized and the
reliability of the switching circuitry is
improved.
10
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
11Odd and Even Parity
Coded information can have one of the two types
of parity. For odd parity each word must have an
odd number of 1s. Likewise for even parity each
word must have an even number of 1s. In the
table on the right BCD codes with even parity
have been shown. The parity P is made 1 when
there are an odd number of 1s.
P A B C D
0 0 0 0 0
1 0 0 0 1
1 0 0 1 0
0 0 0 1 1
1 0 1 0 0
0 0 1 0 1
0 0 1 1 0
1 0 1 1 1
1 1 0 0 0
0 1 0 0 1
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
11
12Alphanumeric and ASCII Codes
Alphanumeric Codes consists of the 26 letters of
English Alphabets, the 10 decimal digits, and
some special characters. See page 23-24 of
text. The American Standard Code for Information
Interchange (ASCII) is a 7-bit code. However,
modern day computers manipulate an 8-bit quantity
known as byte. See page 24-25 of text.
12
CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU