Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1 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.
Representation 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 CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 2 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.
Comparison of numbers in different bases DecimalsBinaryOctalsHexadecimals A B C D E F CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 3
Changing from other number bases to decimal A n 1 r n 1 + A n 2 r n 2 + ……+ A 1 r 1 + A 0 r 0 + A 1 r 1 + A 2 r 2 +….+ A m + 1 r m A m r m Each coefficient A i 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 x x x 5 1 = (82.8) 10 CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 4 Note: 2 10 = Kilo, 2 20 = Mega, 2 30 = Giga
Changing 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) rem 0LSD 2 6rem 1 2 3rem 0 2 1rem 1 0 MSD CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 5
Changing 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 = MSD 2 = = 1.0 1LSD 6 CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
Arithmetical Operations +, , on Binary CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU
Base 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. CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 8 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.
Binary 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 0’s to any binary value with fewer than four bits. The resulting codewords are: N U MCODEWORD CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU The BCD representation of an unsigned integer is obtained by concatenating the corresponding binary codes together. For example: 9132 would be encoded as 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.
Gray 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 MCODEWORD CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 10 The advantage of using Gray Codes is that the amount of switching is minimized and the reliability of the switching circuitry is improved.
Odd 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 1’s. Likewise for even parity each word must have an even number of 1’s. 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 1’s. PABCD CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 11
Alphanumeric and ASCII Codes Alphanumeric Codes consists of the 26 letters of English Alphabets, the 10 decimal digits, and some special characters. See page 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 of text. CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 12