QUIZ ch.1. 1 st generation 2 nd generation 3 rd generation 4 th generation 5 th generation Rock s Law Moore s Law

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "QUIZ ch.1. 1 st generation 2 nd generation 3 rd generation 4 th generation 5 th generation Rock s Law Moore s Law"

Transcription

1 QUIZ ch.1 1 st generation 2 nd generation 3 rd generation 4 th generation 5 th generation Rock s Law Moore s Law Integrated circuits Density of silicon chips doubles every 1.5 yrs. Multi-core CPU Transistors Cost of manufacturing infrastructure doubles every 4 yrs. Vacuum tubes VLSI

2 QUIZ ch.1 The highest # of transistors in a CPU commercially available today is about: 100 million 500 million 1 billion 2 billion 2.5 billion 5 billion

3 QUIZ ch.1 The highest # of transistors in a CPU commercially available today is about: 100 million 500 million 1 billion 2 billion 2.5 billion As of 2012, the highest transistor count in a commercially available CPU is over 2.5 billion transistors, in Intel's 10-core Xeon Westmere-EX. Xilinx currently holds the "world-record" for an FPGA containing 6.8 billion transistors. Source: Wikipedia Transistor_count

4 Chapter 2 Data Representation in Computer Systems

5 2.1 Introduction A bit is the most basic unit of information in a computer. It is a state of on or off in a digital circuit. Sometimes these states are high or low voltage instead of on or off.. A byte is a group of eight bits. A byte is the smallest possible addressable unit of computer storage. The term, addressable, means that a particular byte can be retrieved according to its location in memory. 5

6 2.1 Introduction A word is a contiguous group of bytes. Words can be any number of bits or bytes. Word sizes of 16, 32, or 64 bits are most common. Intel: 16 bits = 1 word, 32 bits = double word, 64 bits = quad word In a word-addressable system, a word is the smallest addressable unit of storage. 6

7 QUIZ A word is a contiguous group of bytes. Words can be any number of bits or bytes. Word sizes of 16, 32, or 64 bits are most common. Intel: 16 bits = 1 word, 32 bits = double word, 64 bits = quad word In a word-addressable system, a word is the smallest addressable unit of storage. Does the word size belong to the organization or architecture of a computer? 7

8 QUIZ What is the word size in the MARIE architecture?

9 The meaning of full n-bit computer (8, 16, 32, 64 etc.) 9 All data-related operations must be performed on n bits: Word size n bits MBR, AC n bits ALU n bits Data bus n bits / cycle n bit 1 transf./cycle n/2 bit 2 transf./cycle etc. Usually InReg, OutReg

10 The meaning of n-bit computer (8, 16, 32, 64 etc.) However, not all parameters of the computer need be exactly n bits: Opcode length Address length, PC, MAR Instruction length, IR It s even variable in CISC! 10

11 A group of four bits is called a nibble. (nybble??) Bytes consist of two nibbles: a high-order nibble, and a low-order nibble. In each case, find the h-o and l-o nibble: (binary) E7 (hex) 42 (dec) 325 (oct) 2.1 Introduction 11

12 2.2 Positional Numbering Systems Bytes store numbers using the position of each bit to represent a power of 2. The binary system is also called the base-2 system. Our decimal system is the base-10 system. It uses powers of 10 for each position in a number. Any integer quantity can be represented exactly using any base (or radix). 12

13 2.2 Positional Numbering Systems The decimal number 947 in powers of 10 is: The decimal number in powers of 10 is:

14 2.2 Positional Number Systems The binary number in powers of 2 is: = = 25 When the radix of a number is something other than 10, the base is denoted by a subscript. Sometimes, the subscript 10 is added for emphasis: =

15 2.3 Converting Between Bases Converting unsigned integers Two algorithms: 1.Top-down = repeated subtraction 2.Bottom-up = repeated division (and remainder) 15

16 Converting Repeated subtraction Example: convert the decimal number 190 to base 3. First question: how many digits are needed? A: 3 5 = 243 > 190 so our result will be less than five digits wide. The largest power of 3 that we need is therefore 3 4 = 81. How many times does 81 fit inside 190? A: 81 2 = 162. Write down the 2 and subtract from 190, giving 28.

17 Then repeat for the quantity that was left over: The next power of 3 is 3 3 = 27. We ll need one of these, so we subtract 27 and write down the numeral 1 in our result. The next power of 3, 3 2 = 9, is too large, but we have to assign a placeholder of zero and carry down the 1. 17

18 Continue until 3 0 (=1, a.k.a. units): 3 1 = 3 is again too large, so we assign a zero placeholder. The last power of 3, 3 0 = 1, is our last choice, and it gives us a difference of zero. Our result, reading from top to bottom is: =

19 19 Extra-credit QUIZ

20 Converting: repeated division Converting 190 to base 3... Our result, reading from bottom to top is: =

21 QUIZ Convert the decimal number 462 to base 5 using repeated division. 21

22 2.3 Converting Between Bases Converting unsigned fractions Fractional values can be approximated in all base systems. Unlike integes, fractions do not necessarily have exact representations under all bases. E.g. ½ (0.5 dec) is exactly representable in the binary and decimal systems, but not in base 3) 22

23 2.3 Converting Between Bases decimal point radix point Digits to the right of a radix point represent negative powers of the radix: = = = ½ + ¼ = =

24 2.3 Converting Between Bases As with integer conversions, we can use two methods: Repeated subtraction Repeated multiplication 24

25 Fractions: repeated subtraction Identical to the subtraction method for positive integers. Instead of subtracting positive powers of the target radix, we subtract negative powers of the radix. We always start with the largest value first, R -1, and work our way along using larger negative exponents. 25

26 Fractions: repeated subtraction Example: convert the decimal to binary. Our result, reading from top to bottom is: = Works with any base, not just binary! 26

27 Fractions: repeated subtraction QUIZ: convert the decimal 0.3 to binary. 27

28 Fractions: repeated multiplication Example: convert the decimal to binary First we multiply by the radix 2. The one in the units place is the first binary digit 28

29 Fractions: repeated multiplication Converting to binary... Ignoring the value in the units place, we continue multiplying each fractional part by the radix. 29

30 Fractions: repeated multiplication Converting to binary... We are finished when the product is zero, or we have reached the desired number of binary places. Reading bits from top to bottom: = This method also works with any base. Just use the target base as the multiplier. 30

31 Your turn! Convert the decimal 0.3 to binary by repeated multiplication. Use 8 bits of precision. 31

32 Individual work for next time Read pp of text Follow and understand examples 2.1 through 2.8 Solve in notebook end-of-chapter Ex.1 (p.117) 32

33 Larger Bases The binary numbering system is the most important radix system for digital computers. However, it is difficult to read long strings of binary numbers -- and even a modestly-sized decimal number becomes a very long binary number. For example: =

34 The 6-bit computers: Motivated by the 6-bit codes for printable graphic patterns common in the U.S. Army and Navy 6, 18, 26, 36, 48-bit words Some history: 18-Bit Computers from DEC 36-bit Wikipedia Edged out of the market by the need for floatingpoint IBM System/360 (1965) 8-bit microprocessors (1970s) 34 Octal an Evolutionary dead-end?

35 Octal an Evolutionary dead-end? Unisys is still successful with their 36- and 48- bit machines : Clearpath Dorado line of 36-bit CISC highend servers Clearpath Libra line of 48-bit mainframes although they are being transitioned to Intel Xeon chips (64-bit): see article 35

36 Hexadecimal For compactness and ease of reading, binary values are usually expressed using the hexadecimal (base 16) number system. The hex digits: 0 9, A, B, C, D, E, F It is easy to convert between base 16 and base 2, because 16 = 2 4 one-to-one correspondence between hex digits and groups of four bits A group of four binary digits is called a nibble or a hextet 36

37 Converting Between Bases which are powers of 2 is easy! Using hextets, the binary number (= ) in hexadecimal is: If the number of bits is not a multiple of 4, pad on the left with zeros. Octal (base 8) values are derived from binary by using groups of three bits (8 = 2 3 ): Octal was very useful when computers used six-bit words. 37

38 QUIZ: Convert from hex to octal? 2 A F 16 = 8 38

39 Operations with unsigned integers Addition Subtraction Multiplication Division They can all be performed with pencil and paper exactly as in decimal (carry, borrow, long division, etc.) 39

40 Operations with unsigned integers Addition Subtraction Multiplication Division Example: : 101 They can all be performed with pencil and paper exactly as in decimal (carry, borrow, long division, etc.) 40

41 2.4 Signed Integer Representation To represent signed integers, computer use the highorder bit to indicate the sign of a number. The high-order bit is the leftmost bit, a.k.a. the most significant bit (MSB). An MSB of 0 indicates a positive number; an MSB of 1 indicates a negative number. The remaining bits contain the magnitude of the number (but this magnitude can be interpreted different ways) 41

42 2.4 Signed Integer Representation There are 3 ways in which signed binary integers have been expressed in computers: Signed magnitude One s complement Two s complement 42

43 Pros and cons of Sign-Magnitude representation It is easy for people to understand, but it requires complicated computer hardware. It allows two different representations for zero: positive zero and negative zero. SKIP the rest of Section

44 Complement systems Idea: Negative values are represented by the difference between a high power of the base and the absolute value. The diminished radix complement of a non-zero number N in base r with d digits is (r d 1) N In the binary system, this gives us one s complement. It amounts to flipping the bits of a binary number. Example: in 8-bit one s complement we have + 3 is: is:

45 One s Complement Example: in 8-bit one s complement we have + 3 is: is: In one s complement, negative values are still indicated by a 1 in the MSB. Complement systems are useful because they eliminate the need for subtraction. The difference of two values is found by adding the minuend to the complement of the subtrahend. 45

46 Pros and cons of one s complement It is much simpler to implement than signed magnitude. It still has two different representations for zero: positive zero negative zero SKIP in section until Two s Complement 46

47 Two s complement Instead of the diminished radix complement (r d 1) N, we use the simple, (nondiminished) radix complement: r d N One s complement is still useful: flip the bits, then add one (to cancel the -1) 47

48 Two s complement To express a value in two s complement: If the number is positive, just convert it to binary and you re done. If the number is negative, find the one s complement of the number and then add 1. i.e. FLIP ALL THE BITS Example: In 8-bit binary, 3 is: using one s complement representation is: Adding 1 gives us -3 in two s complement form:

49 Your turn: Write 21 and -21 in 8-bit two s complement 49

50 Your turn: Convert these two s complement numbers to decimal:

51 QUIZ: What does the all ones combination mean in two s complement? (on any number of bits) 51

52 Two s complement arithmetic All we do is add our two binary numbers. Just discard any carries emitting from the high order bit. Example: Find the sum of 48 and -19 We note that 19 in binary is: , so -19 using one s complement is: , and -19 using two s complement is:

53 Example: Overflow in two s complement Find the sum of 107 and 46. We see that the nonzero carry from the seventh bit overflows into the sign bit, giving us the erroneous result: = But overflow into the sign bit does not always mean that we have an error! 53

54 Overflow in two s complement Example: Find the sum of 23 and -9. We see that there is carry into the sign bit, but the final result is correct: 23 + (-9) = 14. This is because there is also carry out of the sign bit! Rule for detecting signed two s complement overflow: When the carry in and the carry out of the sign bit differ, overflow has occurred. If the carry into the sign bit equals the carry out of the sign bit, no overflow has occurred. 54

55 2.4.6 Carry vs. overflow For unsigned numbers overflow and carry are the same thing. For signed numbers carry is neither necessary nor sufficient for overflow. That is why most CPUs have two different flag bits: C V 55

56 2.4.3 Excess-M A.k.a. offset binary or biased representation We map the range of signed integers to unsigned by adding a bias M 56

57 2.4.4 Signed vs. unsigned integers Signed and unsigned numbers are both useful. For example, memory addresses are always unsigned. Using the same number of bits, unsigned integers can express twice as many positive values as signed numbers but they cannot represent negative numbers! 57

58 QUIZ: Signed vs. unsigned 8-bit words can represent how many Unsigned numbers? Two s complement numbers? 58

59 2.4.5 Binary multiplication Research into finding better arithmetic algorithms has continued for over 50 years. One of the many interesting products of this work is Booth s algorithm. In most cases, Booth s algorithm carries out multiplication faster and more accurately than naïve pencil-and-paper methods. The general idea is to replace arithmetic operations with bit shifting whenever possible. 59

60 Initialize product with all zeroes If the current multiplier bit is 1 and the preceding bit was 0, subtract the multiplicand from the product If the current multiplier bit is 0 and the preceding bit was 1, we add the multiplicand to the product If we have a 00 or 11 pair, do nothing. Shift (in all cases) Assume a mythical 0 bit in position -1 (to the right of MSB) Booth s algorithm 0011 x shift shift Multiplicand Multiplier subtract, then shift add, then shift 60 Check: 3 6 = 18

61 Booth s algorithm questions Q: How does the shifting work, exactly? A: The shift moves the multiplier to the left one position, setting it up for the next step. Q: How do we subtract? A: We use two s complement, and extend the sign bit. 61 Check: 3 6 = 18

62 Booth s algorithm Example 2.26 bonus: the multiplicand can be negative! -3 x x (subtract). Check: 62-3 x 5 = -15

63 Individual work for next time Read pp of text Follow and understand examples 2.19 through 2.24 Solve in notebook end-of-chapter Ex.36 and 43 (use Booth s alg. when possible!) 63

64 Sign extension! Booth s algorithm Example 2.27 Ignore all bits over 2n x Check: = 6678

65 QUIZ Booth s algorithm Multiply 5 x 7 (use 4 bits) 65

66 QUIZ Booth s algorithm Multiply 5 x -7 (use 4 bits) 66

67 Multiplication and division by 2 A left arithmetic shift inserts a 0 in for the rightmost bit and shifts everything else left one bit; in effect, it multiplies by 2 A right arithmetic shift shifts everything one bit to the right, but copies the sign bit; it divides by 2 Let s look at some examples. 67

68 Multiply 11 by 2 using 8-bit signed two s complement representation. We start with the binary value for 11: (+11) We shift left one place, resulting in: (+22) The sign bit has not changed, so the value is valid. 68 To multiply 11 by 4, we simply perform a left shift twice.

69 Divide the value 12 by 2, using 8-bit two s complement. We start with the binary value for 12: (+12) We shift left one place, resulting in: (+6) (Remember, we carry the sign bit to the left as we shift.) To divide 12 by 4, we right shift twice. 69

70 2.5 Floating-Point Representation The representations covered so far are only for integer values and fractional values with fixed precision. These data types are not useful in scientific or business applications that deal with very large/small real numbers. Floating-point representation solves this problem. 70

71 2.5 Floating-Point Representation Although FP representations can be implemented with software libraries, most of today s computers are equipped with specialized hardware that performs floating-point arithmetic with no special programming required. FPU, a.k.a. math coprocessor Intel 8086 and and 387 Since Intel 486DX, it is built into the CPU chip, i.e. integrated 71

72 2.5 Floating-Point Representation Floating-point numbers allow an arbitrary number of decimal places to the right of the decimal point. For example: = They are often expressed in scientific notation. For example: = ,000,000 =

73 2.5 Floating-Point Representation Computers use a form of scientific notation for floating-point representation Numbers written in scientific notation have three components: 73

74 2.5 Floating-Point Representation Computer representation of a floating-point number consists of three fixed-size fields: This is the standard arrangement of these fields. Note: Although significand and mantissa do not technically mean the same thing, many people use these terms interchangeably. We use the term significand to refer to the fractional part of a floating point number. 74

75 2.5 Floating-Point Representation The one-bit sign field is the sign of the stored value. The size of the exponent field determines the range of values that can be represented. The size of the significand determines the precision of the representation. 75

76 2.5 Floating-Point Representation We introduce a hypothetical Simple Model to explain the concepts In this model: A floating-point number is 14 bits in length The exponent field is 5 bits The significand field is 8 bits 76

77 2.5 Floating-Point Representation The significand is always preceded by an implied binary point. Thus, the significand always contains a fractional binary value. The exponent indicates the power of 2 by which the significand is multiplied. 77

78 2.5 Floating-Point Representation Example: Express in the simplified 14-bit floating-point model. We know that 32 is 2 5. So in (binary) scientific notation 32 = 1.0 x 2 5 = 0.1 x 2 6. Why did we choose the second form? see next slide Using this information, we put 110 (= 6 10 ) in the exponent field and 1 in the significand as shown. 78

79 These are all equivalent representations for 32: 0.1 x x 2 7 Problem x x 2 9 Not only do these synonymous representations waste space, but they also require complex hardware to test for equality! 79

80 Solution We establish a rule that the first digit of the significand must be 1, with no ones to the left of the radix point. This process, called normalization, results in a unique pattern for each floating-point number. In our simple model, all significands must have the form 0.1xxxxxxxx For example, 4.5 = x 2 0 = x 2 2 = x 2 3. The last expression is correctly normalized. 80

81 QUIZ Represent in the 14-bit floating-point model, normalized. 81

82 Normalization, results in a unique pattern for each floating-point number. In our simple model, all significands must have the form 0.1xxxxxxxx For example, 4.5 = x 2 0 = x 2 2 = x 2 3. The last expression is correctly normalized. If this bit is always one, why waste memory representing it?! 82

83 Normalization, results in a unique pattern for each floating-point number. In our simple model, all significands must have the form 0.1xxxxxxxx For example, 4.5 = x 2 0 = x 2 2 = x 2 3. The last expression is correctly normalized. If this bit is always one, why waste memory representing it?! Indeed, the IEEE-754 standard uses an implied bit. 83

84 Individual work for next time Read pp of text Follow and understand examples 2.25 through 2.31 Solve in notebook Ex. 25 a, 26 /

85 2.5 Floating-Point Representation Another problem We cannot represent negative exponents, b/c there is no sign in the exponent field. E.g. we have no way to express 0.5 =2-1 85

86 Solution We use a biased exponent. A bias is a number that is approximately midway in the range of values expressible by the exponent. We subtract the bias from the value in the exponent to determine its true value. In our case, we have a 5-bit exponent. We take 2 5 / 2-1 = 15 for our bias. This is called excess-15 representation. In our model, exponent values < 15 are negative, representing fractional numbers. 86

87 Example: Express in the revised 14-bit floating-point model including the implied bit. 87

88 QUIZ: Express in the revised 14-bit floating-point model. We know that is 2-4. So in (binary) scientific notation = 1.0 x 2-4 = 0.1 x 2-3 Add 15 to -3, giving =

89 QUIZ: Express in the revised 14-bit floating-point model. 89

90 QUIZ: Express in the revised 14-bit floating-point model. We find = Normalizing, we have: = x 2 5 Add 15 to 5, giving = We also need a 1 in the sign bit. 90

91 QUIZ: Given the 14-bit floating-point model representation 36 C0, find the number that is represented 91

92 Overflow and underflow What is the largest number (in absolute value) that can be represented in our 14-bit model? 92

93 Overflow and underflow What is the largest number (in absolute value) that can be represented in our 14-bit model? ± = ± = 65, = x = ± 65, / sign expo significand 93

94 EXTRA-CREDIT QUIZ: 94

95 Floating-Point Addition and Subtraction FP addition and subtraction are done w/methods analogous to those for pencil and paper: First express both operands in the same exponential power Add the numbers, preserving the exponent in the sum If the exponent requires adjustment, do so at the end 95

96 96

97 Your turn: Find the sum of and using the 14-bit biased FP model. 97

98 Floating-Point Errors Example: the 14-bit model cannot exactly represent the decimal value 128.5, b/c it has 9 bits: = Even if the initial numbers are represented exactly, each arithmetic operation can introduce errors due to normalization Errors can be compounded through repetitive arithmetic operations 98

99 The programmer s job is to: Floating-Point Errors Eliminate or reduce errors, by using appropriate numerical algorithms Example: Evaluate n-choose-(n-2) Evaluate the magnitude of the errors n n 2 Loss of MSB Example: = 128(!) e = Loss of LSB 0.39% Conclusion: Avoid numbers of very different magnitudes! 99

100 Floating-Point Errors Compounded errors example: % A procedure repetitively adds 0.5 to 128: Correct values are: 128.5, 129, 129.5, 130 Actual values with the 14-bit model are What is the absolute error after 10 iterations? What is the relative error after 10 iterations? 100

101 What can happen? FP overflow and underflow can cause programs to crash. Overflow occurs when there is no room to store the high-order bits resulting from a calculation. Underflow occurs when a value is too small to store, possibly resulting in division by zero. Loss of LSB is less dramatic, but due to compounding of errors is can be more dangerous! 101 It s better for a program to crash than to have it produce incorrect, but plausible, results.

102 Individual work for next time Read pp of text Read and understand the repeated multiplication example in Table 2.3/79 Read and take notes in notebook: Section IEEE-754 Solve in notebook Ex. 27,

103 FP review QUIZ: Find the product of 7 10 and using the 14-bit biased FP model. Use Booth s algorithm! Show all the steps! 103

104 2.5.4 IEEE-754 The IEEE has established a standard for floatingpoint numbers: Single (32 bit), Double (64 bit) and Quad (128 bit) precisions What is different from the simplified 14-bit model: The significant has an implied 1 to the LEFT of the binary point. Denormalized numbers can be represented Non-numbers can be represented: ±, NaN (Not 104

105 IEEE 754 Single, double and quadruple precision 32, 64, 128 bits Sources:

106 Try it out with an online calculator! (Link is on our webpage) 106

107 SKIP the remainder of this section We only require working knowledge of the 14-bit simplified model in this class 107

108 2.5.5 Range, precision, accuracy The range of a numeric integer format is the difference between the largest and smallest values that can be expressed Calculate the ranges for: 8-bit unsigned integers 8-bit signed integers (2 s complement) 14-bit simple FP model 32-bit double precision (IEEE 754) 108

109 Range, precision, accuracy

110 2.5.5 Range, precision, accuracy Accuracy means how closely a numeric representation approximates a true value. The precision of a number indicates how much information we have about a value. 110

111 Precision vs. accuracy Most of the time, greater precision leads to better accuracy For example when adding and multiplying numbers but this is not always true. For example, is a value of pi (= ) that is accurate to two digits, but has five digits of precision. 111

112 Because of truncated bits, we cannot always assume that a particular floating point operation is commutative or distributive. Example: we cannot assume: (a + b) + c = a + (b + c) a*(b + c) = ab + ac 112

113 To test a floating point value for equality to some other number, it is best to declare a nearness to x epsilon value. For example, instead of checking to see if floating point x is equal to 2 as follows: if x = 2 then it is better to use: epsilon if (abs(x - 2) < epsilon) then... (assuming we have epsilon defined correctly!) 113

114 2.6 Character Codes As computers have evolved, character codes have evolved, b/c larger computer memories and storage devices make possible the use of richer character codes. Short history of codes: Baudot (5 bit) BCD (6-bit) EBCDIC (8 bit) ASCII (7-bit) Unicode (16-bit) The earliest computer coding systems used 6 bits. Binary-coded decimal (BCD) was one of these early codes. It was used by IBM mainframes in the 1950s and 1960s. 114

115 2.6 Character Codes In 1964, BCD was extended to an 8-bit code, Extended Binary-Coded Decimal Interchange Code (EBCDIC). EBCDIC was one of the first widely-used computer codes that supported upper and lowercase alphabetic characters, in addition to special characters, such as punctuation and control characters. EBCDIC and BCD are still in use in IBM mainframes today! 115

116 ASCII Other computer manufacturers chose the 7-bit ASCII (American Standard Code for Information Interchange) as a replacement for 6-bit codes. While BCD and EBCDIC were based upon punched card codes, ASCII was based upon telecommunications (Telex) codes. Until recently (~2008), ASCII was the dominant character code outside the IBM mainframe world. Later extended ASCII evolved so that all eight bits were used How many characters can be represented? 116

117 117 7-bit ASCII Character Set

118 QUIZ Encode Hello, world! in ASCII Decode

119 The ASCII Character Set The first 32 characters in the ASCII character chart do not have a simple character representation to print to the screen. They are called control characters 119

120 Not in text Control Character: newline Source: 120

121 Not in text 8-bit ( extended ) ASCII Character Sets By using 8 bits instead of 7, the number of codes extends from 128 to 256. Extended ASCII is always a superset of 7-bit ASCII: The first 128 characters correspond exactly to 7-bit ASCII Problem??? 121

122 Not in text Extended ASCII: IBM code page

123 Not in text Extended ASCII: Latin

124 Trick QUIZ What do these bits represent?

125 Trick QUIZ What do these bits represent? Unsigned integer: Signed integer (2 s complement): Fixed-point fraction IBM 437 character: Latin-1 character: 125

126 QUIZ: Your boss tells you to develop a webpage using the extended ASCII character set. What do you reply? 126

127 2.6 Character Codes Many of today s systems embrace Unicode, a 16-bit system that can encode the characters of every language in the world. The Java programming language, and some operating systems now use Unicode as their default character code. The Unicode codespace is divided into six parts. The first part is for Western alphabet codes, including English, Greek, and Russian. 127

128 2.6 Character Codes The Unicode codespace allocation is shown at the right. The lowest-numbered Unicode characters comprise the ASCII code. The highest provide for user-defined codes. 128

129 The Unicode Character Set None of the Extended ASCII character sets were enough for international use (256!) Unicode uses 16 bits per character How many characters can UNICODE represent? Unicode is a superset of Latin-1: The first 256 characters correspond exactly to Latin-1 characters ( ) 129 Simplified Chinese has 6500!

130 130 Figure 3.6 A few characters in the Unicode character set Unicode examples

131 Miscellaneous Characters in Unicode 131 See more online at the official Unicode site

132 Romanian Characters in Unicode Part of the Latin-Extended-B character sub-set 132

133 Miscellaneous Characters in Unicode 133 See more online at the official Unicode site

134 QUIZ Select all that apply: The Latin-1 character set: Is a 5-bit representation Is a 7-bit representation Is a 16-bit representation Is an extension of ASCII Is an extension of Unicode Contains letters used in European languages 134

135 QUIZ Select all that apply: The Unicode representation: Uses 16 bits Is an extension of ASCII Is an extension of Latin-1 Is an extension of IBM-437 Contains letters used in all world languages Can accommodate over 65,000 characters Is used in the majority of web pages today 135 EOL4

136 2.7 Error Detection and Correction SKIP! (We cover this in Networks) 136

137 Homework for Ch.2 Due Tue, Sep.23 End-of-chapter exercises: 2, 4, 8, only two s comp only two s comp. 31, use Booth s algorithm 45, 58,

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1 IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

More information

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

More information

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep

More information

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

More information

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

10.1. Unit 10. Signed Representation Systems Binary Arithmetic 0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system

More information

Binary Addition & Subtraction. Unsigned and Sign & Magnitude numbers

Binary Addition & Subtraction. Unsigned and Sign & Magnitude numbers Binary Addition & Subtraction Unsigned and Sign & Magnitude numbers Addition and subtraction of unsigned or sign & magnitude binary numbers by hand proceeds exactly as with decimal numbers. (In fact this

More information

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits

More information

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

More information

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right. Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum

More information

Signed umbers. Sign/Magnitude otation

Signed umbers. Sign/Magnitude otation Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

More information

Chapter 2: Number Systems

Chapter 2: Number Systems Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

More information

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

More information

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

More information

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

More information

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors. Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic

More information

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. ! Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating

More information

System Programming CISC 360. Floating Point September 16, 2008

System Programming CISC 360. Floating Point September 16, 2008 System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:

More information

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen

More information

Logic, Words, and Integers

Logic, Words, and Integers Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits

More information

Principles of Computer Architecture. Chapter 3: Arithmetic

Principles of Computer Architecture. Chapter 3: Arithmetic 3-1 Chapter 3 - Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 3-2 Chapter 3 - Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition

More information

Floating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.

Floating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time. Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point

More information

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors. Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic ( volts) and one for logic (3.3

More information

Chapter 3 Arithmetic for Computers (Part 2)

Chapter 3 Arithmetic for Computers (Part 2) Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive

More information

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for

More information

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning 4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

More information

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

More information

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes Multiple-byte data CMSC 313 Lecture 03 big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes UMBC, CMSC313, Richard Chang 4-5 Chapter

More information

Digital Fundamentals

Digital Fundamentals Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities

More information

IEEE-754 floating-point

IEEE-754 floating-point IEEE-754 floating-point Real and floating-point numbers Real numbers R form a continuum - Rational numbers are a subset of the reals - Some numbers are irrational, e.g. π Floating-point numbers are an

More information

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize

More information

Administrivia. CMSC 216 Introduction to Computer Systems Lecture 24 Data Representation and Libraries. Representing characters DATA REPRESENTATION

Administrivia. CMSC 216 Introduction to Computer Systems Lecture 24 Data Representation and Libraries. Representing characters DATA REPRESENTATION Administrivia CMSC 216 Introduction to Computer Systems Lecture 24 Data Representation and Libraries Jan Plane & Alan Sussman {jplane, als}@cs.umd.edu Project 6 due next Friday, 12/10 public tests posted

More information

Characters, Strings, and Floats

Characters, Strings, and Floats Characters, Strings, and Floats CS 350: Computer Organization & Assembler Language Programming 9/6: pp.8,9; 9/28: Activity Q.6 A. Why? We need to represent textual characters in addition to numbers. Floating-point

More information

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning 4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 18, 2017 at 12:48 CS429 Slideset 4: 1 Topics of this Slideset

More information

Chapter 3: part 3 Binary Subtraction

Chapter 3: part 3 Binary Subtraction Chapter 3: part 3 Binary Subtraction Iterative combinational circuits Binary adders Half and full adders Ripple carry and carry lookahead adders Binary subtraction Binary adder-subtractors Signed binary

More information

Floating Point Numbers

Floating Point Numbers Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides

More information

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers. class04.ppt 15-213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For

More information

3.5 Floating Point: Overview

3.5 Floating Point: Overview 3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

More information

Floating Point Numbers. Lecture 9 CAP

Floating Point Numbers. Lecture 9 CAP Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:

More information

Number Systems & Encoding

Number Systems & Encoding Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers

More information

C NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.

C NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0. C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an

More information

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction 1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

More information

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation

More information

Learning the Binary System

Learning the Binary System Learning the Binary System www.brainlubeonline.com/counting_on_binary/ Formated to L A TEX: /25/22 Abstract This is a document on the base-2 abstract numerical system, or Binary system. This is a VERY

More information

Floating-Point Numbers in Digital Computers

Floating-Point Numbers in Digital Computers POLYTECHNIC UNIVERSITY Department of Computer and Information Science Floating-Point Numbers in Digital Computers K. Ming Leung Abstract: We explain how floating-point numbers are represented and stored

More information

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1

More information

Lecture (03) Binary Codes Registers and Logic Gates

Lecture (03) Binary Codes Registers and Logic Gates Lecture (03) Binary Codes Registers and Logic Gates By: Dr. Ahmed ElShafee Binary Codes Digital systems use signals that have two distinct values and circuit elements that have two stable states. binary

More information

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers 198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information

More information

Digital Logic Lecture 2 Number Systems

Digital Logic Lecture 2 Number Systems Digital Logic Lecture 2 Number Systems By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department Outline Introduction. Basic definitions. Number systems types. Conversion between different

More information

The Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.

The Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive. IEEE 754 Standard - Overview Frozen Content Modified by on 13-Sep-2017 Before discussing the actual WB_FPU - Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at

More information

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers

More information

Computer Architecture and Organization

Computer Architecture and Organization 3-1 Chapter 3 - Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 3-2 Chapter 3 - Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction

More information

Floating Point Considerations

Floating Point Considerations Chapter 6 Floating Point Considerations In the early days of computing, floating point arithmetic capability was found only in mainframes and supercomputers. Although many microprocessors designed in the

More information

Numeric Variable Storage Pattern

Numeric Variable Storage Pattern Numeric Variable Storage Pattern Sreekanth Middela Srinivas Vanam Rahul Baddula Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents the Storage pattern of Numeric Variables within the

More information

CS101 Lecture 04: Binary Arithmetic

CS101 Lecture 04: Binary Arithmetic CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary

More information

NUMBER SYSTEMS AND CODES

NUMBER SYSTEMS AND CODES C H A P T E R 69 Learning Objectives Number Systems The Decimal Number System Binary Number System Binary to Decimal Conversion Binary Fractions Double-Dadd Method Decimal to Binary Conversion Shifting

More information

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017 4/8/17 Admin! Assignment 5 BINARY David Kauchak CS 52 Spring 2017 Diving into your computer Normal computer user 1 After intro CS After 5 weeks of cs52 What now One last note on CS52 memory address binary

More information

IBM 370 Basic Data Types

IBM 370 Basic Data Types IBM 370 Basic Data Types This lecture discusses the basic data types used on the IBM 370, 1. Two s complement binary numbers 2. EBCDIC (Extended Binary Coded Decimal Interchange Code) 3. Zoned Decimal

More information

Lecture 5. Computer Arithmetic. Ch 9 [Stal10] Integer arithmetic Floating-point arithmetic

Lecture 5. Computer Arithmetic. Ch 9 [Stal10] Integer arithmetic Floating-point arithmetic Lecture 5 Computer Arithmetic Ch 9 [Stal10] Integer arithmetic Floating-point arithmetic ALU ALU = Arithmetic Logic Unit (aritmeettis-looginen yksikkö) Actually performs operations on data Integer and

More information

9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System

9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System For Your Amusement Number Systems and Number Representation Jennifer Rexford Question: Why do computer programmers confuse Christmas and Halloween? Answer: Because 25 Dec = 31 Oct -- http://www.electronicsweekly.com

More information

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,... COMPUTER ARCHITECTURE II: MICROPROCESSOR PROGRAMMING We can study computer architectures by starting with the basic building blocks Transistors and logic gates To build more complex circuits Adders, decoders,

More information

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic Floating point numbers are frequently used in many applications. Implementation of arithmetic units such as adder, multiplier, etc for Floating point numbers are more complex

More information

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j

More information

17. Instruction Sets: Characteristics and Functions

17. Instruction Sets: Characteristics and Functions 17. Instruction Sets: Characteristics and Functions Chapter 12 Spring 2016 CS430 - Computer Architecture 1 Introduction Section 12.1, 12.2, and 12.3 pp. 406-418 Computer Designer: Machine instruction set

More information

ENE 334 Microprocessors

ENE 334 Microprocessors Page 1 ENE 334 Microprocessors Lecture 10: MCS-51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Logical & Arithmetic Page 2 Logical: Objectives

More information

Arithmetic Logic Unit

Arithmetic Logic Unit Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,

More information

15213 Recitation 2: Floating Point

15213 Recitation 2: Floating Point 15213 Recitation 2: Floating Point 1 Introduction This handout will introduce and test your knowledge of the floating point representation of real numbers, as defined by the IEEE standard. This information

More information

Declaring Floating Point Data

Declaring Floating Point Data Declaring Floating Point Data There are three ways to declare floating point storage. These are E D L Single precision floating point, Double precision floating point, and Extended precision floating point.

More information

EE 109 Unit 6 Binary Arithmetic

EE 109 Unit 6 Binary Arithmetic EE 109 Unit 6 Binary Arithmetic 1 2 Semester Transition Point At this point we are going to start to transition in our class to look more at the hardware organization and the low-level software that is

More information

Classes of Real Numbers 1/2. The Real Line

Classes of Real Numbers 1/2. The Real Line Classes of Real Numbers All real numbers can be represented by a line: 1/2 π 1 0 1 2 3 4 real numbers The Real Line { integers rational numbers non-integral fractions irrational numbers Rational numbers

More information

1. Draw general diagram of computer showing different logical components (3)

1. Draw general diagram of computer showing different logical components (3) Tutorial 1 1. Draw general diagram of computer showing different logical components (3) 2. List at least three input devices (1.5) 3. List any three output devices (1.5) 4. Fill the blank cells of the

More information

Scientific Computing. Error Analysis

Scientific Computing. Error Analysis ECE257 Numerical Methods and Scientific Computing Error Analysis Today s s class: Introduction to error analysis Approximations Round-Off Errors Introduction Error is the difference between the exact solution

More information

Five classic components

Five classic components CS/COE0447: Computer Organization and Assembly Language Chapter 3 modified by Bruce Childers original slides by Sangyeun Cho Dept. of Computer Science Five classic components I am like a control tower

More information

Data Representation Floating Point

Data Representation Floating Point Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:

More information

IEEE Standard 754 Floating Point Numbers

IEEE Standard 754 Floating Point Numbers IEEE Standard 754 Floating Point Numbers Steve Hollasch / Last update 2005-Feb-24 IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based

More information

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation 3.1 3.2 Unit 3 Binary Representation ANALOG VS. DIGITAL 3.3 3.4 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based

More information

Signed Binary Numbers

Signed Binary Numbers Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number

More information

Data Types. Data Types. Integer Types. Signed Integers

Data Types. Data Types. Integer Types. Signed Integers Data Types Data Types Dr. TGI Fernando 1 2 The fundamental building blocks of any programming language. What is a data type? A data type is a set of values and a set of operations define on these values.

More information

Digital Computers and Machine Representation of Data

Digital Computers and Machine Representation of Data Digital Computers and Machine Representation of Data K. Cooper 1 1 Department of Mathematics Washington State University 2013 Computers Machine computation requires a few ingredients: 1 A means of representing

More information

umber Systems bit nibble byte word binary decimal

umber Systems bit nibble byte word binary decimal umber Systems Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk, or as a state in a transistor. To perform useful operations on these

More information

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS/COE 0447 Example Problems for Exam 2 Spring 2011 CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product

More information

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003 Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

More information

Computer Logical Organization Tutorial

Computer Logical Organization Tutorial Computer Logical Organization Tutorial COMPUTER LOGICAL ORGANIZATION TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Computer Logical Organization Tutorial Computer

More information

COMP 303 Computer Architecture Lecture 6

COMP 303 Computer Architecture Lecture 6 COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =

More information

Floating Point. What can be represented in N bits? 0 to 2N-1. 9,349,398,989,787,762,244,859,087, x 1067

Floating Point. What can be represented in N bits? 0 to 2N-1. 9,349,398,989,787,762,244,859,087, x 1067 MIPS Floating Point Operations Cptr280 Dr Curtis Nelson Floating Point What can be represented in N bits? Unsigned 2 s Complement 0 to 2N-1-2N-1 to 2N-1-1 But, what about- Very large numbers? 9,349,398,989,787,762,244,859,087,678

More information

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16 CODING and INFORMATION We need encodings for data. How many questions must be asked to be certain where the ball is. (cases: avg, worst, best) P( Hit 1st ) = 1/16 P( Hit 2nd ) = P( Hit 2nd Miss 1st )P(

More information

CS367 Test 1 Review Guide

CS367 Test 1 Review Guide CS367 Test 1 Review Guide This guide tries to revisit what topics we've covered, and also to briefly suggest/hint at types of questions that might show up on the test. Anything on slides, assigned reading,

More information

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro II Lect 10 Feb 15, 2008 Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L10.1

More information

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes 1 DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations Other Binary Codes Error Detection Codes 2 Data Types DATA REPRESENTATION Information that a Computer

More information

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2)

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2) ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #3: Of Integers and Endians (pt. 2) Reading for Today: Davies Ch 2, MSP430 User's Guide Ch 6.1, 6.3 Reading for Next Class:

More information

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS Addition of Unsigned Numbers The instruction ADD is used to add two operands Destination operand is always in register A Source operand can be a register,

More information

ARCHITECTURAL DESIGN OF 8 BIT FLOATING POINT MULTIPLICATION UNIT

ARCHITECTURAL DESIGN OF 8 BIT FLOATING POINT MULTIPLICATION UNIT ARCHITECTURAL DESIGN OF 8 BIT FLOATING POINT MULTIPLICATION UNIT Usha S. 1 and Vijaya Kumar V. 2 1 VLSI Design, Sathyabama University, Chennai, India 2 Department of Electronics and Communication Engineering,

More information

Octal & Hexadecimal Number Systems. Digital Electronics

Octal & Hexadecimal Number Systems. Digital Electronics Octal & Hexadecimal Number Systems Digital Electronics What, More Number Systems? Why do we need more number systems? Humans understand decimal Check out my ten digits! Digital electronics (computers)

More information

Tailoring the 32-Bit ALU to MIPS

Tailoring the 32-Bit ALU to MIPS Tailoring the 32-Bit ALU to MIPS MIPS ALU extensions Overflow detection: Carry into MSB XOR Carry out of MSB Branch instructions Shift instructions Slt instruction Immediate instructions ALU performance

More information

Number System (Different Ways To Say How Many) Fall 2016

Number System (Different Ways To Say How Many) Fall 2016 Number System (Different Ways To Say How Many) Fall 2016 Introduction to Information and Communication Technologies CSD 102 Email: mehwish.fatima@ciitlahore.edu.pk Website: https://sites.google.com/a/ciitlahore.edu.pk/ict/

More information

Co-processor Math Processor. Richa Upadhyay Prabhu. NMIMS s MPSTME February 9, 2016

Co-processor Math Processor. Richa Upadhyay Prabhu. NMIMS s MPSTME February 9, 2016 8087 Math Processor Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu February 9, 2016 Introduction Need of Math Processor: In application where fast calculation is required Also where there

More information

More Programming Constructs -- Introduction

More Programming Constructs -- Introduction More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

More information