Presentation is loading. Please wait.

Presentation is loading. Please wait.

Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Logic Design: Part 1.

Similar presentations


Presentation on theme: "Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Logic Design: Part 1."— Presentation transcript:

1 Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Logic Design: Part 1

2 OCC - CS/CIS CS116-Ch00-Orientation 2 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 2 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Introduction Hardware has analogous relationship with software Create registers Create gates Combine gated & other modules Apply signal on logic circuits Define variables Perform logic function Combine logic functions Function application Logic functions Logic components Connections Signal applications and delays Variables Data structures Objects Algorithms HardwareSoftware

3 OCC - CS/CIS CS116-Ch00-Orientation 3 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 3 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Introduction Logic circuits combinational – Base Transistor, Capicator, Resistor – Low Level Logic Gates (And, Or, Inverters) – Next up Adders, multiplexors, registers – High level IC (Integrated Circuit) – Higher level VLSI (Very Large Scale Integration)

4 OCC - CS/CIS CS116-Ch00-Orientation 4 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 4 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Numbers What is a number? What is a number system? Counting Systems – Positional – Alternatives

5 OCC - CS/CIS CS116-Ch00-Orientation 5 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 5 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Positional Represents a number using a set of symbols – Select from r distinct symbols – r called the base or radix – Decimal (r = 10) Use digits: 0,1,2,3,4,5,6,7,8,9 Each position holds a certain weight – Walk the number circle

6 OCC - CS/CIS CS116-Ch00-Orientation 6 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 6 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Alternative Number Systems Roman numerals – MCMVXII Egyptian Mayan Dewey decimal system and

7 OCC - CS/CIS CS116-Ch00-Orientation 7 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 7 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Positional: A Saner System Easy to represent integers as well as fractions The more common number systems we use today – Decimal (r = 10) – Binary (r = 2) – Octal (r = 8) – Hexadecimal (r = 16)

8 OCC - CS/CIS CS116-Ch00-Orientation 8 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 8 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Representation Hexadecimal values 11 to 15 in hexadecimal are A, B, C, D, E, & F respectively. To differentiate between numbers of different radix, we will use the following notation: (number) radix Fractions – Digits to the left of the fractional point are multiplied by positive values (0 included) – Digits to the right of the fractional point are multiplied with negative powers (Start from –1)

9 OCC - CS/CIS CS116-Ch00-Orientation 9 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 9 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Interpretation To determine the value that a number – Multiply each digit by an integer power of r – Form the sum of all weighted digits – Example: 12345 = 1 x 10 4 + 2 x 10 3 + 3 x 10 2 + 4 x 10 1 + 5 x 10 0. Least-significant digit (LSD) – Represents the lowest-value digit – Written on the rightmost position Most-significant digit (MSD) – Represents the highest-value digit – Written on the leftmost position

10 OCC - CS/CIS CS116-Ch00-Orientation 10 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 10 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Examples Decimal – (845.67) 10 = 8 x 10 2 + 4 x 10 1 + 5 x 10 0 + 6 x 10 -1 + 7 x 10 -2 Octal – (45.67) 8 = 4 x 8 1 + 5 x 8 0 + 6 x 8 -1 + 7 x 8 -2 Hexadecimal – (8F5.6B) 16 = 8 x 16 2 + 15 x 16 1 + 5 x 16 0 + 6 x 16 -1 + 11 x 16 -2 Binary – (1011.011) 2 = 1 x 2 3 + 1 x 2 1 + 1 x 2 0 + 1 x 2 -2 + 1 x 2 -3

11 OCC - CS/CIS CS116-Ch00-Orientation 11 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 11 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Conversion: Decimal to other Radixes Split number into integer and fractional parts – 145.23 -> 145 and.23 For integer part, do successive division by r, and accumulate the remainders For fractional part, do succesive multiplication by r and accumulate the integer digits obtained

12 OCC - CS/CIS CS116-Ch00-Orientation 12 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 12 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Example: Decimal to Hexadecimal 123.23 Integer part – 123 / 16 = 7 remainder of 11 (B) (LSD) – 7 / 16 = 0 remainder of 7 (7) (MSD) – Integer part = 7B Fractional part –.23 * 16 = 3.68 3 (3) (MSD) –.68 * 16 = 10.88 10 (A) –.88 * 16 = 14.08 14 (D) (LSD) – May go on forever Answer (in part): 7B.3AD...

13 OCC - CS/CIS CS116-Ch00-Orientation 13 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 13 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Do the Binary Dance Radix 2 – 0 and 1 Usefull in digital circuits – Represent two states Off and On For an n digit binary number – Least significant bit (2 0 ) at rightmost position – Most significant bit (2 n-1 ) at the leftmost position Positional number system

14 OCC - CS/CIS CS116-Ch00-Orientation 14 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 14 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) More Binary Numbers Integer Binary Numbers – Examples: (n=6) (101101) 2 = 1 x 2 5 + 0 x 2 4 + 1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0 Fractional Binary Numbers – Examples: (101.101) 2 = 1 x 2 2 + 0 x 2 1 + 1 x 2 0 + 1 x 2 -1 + 0 x 2 -2 + 1 x 2 -3

15 OCC - CS/CIS CS116-Ch00-Orientation 15 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 15 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Binary -> Decimal Conversion (41.6875) 10 -> ( ?? ) 2 1 MSB 01 LSB1. 00012 1.5000 x 205 0.7500 x 2010 MSB 1.3750 x 21 LSB20 0. 6875 x 241 Fraction = 0.6875Integer = 41 Answer: 101001.1011

16 OCC - CS/CIS CS116-Ch00-Orientation 16 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 16 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Binary -> Hexadecimal Something special occurs – Because 2 4 = 16, 4 binary digits represents a single hexadecimal digit – Can't happen with binary to decimal No such x exists where 2 x = 10 Exercise – Why is this?

17 OCC - CS/CIS CS116-Ch00-Orientation 17 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 17 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Binary -> Hexadecimal Conversion – Partition number into chunks of 4 binary digits – Integer Right to left Pad with 0's to the left – Fractional Left to right Pad with 0's to the right Example: (10111101101011) 2 = 0010 1111 0110 1011 Partition the number = (2 F 6 B) 16

18 OCC - CS/CIS CS116-Ch00-Orientation 18 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 18 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Hexadecimal -> Binary Because of special relationship – Each hexadecimal digit becomes 4 binary digits – Just append them together Example: (3A5FB.CD) 16 = (0011 1010 0101 1111 1011. 1100 1101) 2

19 OCC - CS/CIS CS116-Ch00-Orientation 19 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 19 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Binary -> Octal Again, a special relationship – 2 3 = 8, so 3 binary digits represent and octal digit Conversion – Group into partitions of 3 bits – Pad to the left for integer section – Pad to the right for fractional part Example: Original number: (1010111101100011) 2 Partition the number: 001 010 111 101 100 011 Octal Equivalent: (1 2 7 5 4 3) 8

20 OCC - CS/CIS CS116-Ch00-Orientation 20 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 20 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Octal to Binary Just like hexadecimal – Convert each octal digit to 3 binary digit equivalent – Concatenate together Example: Octal value: (5237) 8 Partition:5 2 3 7 Equivalent binary: (101 010 011 111) 2

21 OCC - CS/CIS CS116-Ch00-Orientation 21 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 21 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) How to be negative Have to somehow indicate that the number is less than 0 Two major forms – Sign magnitude – Complement

22 OCC - CS/CIS CS116-Ch00-Orientation 22 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 22 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Sign Magnitude Sign-magnitude form – The number is divided into 2 parts Sign Magnitude. D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 Magnitude Sign MSB LSB

23 OCC - CS/CIS CS116-Ch00-Orientation 23 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 23 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Complement form – Used in digital circuits for simplifying subtraction operations & logical manipulation. – Forms: Diminished-radix complements Radix Complement

24 OCC - CS/CIS CS116-Ch00-Orientation 24 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 24 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Diminished Radix Complement Obtained by subtracting each digit from (radix -1) For decimal it is called 9's Complement – Subtract each decimal digit from (radix-1) – 10-1 = 9 For binary it is called the 1’s complement – Subtract each binary digit from (radix-1) – 2-1 = 1

25 OCC - CS/CIS CS116-Ch00-Orientation 25 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 25 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Radix Complement Obtained getting the diminished-radix complement then adding 1 to the resulting number For decimal it is called 10’s complement For binary it is called 2’s complement

26 OCC - CS/CIS CS116-Ch00-Orientation 26 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 26 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Some Examples... 9’s Complement – Example: (546789) 10 = 999999 – 546789 = (453210) in 9's complement

27 OCC - CS/CIS CS116-Ch00-Orientation 27 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 27 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Some more examples... 1's Complement – The effect of subtracting the number from all 1’s number is that every digit is inverted to its complement (changing each 1 to 0 and each 0 to 1). – Disadvantage Two values for zero – +0 = 0000 0000 – - 0 = 1111 1111 – Example: (1111) 2 - (1101) 2 = (0010) 1's complement

28 OCC - CS/CIS CS116-Ch00-Orientation 28 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 28 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) 2's Complement – The sign as well as the magnitude can be determined. – The MSB is the sign bit MSB = 0=> number is +ve, MSB = 1=> number is -ve. – The 2's complement representations of all positive values are the same as the binary equivalent for the decimal numbers – Only the -ve number representation will differ. – Advantage Binary subtraction is carried out more easily as an addition operation

29 OCC - CS/CIS CS116-Ch00-Orientation 29 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 29 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) But how do we do that... Steps – Separate sign and magnitude Negative sign means 1 in 2's complement – Convert the number (magnitude) to one's complement – Add +1 to 1's complement

30 OCC - CS/CIS CS116-Ch00-Orientation 30 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 30 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Some examples... 1 000 0000 0 111 1111 1 000 0001 0 111 1110 1 000 0010 0 111 1101 1 000 0011 0 000 0010 1 111 1110 0 000 0001 1 111 1111 0 000 0000 - 128 + 127 - 127 + 126 - 126 + 125 - 125 + 2 - 2 + 1 - 1 + 0 8-bit 2s complement representationSigned decimal

31 OCC - CS/CIS CS116-Ch00-Orientation 31 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 31 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Binary Codes What is an encoding? – Method to store information – Depends on an interpretation Straight binary numbers are difficult for people to understand Several other codes exist – 8421-Binary-Coded Decimal (BCD) – Excess-3 BCD Code (XS3) – Gray Code

32 OCC - CS/CIS CS116-Ch00-Orientation 32 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 32 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) 8421 Binary Coded Decimal (BCD) Is a weighted binary code for decimal digits 0- 9. BCD numbers are used in digital systems – Especially when numbers must be easily converted to decimals. The binary codes representing 10 to 15 aren't used in the BCD code. – They are considered as don't care entries and help in reducing the circuit design.

33 OCC - CS/CIS CS116-Ch00-Orientation 33 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 33 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) 8421 BCD Table 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 01234567890123456789 BCD (8 4 2 1)Decimal

34 OCC - CS/CIS CS116-Ch00-Orientation 34 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 34 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Why is it easier to convert? Integer part of the number is grouped into 4- bit groups from right-to-left. Fractional part is grouped from left-to-right. Each 4-bit group is converted into its decimal equivalent. Examples: (001 0000 0011. 0101) 2 = (1 0 3. 5) BCD (1 0 3. 5) BCD = (001 0000 0011. 0101) 2

35 OCC - CS/CIS CS116-Ch00-Orientation 35 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 35 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Excess-3 BCD Code (XS3) A non-weighted binary code. Number is always 3 more than the 8421 BCD code. Has a significant value in arithmetic circuits. If each bit is complemented, the resulting 4- bit word will be the 9's complement of the number.

36 OCC - CS/CIS CS116-Ch00-Orientation 36 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 36 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Excess 3 BCD 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 01234567890123456789 XS3 BCDBCD(8 4 2 1)Decimal

37 OCC - CS/CIS CS116-Ch00-Orientation 37 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 37 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Gray Code Non-weighted binary code. The code for successive decimal equivalent change only by 1 bit. This is helpful in digital circuit implementations. 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 01234567890123456789 Gray codeBCD(8 4 2 1)Decimal

38 OCC - CS/CIS CS116-Ch00-Orientation 38 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 38 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) What about other popular encodings? Codes used to represent alphanumeric characters. The most common type of non-numeric data is text (string of characters). Each character is represented by a bit-string following some established convention. Several codes exist: – ASCII – EBCDIC – Unicode

39 OCC - CS/CIS CS116-Ch00-Orientation 39 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 39 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) ASCII Abbreviation for “American Standard Code for Information Interchange” Uses 7-bits to represent a character 2 7 =128 different characters – Extended ASCII uses 8 bits Used extensively in small computers to translate characters from the keyboard, printers, or video displays to computer language

40 OCC - CS/CIS CS116-Ch00-Orientation 40 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 40 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) EBCDIC Abbreviation for “Extended Binary-Coded Decimal Interchange Code” Uses 8-bits to represent a character 2 8 =256 different characters

41 OCC - CS/CIS CS116-Ch00-Orientation 41 1998 Morgan Kaufmann Publishers ( Augmented & Modified by M.Malaty) 41 OCC-CS 116 Fall 2003 1998 Morgan Kaufmann Publishers (Augmented & Modified by M.Malaty and M. Beers) Unicode 16-bits to represent a character 2 16 different characters Universal encoding of characters of most human languages Used by Java language – And now most modern operating systems


Download ppt "Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Logic Design: Part 1."

Similar presentations


Ads by Google