ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE278: Digital Logic Design Fall Notes  Unit 4. hundreds.


 Joel Lloyd
 2 years ago
 Views:
Transcription
1 ECE78: Digital Logic Design Fall 6 UNSIGNED INTEGER NUMBERS Notes  Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digitbydigit representation of a positive integer number (powers of ): DIGIT Number: 937 hundreds thousands tens units thousands, 3 hundreds, 7 tens, and units = POSITIONAL NUMBER REPRESENTATION Let s consider the numbers from to 999. We represent these numbers with 3 digits (each digit being a number between and 9). We show a 3digit number using the positional number representation: MATHEMATICAL REPRESENTATION 3digit d d d EXAMPLE 9 Third Digit Second Digit First Digit The positional number representation allows us to express the decimal value using powers of ten: d + d + d. Example: Decimal Number Exercise: Write down the 3digit and the powers of ten representations for the following numbers: Decimal Number 3digit representation d + d + d digit representation d d d Third Digit Second Digit First Digit Powers of : d + d + d Instructor: Daniel Llamocca
2 ECE78: Digital Logic Design Fall 6 General Case: Positional number representation for an integer positive number with n digits: Decimal Value: D = i=n d i i = d n n + d n n + + d + d i= Example: 9834 (7 digits) (6 digits) Maximum value: The table presents the maximum attainable value for a given number of digits. What pattern do you find? Can you complete it for the highlighted cases (4 and 6)? Number of digits Maximum value Range 9 = = = = d n d n d d n = n n  Maximum value for a number with n digits: Based on the table, the maximum decimal value for a number with n digits is given by: D = = 9 n + 9 n = n  n digits With n digits, we can represent n positive integer numbers from to n . With 7 digits, what is the range (starting from ) of positive numbers that we can represent? How many different numbers can we represent? BINARY NUMBER SYSTEM We are used to the decimal number system. However, there exist other number systems: octal, hexadecimal, vigesimal, binary, etc. In particular, binary numbers are very practical as they are used by digital computers. For binary numbers, the counterpart of the decimal digit (that can take values from to 9) is the binary digit, or bit (that can take the value of or ). DIGIT BIT Bit: Unit of information that a computer uses to process and retrieve data. It can also be used as a Boolean variable (see Unit ). Binary number: This is represented by a string of bits using the positional number representation: b n b n b b Converting a binary number into a decimal number: The following figure depicts two cases: bit numbers and 3bit numbers. Note that the positional representation with powers of two let us obtain the decimal value (integer positive) of the binary number. Instructor: Daniel Llamocca
3 ECE78: Digital Logic Design Fall 6 MATHEMATICAL REPRESENTATION bit Second Bit b b First Bit Binary number Powers of : Decimal Number b b b + b MATHEMATICAL REPRESENTATION 3bit b b b Third Bit Second Bit First Bit Binary number General case: Positional number representation for a binary number with n bits: Powers of : Decimal Number b b b b + b + b Most significant (leftmost) bit b n b n b b Least significant (rightmost) bit The binary number can be converted to a positive decimal number by using the following formula: D = i=n b i i = b n n + b n n + + b + b i= To avoid confusion, we usually write a binary number and attach a suffix : (b n b n b b ) Example: 6 bits: () D = = 43 4 bits: () D = = Maximum value for a given number of bits. Complete the tables for the highlighted cases (4 and 6): Number of bits Maximum value Range n n  n  Maximum value for n bits: The maximum binary number is given by an nbit string of s:. Then, the maximum decimal numbers is given by: D = = n + n = n  n bits With n bits, we can represent n positive integer numbers from to n . 3 Instructor: Daniel Llamocca
4 ECE78: Digital Logic Design Fall 6 The case n=8 bits is of particular interest, as a string of 8 bits is called a byte. For 8bit numbers, we have 56 numbers in the range to 8  to 55. Most significant (leftmost) bit b 7 b 6 b 5 b 4 b 3 b b b Least significant (rightmost) bit The table shows some examples: Decimal Number 8bit format b 7 b 6 b 5 b 4 b 3 b d d b b b b b b + b + b Exercise: Convert the following binary numbers (positive integers) to their decimal values: 8bit representation b b b b b b + b + b Decimal Number CONVERSION OF A NUMBER IN ANY BASE TO THE DECIMAL SYSTEM To convert a number of base 'r' (r =, 3,4, ) to decimal, we use the following formula: base 'r': (r n r n r r ) r Conversion to decimal: D = i=n r i r i = r n r n + r n r n + + r r + r r i= Also, the maximum decimal value for a number in base 'r' with 'n' digits is: D = rrr rrr = r r n + r n r n + + r r + r r = r n Example: Base8: Number of digits Maximum value Range n n n  Examples: (563) 8 : base 8 (octal system) Number of digits: n = 5 Conversion to decimal: D = = 89 (3) 4 : base 4 (quaternary system) Number of digits: n = 4 Conversion to decimal: D = = 4 Instructor: Daniel Llamocca
5 ECE78: Digital Logic Design Fall 6 CONVERSION OF DECIMAL (INTEGER POSITIVE) TO BINARY NUMBERS Examples: base base base base 5???? 3???? 6 5 Remainder 6 3 Remainder stop here! stop here! Note that some numbers require fewer bits than others. If we want to use a specific bit representation, e.g., 8bit, we just need to append zeros to the left until the 8 bits are completed. For example: (8bit number) (8bit number) Actually, you can use this method to convert a decimal number into any other base. For example, if you want to convert it into a base8 number, just divide by 8 and group the remainders. Example: Converting a decimal number to base8: base Remainder 3 base 8???? stop here! 5 Instructor: Daniel Llamocca
6 ECE78: Digital Logic Design Fall 6 Exercise: Convert the following two decimal numbers to binary numbers. Fill in the blanks in the figure below. base base base base 63???? 97???? Remainder Remainder Now, convert the following decimal numbers to binary numbers. The final binary number must have 8 bits (append zeros to the left to complete). Decimal number 4 Binary number with 8 bits b 7b 6b 5b 4b 3b b b Instructor: Daniel Llamocca
7 ECE78: Digital Logic Design Fall 6 HEXADECIMAL NUMBER SYSTEM This is a very useful system as it is a shorthand notation for binary numbers In the decimal number system, a digit can take a value from to 9. A hexadecimal digit is also called a nibble. A hexadecimal digit can take a value from to 5. To avoid confusion, the numbers to 5 are represented by letter (AF): Hexadecimal digits A B C D E F The following figure shows a digit hexadecimal number. Note that the positional representation with powers of 6 let us obtain the decimal value (integer positive) of the hexadecimal number. This is the same as converting a hexadecimal number into a decimal number. MATHEMATICAL REPRESENTATION hexadecimal digits Second Digit h h First Digit Decimal digits Hex. number Powers of 6: h h h 6 + h 6 5A A FB F 6 + B 6 5 3E E 6 6 A7 A Decimal Value Note that when we use the letters AF in the multiplications inside the powers of 6 representation (e.g., A ), we need to replace the hexadecimal symbol by its decimal value. A =, B =, C =, D = 3, E = 4, F = 5 For example: A 6 () 6. EXERCISE: Convert the following hexadecimal numbers (positive integers) to their decimal values: hex. digit representation AB h 6 +h 6 Decimal Number CE 5 7 F E9 General case: Positional number representation for a hexadecimal number with n nibbles (hexadecimal digits): Most significant (leftmost) nibble h n h n h h Least significant (rightmost) nibble 7 Instructor: Daniel Llamocca
8 ECE78: Digital Logic Design Fall 6 To convert a hexadecimal number into a decimal, we apply the following formula: Decimal Value (integer positive): D = i=n h i 6 i = h n 6 n + h n 6 n + + h 6 + h 6 i= To avoid confusion, it is sometimes customary to append the prefix x to a hexadecimal number: Examples: FDA9: FDA9 F D A B87C: B87C B C 6 The table presents the maximum attainable value for the given number of nibbles (hexadecimal digits). What pattern do you find? Can you complete it for the highlighted cases (4 and 6)? Number of nibbles Maximum value Range F 6  F 6  FF 6  FF 63 FFF FFF FFFFF h n h n h h n FFF FFF 6 n  FFF FFF 6 n  Maximum value for n nibbles: The maximum decimal value with n nibbles is given by: D = FFFFFF = F 6 n + F 6 n + + F 6 + F n n = 6 n  n nibbles With n nibbles, we can represent positive integer numbers from to 6 n . (6 n numbers) UNITS OF INFORMATION Nibble Byte KB MB GB TB 4 bits 8 bits bytes bytes 3 bytes 4 bytes Note that the nibble (4 bits) is one hexadecimal digit. Also, one byte (8 bits) is represented by two hexadecimal digits. While KB, MB, GB, TB (and so on) should be powers of in the International System, it is customary in digital jargon to use powers of to represent them. In microprocessor systems, memory size is usually a power of due to the fact that the maximum memory size is determined by the number of addresses the address bus can handle (which is a power of ). As a result, it is very useful to use the definition provided here for KB, MB, GB, TB (and so on). Digital computers usually represent numbers utilizing a number of bits that is a multiple of 8. The simple hexadecimal to binary conversion may account for this fact as we can quickly convert a string of bits that is a multiple of 8 into a string of hexadecimals digits. The size of the data bus in a processor represents the computing capacity of a processor, as the data bus size is the number of bits the processor can operate in one operation (e.g.: 8bit, 6bit, 3bit processor). This is also usually expressed as a number of bits that is a multiple of 8. RELATIONSHIP BETWEEN HEXADECIMAL AND BINARY NUMBERS Conversions between hexadecimal and binary systems are very common when dealing with digital computers. In this activity, we will learn how these systems are related and how easy it is to convert between one and the other. Hexadecimal to binary: We already know how to convert a hexadecimal number into a decimal number. We can then can convert the decimal number into a binary number (using successive divisions). Binary to hexadecimal: We can first convert the binary number to a decimal number. Then, using an algorithm similar to the one that converts decimals into binary, we can convert our decimal number into a hexadecimal number. 8 Instructor: Daniel Llamocca
9 ECE78: Digital Logic Design Fall 6 SIMPLE METHOD TO CONVERT HEXADECIMAL TO BINARY NUMBERS AND VICEVERSA The previous two conversion processes are too tedious. Fortunately, hexadecimal numbers have an interesting property that allows quick conversion of binary numbers to hexadecimals and viceversa. Binary to hexadecimal: We group the binary numbers in groups of 4 (starting from the rightmost bit). If the last group of bits does not have four bits, we append zeros to the left. Then, we independently convert each group of 4 bits to its decimal value. Notice that 4 bits can only take decimal values between and 4  to 5, hence 4 bits represent only one hexadecimal digit. In other words, for each group of 4 bits, there are only 6 possible hexadecimal digits to pick from. The figure below shows an example. Binary: decimal: hexadecimal: Then: Verification: = x5d D = = 93 x5d = D 6 = 93 binary dec hex A B C 3 D 4 E 5 F Exercise: Group the following binary numbers in groups of 4 bits and obtain the hexadecimal representation. Use the table in the previous figure to pick the correspondent hexadecimal digit for each group of 4 bits. Binary number Hexadecimal number Hexadecimal to binary: It is basically the inverse of the process of converting a binary into a hexadecimal numbers. We pick each hexadecimal digit and convert it (always using 4 bits) to its 4bit binary representation. The binary number is the concatenation of all resulting group of 4 bits. C x = xc = DO NOT discard these zeros when concatening! 9 Instructor: Daniel Llamocca
10 ECE78: Digital Logic Design Fall 6 Exercise: Convert these hexadecimal numbers to binary. Verify it by converting both the binary and hexadecimal number (they should match). Hexadecimal number A A CE Binary number Decimal value The reason hexadecimal numbers are popular is because hexadecimal numbers provide a shorthand notation for binary numbers. OCTAL NUMBERS An octal digit can takes between and 7. This is another common number system in computers is base8 (octal). The conversion between base8 and base resembles that of converting between base6 and base. Here, we group binary numbers in 3bit groups: BINARY TO OCTAL Binary: octal: 3 5 Then: = 35 8 binary dec oct Verification: = = = = 93 OCTAL TO BINARY = 3 8 = DO NOT discard these zeros when concatening! Instructor: Daniel Llamocca
11 ECE78: Digital Logic Design Fall 6 APPLICATIONS OF BINARY AND HEXADECIMAL REPRESENTATIONS INTERNET PROTOCOL ADDRESS (IP ADDRESS): Hexadecimal numbers represent a compact way of representing binary numbers. The IP address is defined as a 3bit number, but it is displayed as a concatenation of four decimal values separated by a dot (e.g., ). The following figure shows how a 3bit IP address expressed as a binary number is transformed into the standard IP address notation. IP address (binary): Conversion to hexadecimal: IP address (hex): x8a354c IP address notation: A C Grab pairs of hexadecimal numbers and convert each of them to decimal. The 3bit IP address expressed as binary number is very difficult to read. So, we first convert the 3bit binary number to a hexadecimal number. The IP address expressed as a hexadecimal (x8a354c) is a compact representation of a 3bit IP address. This should suffice. However, it was decided to represent the IP address in a 'humanreadable' notation. In this notation, we grab pairs of hexadecimal numbers and convert each of them individually to decimal numbers. Then we concatenate all the values and separate them by a dot. Important: Note that the IP address notation (decimal numbers) is NOT the decimal value of the binary number. It is rather a series of four decimal values, where each decimal value is obtained by independently converting each two hexadecimal digits to its decimal value. Given that each decimal number in the IP address can be represented by hexadecimal digits (or 8 bits), what is the range (min. value, max. value) of each decimal number in the IP address? With 8 bits, we can represent 8 = 56 numbers from to 55. An IP address represents a unique device connected to the Internet. Given that the IP address has 3 bits (or 8 hexadecimal digits), the how many numbers can be represented (i.e., how many devices can connect to the Internet)? 3 = devices. The number of devices that can be connected to the Internet is huge, but considering the number of Internetcapable devices that exists in the entire world, it is becoming clear that 3 bits is not going to be enough. That is why the Internet Protocol is being currently extended to a new version (IPv6) that uses 8 bits for the addresses. With 8 bits, how many Internetcapable devices can be connected to the Internet? devices REPRESENTING GRAYSCALE PIXELS A grayscale pixel is commonly represented with 8 bits. So, a grayscale pixel value varies between and 55, being the darkest (black) and 55 being the brightest (white). Any value in between represents a shade of gray. 55 MEMORY ADDRESSES The address bus size in processors is usually determined by the number of memory positions it can address. For example, if we have a microprocessor with an address bus of 6 bits, we can handle up to 6 addresses. If the memory content is one byte wide, then the processor can handle up to 6 bytes = 64KB. Here, we use 6 bits per address, or 4 nibbles. The lowest address (in hex) is x and highest address (in hex) is xffff. Address : x : x : xffff 8 bits Instructor: Daniel Llamocca
12 ECE78: Digital Logic Design Fall 6 Examples: A microprocessor can only handle memory addresses from x to x7fff. What is the address bus size? If each memory position is one byte wide, what is the maximum size (in bytes) of the memory that we can connect? 8 bits Address We want to cover all the cases from x to x7fff: The range from x to x7fff is akin to all possible cases with 5 bits. Thus, the address bus size is 5 bits. We can handle 5 bytes = 3KB of memory. : x : x : x7fff A microprocessor can only handle memory addresses from x to x3fff. What is the address bus size? If each memory position is one byte wide, what is the maximum size (in bytes) of the memory that we can connect? 8 bits Address We want to cover all the cases from x to x3fff: : x The range from x to x3fff is akin to all possible cases : x with 4 bits. Thus, the address bus size is 4 bits. We can handle 4 bytes = 6KB of memory. : x3fff A microprocessor has a 4bit address line. We connect a memory chip to the microprocessor. The memory chip addresses are assigned the range x8 to xbfffff. What is the minimum number of bits required to represent addresses in that individual memory chip? If each memory position is one byte wide, what is the memory size (in bytes)? By looking at the binary numbers from x8 to xbfffff, we notice that the addresses in that range require 4 bits. But all those addresses share the same first two MSBs:. Thus, if we were to use only that memory chip, we do not need those bits, and we only need bits. We can handle bytes = 4MB of memory. Address : x8 : x8 : xbfffff A memory has a size of 5KB, where each memory content is 8bits wide. How many bits do we need to address the contents of this memory? Recall that: 5KB = 9 bytes. So we need 9 bits to address the contents of this memory (address bus size = 9 bits) In general, for a memory with N address positions, the number of bits to address those positions is given by: log N 8 bits A bit address line in a microprocessor with an 8bit data bus handles MB ( bytes) of data. We want to connect four 56 KB memory chips to the microprocessor. Provide the address ranges that each memory device will occupy. Address : x : x : x3ffff 8 bits 56KB Each memory chip can handle 56KB of memory. 56KB = 8 bytes, requiring 8 bits for its address. For a bit address: we have 5 hexadecimal digits that go from x to xfffff ( memory positions). We divide the memory positions into 4 contiguous groups, each with 8 memory positions. The figure shows the optimal way of doing so: for each group, the 8 LSBs of the memory addresses correspond to the memory range of a 56 KB memory. And the MSBs of the memory addresses are the same within a group. For a given memory address, we can quickly determine which group it belongs to by looking at its MSBs. : x4 : x4 : x7ffff : x8 : x8 : xbffff : xc : xc : xfffff KB 56KB 56KB Instructor: Daniel Llamocca
13 c 5 = c 4 = c 3 = c = c = c = c 8 = c 7 = c 6 = c 5 = c 4 = c 3 = c = c = c = c = c = c = c 8 = c 7 = c 6 = c 5 = c 4 = c 3 = c = c = c = c = c = c = ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE78: Digital Logic Design Fall 6 UNSIGNED NUMBERS  ADDITION In the example, we add two 8bit numbers using binary representation and hexadecimal representation (this is a shorthand notation). Note that every summation of two digits (binary or hexadecimal) generates a carry when the summation requires more than one digit. Also, note that c is the carry in of the summation. c is usually zero. The last carry (c 8 when n=8) is the carry out of the summation. If it is zero, it means that the summation can be represented with 8 bits. If it is one, it means that the summation requires more than 8 bits (in fact 9 bits); this is called an overflow. In the example, we add two numbers and overflow occurs: an extra bit (in red) is required to correctly represent the summation. x3f = + xb = xf = x3f = + xc = DIGITAL CIRCUIT bit Addition: Addition of a bit with carry in: The circuit that performs this operation is called Half Adder (HA). carry out x y c s Addition of a bit with carry in: The circuit that performs this operation is called Full Adder (). c i carry out c o x + y s x + y c s x y sum x y c i sum + s c o x y + s c 3 F + B F 3 F + C HA x y + s c HA x y + s c s c o nbit Addition: The figure on the right shows a 5bit addition. Using the truth table method, we would need inputs and 6 outputs. This is not practical! Instead, it is better to build a cascade of Full Adders. 5: + : c out c in x 4 x 3 x x x + y 4 y 3 y y y For an nbit addition, the circuit will be: 5: s 4 s 3 s s s x n y n x y x y x y c out c in x n x n x x + y n y n y y c out c n c n c 3 c c c c in s n s n s s Full Adder Design x i y i c i c i+ s i s n s s s x i y i c i s i = x i y i c i + x i y i c i + x i y i c i + x i y i c i s i = (x i y i )c i + (x i y i )c i s i = x i y i c i x i y i c i c i+ = x i y i + x i c i + y i c i 3 Instructor: Daniel Llamocca
14 b 8 = b 7 = b 6 = b 5 = b 4 = b 3 = b = b = b = b = b = b = b 8 = b 7 = b 6 = b 5 = b 4 = b 3 = b = b = b = c = c = c = ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE78: Digital Logic Design Fall 6 ARITHMETIC OVERFLOW: Suppose we have only 4 bits to represent binary numbers: cout= + cout= OVERFLOW!!! + Overflow occurs when an arithmetic operation require more bits than the bits we are using to represent our numbers. For 4 bits, the range is to 5. If the summation is greater than 5, then there is overflow. For n bits, overflow occurs when the sum is greater than n. Also, for unsigned numbers: overflow bit = c out. x n y n x y x y x y c n c n c 3 c c c c in overflow=c out s n To avoid overflow in addition operation, a common technique is to signextend the two summands. For example, if the two summands are 4bits wide, then we add one more bit. So, we use 5 bits to represent our numbers. In the case of unsigned numbers, signextend amounts to zeroextend. In general, if the two summands are nbits wide, the result will have at most n + bits. UNSIGNED NUMBERS  SUBTRACTION s s s cout= + In the example, we subtract two 8bit numbers using the binary and hexadecimal (this is a shorthand notation) representations. A subtraction of two digits (binary or hexadecimal) generates a borrow when the difference is negative. So, we borrow from the next digit so that the difference is positive. Recall that a borrow in a subtraction of two digits is an extra that we need to subtract. Also, note that b is the borrow in of the summation. This is usually zero. The last borrow (b 8 when n=8) is the borrow out of the subtraction. If it is zero, it means that the difference is positive and can be represented with 8 bits. If it is one, it means that the difference is negative and we need to borrow from the next digit. In the example, we subtract two 8bit numbers, the result we have borrows from the next digit. x3a =  xf = xb = x3a =  x75 = 3 A  F B 3 A xc5 = C 5 We can build an nbit subtractor for unsigned numbers using Full Subtractor circuits. In practice, subtraction is better performed in the s complement representation (for signed numbers). x n y n x y x y x y b out b in x n x n x x  y n y n y y b out b n b n FS b 3 FS b FS b FS b b in d n d n d d Full Subtractor Design x i y i b i b i+ d i d n d d d x i y i b i d i = x i y i b i + x i y i b i + x i y i b i + x i y i b i d i = (x i y i )b i + (x i y i )b i d i = x i y i b i x i y i b i b i+ = x i y i + x i b i + y i b i 4 Instructor: Daniel Llamocca
15 ECE78: Digital Logic Design Fall 6 SIGNED INTEGER NUMBERS For an nbit number b n b n b b, there exist three common signed representations: signandmagnitude, s complement, and s complement. In these three representations, the MSB always tells us whether the number is positive (MSB=) or negative (MSB=). These representations allow us to represent both positive and negative numbers. SIGNANDMAGNITUDE (SM): Here, the sign and the magnitude (value) are represented separately. The MSB only represents the sign and the remaining n bits the magnitude. Example (n=4): = +6 = 6 'S COMPLEMENT (C): Here, if the MSB=, the number is positive and the remaining n bits represent the magnitude. If the MSB=, the number is negative and the remaining n bits do not represent the magnitude. To invert the sign of a number in s complement representation, we apply the s complement operation to the number, which consists of inverting all the bits. Let B = b n b b be a number represented in s complement. Let K = k n k k represent B. We get K by applying the s complement operation to B. K is also called the s complement of B (and viceversa). Definition: The s complement of B is defined as K = ( n ) B, n = # of bits (including sign bit), where K = n i= k i i and B = n i= b i i. Note that K and B are treated as unsigned numbers in this formula. And ( n ) is the largest nbit unsigned number. We can then show that the s complement operation amounts to inverting all the bits: n k i i = ( n ) b i i (k i + b i ) i i= n i= n i= = n k i + b i =, i k i = b i Example: Given B = = 9 in s complement, get the s complement representation of 9 using the formula: K = ( n ) B = ( 5 ) 9 = =. Recall that the formula treats K and B as unsigned integers. So, K = in unsigned representation, and K = 9 in s complement representation. It is much simpler to just invert each bit! With n bits, we can represent n numbers from n + to n. When using the 's complement representation, it is mandatory to specify how many bits we are using. Examples: +6= 6=, +5= 5=, +7= 7=. If 6=, we get +6 by applying the s complement operation to +6 = Get the s complement representation of 8: This is a positive number, thus the MSB=. The remaining n bits represent the magnitude. The magnitude is represented with a minimum number of 4 bits as 8=. Thus, using a minimum number of 5 bits, the number 8 in s complement representation is 8=. What is the decimal value of? We first apply the s complement operation to, which results in (+3). Thus =3. What is the s complement representation of 4? We know that +4=. To get 4, we apply the s complement operation to, which results in. Thus =4. 'S COMPLEMENT (C): Here, if the MSB=, the remaining n bits represent the magnitude. If the MSB=, the number is negative and the remaining n bits do not represent the magnitude. To invert the sign of a number in s complement representation, we apply the s complement operation to the number, which consists on inverting all the bits and add. Let B = b n b b be a number represented in s complement. Let K = k n k k represent B. We get K by applying the s complement operation to B. K is also called the s complement of B (and viceversa). Definition: The s complement of B is defined as K = ( n ) B +, n = # of bits (including sign bit), where K = n i= k i i and B = n i= b i i. Note that K and B are treated as unsigned numbers in this formula. We can see that we can first get the term ( n ) B by inverting all the bits; then we add to complete the equation. Example: Given = = 9 in s complement, get the s complement representation of 9 using the formula: K = ( n ) B + = ( 5 ) 9 + = 3 =. Recall that the formula treats K and B as unsigned integers. So, K = 3 in unsigned representation, and K = 9 in s complement representation. It is much simpler to just invert each bit (i.e., apply s complement operation) and then add! With n bits, we can represent n numbers from n to n. When using the 's complement representation, it is mandatory to specify how many bits we are using. 5 Instructor: Daniel Llamocca
16 ECE78: Digital Logic Design Fall 6 Examples: +6= 6=, +5= 5=, +7= 7=. If 6=, we get +6 by applying the s complement operation to +6 = Represent in s complement: This is a positive number, MSB=. The remaining n bits represent the magnitude. We can get the magnitude with a minimum 4 bits: =. Thus, using a minimum of 5 bits, the number in s complement representation is =. What is the decimal value of? We first apply the s complement operation (or take the s complement) to, which results in (+3). Thus =3. What is the s complement representation of 4? We know that +4=. To get 4, we apply the s complement operation to, which results in. Thus =4. Getting the decimal value of a number in 's complement representation: If the number B is positive, then MSB=: b n =. n i= n i= n B = b i i = b n n + b i i = b i i (a) If the number B is negative, b n = (MSB=). If we take the s complement of B, we get K (which is a positive number). In s complement representation, K represents B. Using K = n B (K and B are treated as unsigned numbers): n k i i = n b i i We want a to express K in terms of b i, since the integer value K is the actual integer value of B. n i= K = k i i = b i i n = b n n + b i i n = n (b n ) + b i i i= n i= n n i= n B = K = n ( ) + b i i = n + b i i (b) Using (a) and (b), the formula for the decimal value of B (either positive or negative) is: i= n i= B = b n n + b i i Examples: = = = = 8 SUMMARY The following table summarizes the signed representations for a 4bit number: n=4: SIGNED REPRESENTATION b 3b b b Signandmagnitude s complement s complement Range for n bits: [ ( n ), n ] [ ( n ), n ] [ n, n ] C and C are representations of signed numbers. C and C represent both negative and positive numbers. Do not confuse the C and C representations with the C and C operations. Note that the signandmagnitude and the s complement representations have a redundant representation for zero. This is not the case in s complement, which can represent an extra number. In C, the number 8 can be represented with 4 bits: 8=. To obtain +8, we apply the C operation to, which results in. But cannot be a positive number. This means that we require 5 bits to represent +8=. i= i= n i= n i= 6 Instructor: Daniel Llamocca
17 ECE78: Digital Logic Design Fall 6 SIGN EXTENSION UNSIGNED NUMBERS: Here, if we want to use more bits, we just append zeros to the left. Example: = with 4 bits. If we want to use 6 bits, then =. SIGNED NUMBERS: Signandmagnitude: The MSB only represents the sign. If we want to use more bits, we append zeros to the left. The leftmost bit is always the sign. Example:  = with 5 bits. If we want to use 7 bits, then  =. s complement (also applies to s complement): In many circumstances, we might want to represent numbers in 's complement with a fixed number of bits. For example, the following two numbers require a minimum of 5 bits: = = 9 = = +5 What if we wanted to use 8 bits to represent them? In s complement, we need to signextend: If the number is positive, we append zeros to the left. If the number is negative, we attach ones to the left. In the example, note how we added three bits to the left in each case: = = 9 = = +5 Demonstration of signextension in s complement: To increase the number of bits for representing a number, we append the MSB to the left as many times as needed: b n b n b b n b n b n b n b Examples: = = + = 5 = = = = We can think of the signextended number as an mbit number, where m > n: b n b n b n b n b = b m b n b n b n b, where: b i = b n, i = n, n +,, m We need to demonstrate that b n b n b represents the same decimal number as b n b n b n b n b, i.e., that the signextension is correct for any m > n. We need that: b m b n b n b n b = b n b n b n b n b = b n b n b Using the formula for 's complement numbers: m m b m + i b i = n b n + i b i i= m i=n m n i= n i= m b m + i b i + i b i = n b n + i b i m b m + i b i = n b n m b n + b n Recall: r i l i=k i = n b n, i=n = rk r l+ r, r i l i=k n i= = k l+ = l+ k m i=n Then: m b n + b n ( m n ) = n b n m b n + m b n n b n = n b n n b n = n b n SIGNED NUMBERS ADDITION AND SUBTRACTION We will use the s complement representation for signed numbers. The advantage of the s complement representation is that the summation can be carried out using the same circuitry as that of the unsigned summation. Here the operands can either be positive or negative. We show addition examples of 4bit signed numbers. Note that the carry out bit does not necessarily indicate overflow. In some cases, the carry out must be ignored, otherwise the result is incorrect. +5 = + + = 5 = + + = +5 = +  = 5 = +  = +7 = 3 = +3 = 7 = cout= cout= cout= cout= 7 Instructor: Daniel Llamocca
18 c 5 = c 4 = c 3 = c = c = c = c 5 = c 4 = c 3 = c = c = c = c 4 = c 3 = c = c = c = c 8 = c 7 = c 6 = c 5 = c 4 = c 3 = c = c = c = c 8 = c 7 = c 6 = c 5 = c 4 = c 3 = c = c = c = c 8 = c 7 = c 6 = c 5 = c 4 = c 3 = c = c = c = c 8 = c 7 = c 6 = c 5 = c 4 = c 3 = c = c = c = ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE78: Digital Logic Design Fall 6 Now, we show addition examples of two 8bit signed numbers. The carry out c 8 is not enough to determine overflow. Here, if c 8 c 7 there is overflow. If c 8=c 7, no overflow and we can ignore c 8. Thus, the overflow bit is equal to c 8 XOR c 7. Note that overflow happens when the summation falls outside the s complement range for 8 bits: [ 7, 7 ]. +9 = = +7 = overflow = c 8 c 7 = > overflow! +7 [ 7, 7 ] > overflow! 9 = = 7 = overflow = c 8 c 7 = > overflow! 7 [ 7, 7 ] > overflow! +9 = = +4 = overflow = c 8 c 7 = > no overflow +4 [ 7, 7 ] > no overflow 9 = = 4 = overflow = c 8 c 7 = > no overflow 4 [ 7, 7 ] > no overflow In general, for an nbit number, overflow occurs when the summation falls outside the range [ n, n ]. The overflow bit can quickly be computed as overflow = c n c n. Also, c out = c n. DIGITAL CIRCUIT The figure depicts a nbit adder for s complement numbers: x n y n x y x y x y overflow c out c n c n c 3 c c c c in s n Subtraction: Note that A B = A + C(B). To subtract two numbers represented in s complement arithmetic, we first apply the s complement operation to B (the subtrahend), and then add the numbers. So, in s complement arithmetic, subtraction is actually an addition of two numbers. The digital circuit for s complement subtraction is based on the adder. We account for the s complement operation for the subtrahend by inverting every bit in the subtrahend and by making the c in bit equal to. x n y n s x y s x y s 73 = 7 + (3): +3= 3= cout = overflow = x y +7 = + 3 = +4 = overflow c out c n c n c 3 c c c c in = s n To avoid overflow when adding/subtracting, a common technique is to signextend the two summands. For example, for two 4bits summands, we add an extra bit; so, we use 5 bits to represent our numbers. In general, if the two summands are nbits wide, the result will have at most n + bits. Recall that if there is no overflow in a summation result, the carry out bit must not be part of the result. s s +7 = + + = +9 = s 7 = +  = 9 = 8 Instructor: Daniel Llamocca
19 ECE78: Digital Logic Design Fall 6 Adder/Subtractor Unit for 's complement numbers: We can combine the adder and subtractor in a single circuit if we are willing to give up the input c in. x n y n x y x y x y add/sub add = sub = overflow c out c n c n c 3 c c c s n s s s add/sub y i f add/sub y i f 9 Instructor: Daniel Llamocca
20 ECE78: Digital Logic Design Fall 6 MULTIPLICATION OF INTEGER NUMBERS ARRAY MULTIPLIER FOR UNSIGNED NUMBERS A straightforward implementation of the multiplication operation is depicted in the figure: at every diagonal of the circuit, we add up all terms in a column of the multiplication. The figure shows the process and circuit for multiplying two unsigned numbers of 4 bits. x cin y a 3 a a a x b 3 b b b FULL ADDER cout s a 3 b a b a b a b a 3 b a b a b a b a 3 b a b a b a b a 3 b 3 a b 3 a b 3 a b 3 p 7 p 6 p 5 p 4 p 3 p p p b(3) b() b() b() a() a b 3 a b a b a b m 3 m m m s 3 s s s a() c c c a b 3 a b a b a b m 3 m m m p() s 3 s s c c c s a() a b 3 a b a b a b m 3 m m m p() s 3 s s c c c s a(3) a 3 b 3 a 3 b a 3 b a 3 b m 33 m 3 m 3 m 3 p() s 33 s 3 s 3 c 3 c 3 c 3 s 3 m 43 m 4 m 4 m 4 p(3) p(7) p(6) p(5) p(4) Instructor: Daniel Llamocca
21 ECE78: Digital Logic Design Fall 6 MULTIPLICATION OF SIGNED NUMBERS A straightforward implementation consists of checking the sign of the multiplicand and multiplier. If one or both are negative, we change the sign by applying the s complement operation. This way, we are left with unsigned multiplication. As for the final output: if only one of the inputs was negative, then we modify the sign of the output. Otherwise, the result of the unsigned multiplication is the final output. x x x x x x x Note: If one of the inputs is n, then the s complement of it is n, which requires n + bits. Here, we are allowed to use only n bits; in other words, we do not have to change its sign. This will not affect the final result since if we were to use n + bits for n, the MSB=, which implies that the last row is full of zeros. x x x x x x Final output: It requires n bits. Note that it is only because of the multiplication of n by n that we require those n bits (in s complement representation) Instructor: Daniel Llamocca
22 ECE78: Digital Logic Design Fall 6 BINARY CODES We know that with n bits, we can represent n numbers, from to n. This is a commonly used range. However, with n bits, we can also represent n numbers in any range. Moreover, with n bits we can represent n different symbols. For example, in 4bit color, each color is represented by 4 bits, providing 4 distinct colors. Each color is said to have a binary code. N = 5 symbols. With bits, only 4 symbols can be represented. With 3 bits, 8 symbols can be represented. Thus, the number of bits required is n = 3 = log 5 = log 8. Note that 8 is the power of closest to N=5 that is greater than or equal to 5. In general, if we have N symbols to represent, the number of bits required is given by log N. For example: Minimum number of bits to represent 7, colors: Number of bits: log 7 = 7 bits. Minimum number of bits to represent numbers between 5, and 9,96: There are 9,965,+=497. Then, number of bits: log 497 = 3 bits. 7bit USASCII characterencoding scheme: Each character is represented by 7 bits. Thus, the number of characters that can be represented is given by 7 = 8. Each character is said to have a binary code. Unicode: This code can represent more than, characters and attempts to cover all world s scripts. A common character encoding is UTF6, which uses pair of 6bit units: For most purposes, a 6 bit unit suffices ( 6 = characters): (Greek theta symbol) = 3D (Greek capital letter Omega): 3A9 Ж (Cyrillic capital letter zhe): 46 Instructor: Daniel Llamocca
23 ECE78: Digital Logic Design Fall 6 BCD Code: In this coding scheme, decimal numbers are represented in binary form by independently encoding each decimal digit in binary form. Each digit requires 4 bits. Note that only values from are 9 are represented here. This is a very useful code for input devices (e.g.: keypad). But it is not a coding scheme suitable for arithmetic operations. Also, notice that the binary numbers () to (5) are not used. Only out of 6 values are used to encode each decimal digit. Examples: Decimal number 47: This decimal number can be represented as a binary number:. In BCD format, this would be: Decimal number 58: This decimal number can be represented as a binary number:. In BCD format, the binary representation would be: The BCD code is not the same as the binary number! BCD decimal # There exist many other binary codes (e.g., reflective gray code, code, outof5 code) to represent decimal numbers. Usually, each of them is tailored to an specific application. REFLECTIVE GRAY CODE: Decimal g g Number b b b g g g g 3 g g g b n b n b b g n g n g g g n g n g g b n b n b b Application: Measuring angular position with 4bit RGC. 4 beams are emitted along an axis. When a light beam passes (transparent spots, represented as whites), we get a logical, otherwise. The RGC encoding makes that between areas only one bit changes, thereby reducing the possibility of an incorrect reading (especially when the beam between adjacent areas). For example: from to only one bit flips. If we used to, two bits would flip: that would be prone to more errors, especially when the beams are close to the line where the two areas meet EMITTER RECEPTOR g g g g 3 Angle g 3 g g g 3 Instructor: Daniel Llamocca
24 ECE78: Digital Logic Design Fall 6 INTRODUCTION TO FIXEDPOINT ARITHMETIC We have been representing positive integer numbers. But what if we wanted to represent numbers with fractional parts? Fixedpoint arithmetic: Binary representation of positive decimal numbers with fractional parts. Given the following binary number: Formula to convert it to decimal: n (b n b n b b. b b b k ) D = b i i = b n n + b n n + + b + b + b + b + b k k i= k Conversion from binary to hexadecimal (or octal): (unsigned numbers) Binary:.. octal: 5. 6 Binary:.. Example: (unsigned number). = =.65 Example: Now, what if we have a decimal number with fractional part? What we do is we divide the integer part and the fractional part. We obtain the binary representation of the integer part using what we know. As for the fractional part, what we do is successive multiplications by, the resulting integer parts resulting is the result. base.65 MSB.65x =.5 = +.5 hexadecimal: base???? 5 base.7. A 8 MSB.7x =.4 = +.4 base????.5x =.5 = +.5.5x = = +.4x =.8 = +.8.8x =.6 = +.6. stop here!.6x =. = +..x =.4 = +.4.4x =.8 = +.8. Example (signed number): Convert to the s complement representation. First, we get the binary representation of , and then apply the s complement operation to that result. 379 =. In s complement: 379 =,.875 =.. Then: =.. This is the s complement representation of Finally, we get by getting the s complement of the previous result: =. = xe84.c8 (to convert to hexadecimal, we append zeros to the LSB and signextend the MSB) 4 Instructor: Daniel Llamocca
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE2700: Digital Logic Design Winter Notes  Unit 4. hundreds.
UNSIGNED INTEGER NUMBERS Notes  Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digitbydigit representation of a positive integer number (powers of ): DIGIT 3 4 5 6 7 8 9 Number:
More informationDEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, THE UNIVERSITY OF NEW MEXICO ECE238L: Computer Logic Design Fall 2013.
ECE8L: Computer Logic Design Fall Notes  Chapter BINARY NUMBER CONVERSIONS DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digitbdigit representation of a positive integer number (powers
More informationSolutions  Homework 2 (Due date: October 4 5:30 pm) Presentation and clarity are very important! Show your procedure!
Solutions  Homework 2 (Due date: October 4 th @ 5:30 pm) Presentation and clarity are very important! Show your procedure! PROBLEM 1 (28 PTS) a) What is the minimum number of bits required to represent:
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This twovalued number system is called binary. As presented earlier, there are many
More informationDIGITAL SYSTEM DESIGN
DIGITAL SYSTEM DESIGN UNIT I: Introduction to Number Systems and Boolean Algebra Digital and Analog Basic Concepts, Some history of Digital SystemsIntroduction to number systems, Binary numbers, Number
More informationSolutions  Homework 2 (Due date: February 5 5:30 pm) Presentation and clarity are very important! Show your procedure!
Solutions  Homework (Due date: Februar 5 th @ 5: pm) Presentation and clarit are ver important! Show our procedure! PROBLEM ( PTS) In these problems, ou MUST show our conversion procedure. a) Convert
More informationBinary Addition. Add the binary numbers and and show the equivalent decimal addition.
Binary Addition The rules for binary addition are 0 + 0 = 0 Sum = 0, carry = 0 0 + 1 = 0 Sum = 1, carry = 0 1 + 0 = 0 Sum = 1, carry = 0 1 + 1 = 10 Sum = 0, carry = 1 When an input carry = 1 due to a previous
More informationEE292: Fundamentals of ECE
EE292: Fundamentals of ECE Fall 2012 TTh 10:0011:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic
More informationMicrocomputers. Outline. Number Systems and Digital Logic Review
Microcomputers Number Systems and Digital Logic Review Lecture 11 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded
More informationDIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM
COURSE / CODE DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) NUMBER SYSTEM A considerable subset of digital systems deals with arithmetic operations. To understand the
More informationChapter 2 Number System
Chapter 2 Number System Embedded Systems with ARM CortextM Updated: Tuesday, January 16, 2018 What you should know.. Before coming to this class Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR
UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error
More informationNumber representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Basetwo, or
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationLecture 2: Number Systems
Lecture 2: Number Systems Syed M. Mahmud, Ph.D ECE Department Wayne State University Original Source: Prof. Russell Tessier of University of Massachusetts Aby George of Wayne State University Contents
More informationChapter 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 addersubtractors Signed binary
More informationDecimal & Binary Representation Systems. Decimal & Binary Representation Systems
Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001
More informationNumber Systems Base r
King Fahd University of Petroleum & Minerals Computer Engineering Dept COE 2 Fundamentals of Computer Engineering Term 22 Dr. Ashraf S. Hasan Mahmoud Rm 2244 Ext. 724 Email: ashraf@ccse.kfupm.edu.sa 3/7/23
More informationChapter 1 Review of Number Systems
1.1 Introduction Chapter 1 Review of Number Systems Before the inception of digital computers, the only number system that was in common use is the decimal number system which has a total of 10 digits
More informationNumber Systems CHAPTER Positional Number Systems
CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of
More informationChapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.
Chapter 3: Number Systems and Codes Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc., 5 th edition Decimal System The radix or base of a number system determines
More informationD I G I T A L C I R C U I T S E E
D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,
More informationDIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS
C H A P T E R 6 DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS OUTLINE 6 Binary Addition 62 Representing Signed Numbers 63 Addition in the 2 s Complement System 64 Subtraction in the 2 s Complement
More informationLogic Circuits I ECE 1411 Thursday 4:45pm7:20pm. Nathan Pihlstrom.
Logic Circuits I ECE 1411 Thursday 4:45pm7:20pm Nathan Pihlstrom www.uccs.edu/~npihlstr My Background B.S.E.E. from Colorado State University M.S.E.E. from Colorado State University M.B.A. from UCCS Ford
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationData Representation 1
1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation
More informationDigital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.
Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we
More informationDigital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals CHAPTER 2 Number Systems, Operations, and Codes Decimal Numbers The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The decimal numbering system has a base of
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014
Problem 1 (4 parts, 21 points) Encoders and Pass Gates Part A (8 points) Suppose the circuit below has the following input priority: I 1 > I 3 > I 0 > I 2. Complete the truth table by filling in the input
More informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
More informationSlide Set 1. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary
Slide Set 1 for ENEL 353 Fall 2017 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2017 SN s ENEL 353 Fall 2017 Slide Set 1 slide
More informationBinary Codes. Dr. Mudathir A. Fagiri
Binary Codes Dr. Mudathir A. Fagiri Binary System The following are some of the technical terms used in binary system: Bit: It is the smallest unit of information used in a computer system. It can either
More informationComputer Organization
Computer Organization Register Transfer Logic Number System Department of Computer Science Missouri University of Science & Technology hurson@mst.edu 1 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5,
More informationChapter 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 informationEE 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 lowlevel software that is
More informationChapter 2 Bits, Data Types, and Operations
Chapter 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 two
More informationNumbering systems. Dr Abu Arqoub
Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another
More informationModule 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 information10.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 informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationCS & IT Conversions. Magnitude 10,000 1,
CS & IT Conversions There are several number systems that you will use when working with computers. These include decimal, binary, octal, and hexadecimal. Knowing how to convert between these number systems
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 9
CO20320241 Computer Architecture and Programming Languages CAPL Lecture 9 Dr. Kinga Lipskoch Fall 2017 A Fourbit Number Circle CAPL Fall 2017 2 / 38 Functional Parts of an ALU CAPL Fall 2017 3 / 38 Addition
More informationMACHINE LEVEL REPRESENTATION OF DATA
MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems
More information1010 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.21.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 information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the highorder bit
More informationData Representation COE 301. Computer Organization Prof. Muhamed Mudawar
Data Representation COE 30 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Positional Number
More informationInf2C  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 informationDigital 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 informationChapter 10 Binary Arithmetics
27..27 Chapter Binary Arithmetics Dr.Ing. Stefan Werner Table of content Chapter : Switching Algebra Chapter 2: Logical Levels, Timing & Delays Chapter 3: KarnaughVeitchMaps Chapter 4: Combinational
More informationCHAPTER V NUMBER SYSTEMS AND ARITHMETIC
CHAPTER V1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V2 NUMBER SYSTEMS RADIXR REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(
More informationNumber Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris HuiRu Jiang Spring 2010
Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER
More informationDigital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand
Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about
More informationFinal Labs and Tutors
ICT106 Fundamentals of Computer Systems  Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.42.9 and 3.63.8 Final Labs and Tutors Venue and time South
More informationCourse 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 informationBinary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.
Binary Arithmetic Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. MIT 6.004 Fall 2018 Reminder: Encoding Positive Integers Bit i in a binary representation (in righttoleft order)
More informationLecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture
Points ddressed in this Lecture Lecture 6: Signed Numbers rithmetic Circuits Professor Peter Cheung Department of EEE, Imperial College London (Floyd 2.52.7, 6.16.7) (Tocci 6.16.11, 9.19.2, 9.4) Representing
More informationExcerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997
Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since tenfingered humans are addicted to the decimal system, and since computers
More informationPositional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal
Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal  use the definition of a number in a positional number system with base  evaluate the definition formula using
More informationChapter 4: Computer Codes. In this chapter you will learn about:
Ref. Page Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence Ref. Page
More informationIT 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 informationA 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 informationMs Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES. 1.1 Introduction
Ms Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES Structure 2.1 Introduction 2.2 Objectives 2.3 Binary Numbers 2.3.1 BinarytoDecimal conversion 2.3.2 DecimaltoBinary Conversion 2.4 Octal Numbers
More informationBasic Definition INTEGER DATA. Unsigned Binary and BinaryCoded Decimal. BCD: BinaryCoded Decimal
Basic Definition REPRESENTING INTEGER DATA Englander Ch. 4 An integer is a number which has no fractional part. Examples: 2022213 0 1 514 323434565232 Unsigned and Coded Decimal BCD: Coded Decimal
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors
More informationIntroduction to Computer Science103. Midterm
Introduction to Computer Science103 Midterm 1. Convert the following hexadecimal and octal numbers to decimal without using a calculator, showing your work. (6%) a. (ABC.D) 16 2748.8125 b. (411) 8 265
More informationWhat Is It? Instruction Register Address Register Data Register
What Is It? Consider the following set of 32 binary digits, written in blocks of four so that the example is not impossible to read. 0010 0110 0100 1100 1101 1001 1011 1111 How do we interpret this sequence
More informationECE 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 informationPrinciples of Computer Architecture. Chapter 3: Arithmetic
31 Chapter 3  Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 32 Chapter 3  Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition
More informationBinary Adders: Half Adders and Full Adders
Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationNumber 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 information1.1. INTRODUCTION 1.2. NUMBER SYSTEMS
Chapter 1. 1.1. INTRODUCTION Digital computers have brought about the information age that we live in today. Computers are important tools because they can locate and process enormous amounts of information
More informationDigital Systems. John SUM Institute of Technology Management National Chung Hsing University Taichung, ROC. December 6, 2012
Digital Systems John SUM Institute of Technology Management National Chung Hsing University Taichung, ROC December 6, 2012 Contents 1 Logic Gates 3 1.1 Logic Gate............................. 3 1.2 Truth
More informationTOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion
Topic : Introduction To computers Faculty : Department of commerce and Management BY: Prof.Meeta R. Gujarathi E mail: meetargujarathi@gmail.com Octal Hexadecimal Number conversion TOPICS Other Number Systems
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
More informationDigital Systems and Binary Numbers
Digital Systems and Binary Numbers Prof. Wangrok Oh Dept. of Information Communications Eng. Chungnam National University Prof. Wangrok Oh(CNU) 1 / 51 Overview 1 Course Summary 2 Binary Numbers 3 NumberBase
More informationDLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR
DLD UNIT III Combinational Circuits (CC), Analysis procedure, Design Procedure, Combinational circuit for different code converters and other problems, Binary Adder Subtractor, Decimal Adder, Binary Multiplier,
More informationMoodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.I) Introduction to Number System
Moodle 1 WILLINGDON COLLEGE SANGLI ELECTRONICS (B. Sc.I) Introduction to Number System E L E C T R O N I C S Introduction to Number System and Codes Moodle developed By Dr. S. R. Kumbhar Department of
More information1. 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 informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University How do we represent data in a computer?!
More informationECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012
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 informationInternal Data Representation
Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information
More informationCS 261 Fall Binary Information (convert to hex) Mike Lam, Professor
CS 261 Fall 2018 Mike Lam, Professor 3735928559 (convert to hex) Binary Information Binary information Topics Base conversions (bin/dec/hex) Data sizes Byte ordering Character and program encodings Bitwise
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationChapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude
Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the
More informationAgenda EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 1: Introduction. Go over the syllabus 3/31/2010
// EE : INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN Lecture : Introduction /9/ Avinash Kodi, kodi@ohio.edu Agenda Go over the syllabus Introduction ti to Digital it Systems // Why Digital Systems?
More informationplc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums
plc numbers  3. 3. NUMBERS AND DATA Topics: Number bases; binary, octal,, hexa Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;
More informationChapter 4 Arithmetic Functions
Logic and Computer Design Fundamentals Chapter 4 Arithmetic Functions Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Overview Iterative combinational
More informationECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION
ECOM 2325 Computer Organization and Assembly Language Instructor: Ruba A.Salamah INTRODUCTION Overview Welcome to ECOM 2325 Assembly, Machine, and HighLevel Languages Assembly Language Programming Tools
More informationWorld Inside a Computer is Binary
C Programming 1 Representation of int data World Inside a Computer is Binary C Programming 2 Decimal Number System Basic symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Radix10 positional number system. The radix
More informationRead this before starting!
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 1 for Spring Semester,
More informationComputer 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 informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified by Chris Wilcox, S. Rajopadhye Colorado State University How do we represent data
More information