660 likes | 865 Views
Logic Design. Number Systems Operation. 1- Decimal Numbers. 2- Binary Numbers. 3- Octal Numbers. 4- Hexadecimal Numbers. Decimal Numbers. In the decimal number system each of the ten digits (10 digits), 0 through 9 (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9).
E N D
Number Systems Operation 1- Decimal Numbers. 2- Binary Numbers. 3- Octal Numbers. 4- Hexadecimal Numbers.
Decimal Numbers • In the decimal number system each of the ten digits (10 digits), 0 through 9 (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). • Decimal weight 10 4 10 3 10 2 101 10 0 . 10 -1 10 -2 10 -3 • i.e (345) 10 • 300+40+5=102 *3+101 *4+100 *5=345= (345) 10
Decimal Numbers • i.e (23.5) 10 • 2*101 + 3*100 + 5*10 -1 = 20+3+0.5=23.5 Where 10 0 =1 • Any number to power 0 equal 1
Binary Numbers The binary number system its two digits a base - two system. The two binary digits (bits) are 1 and 0 (1,0). Binary weight 23 22 21 2 0 Weight value 8 4 2 1
Binary – to – Decimal Conversion • Binary number 1101101 • 1 1 0 1 1 0 1 • 2 6 2 5 2 4 2 3 2 2 2 1 2 0 • = 26 *1 + 25 * 1 + 24 *0 + 23 *1 + 22 *1 + 21*0+20*1 • = 64+32+0+8+4+0+1=96+13=109 (109) 10
Decimal – to – Binary Conversion • Example: • Number (58) 10 • 2 58 • 2 29 0 • 2 14 1 • 2 7 0 • 2 3 1 • 2 1 1 • 0 1 (58) 10 = (111010) 2
Octal Numbers • The octal number system is composed of eight digits, which are 0, 1, 2, 3, 4, 5, 6, and 7 • To count above 7, begin another column and start over: 10, 11, 12, 13, 14, 15, 16, and 17. 20, 21, 22, 23, 24, 25, 26, and 27. 30, 31, … … … … 37.
Octal – to – Decimal Conversion Weight … … 83 8 2 8 1 8 0 Example: (2374) 8= 2*83 +3*82 +7*81 +4*80 = 2*512+3*64+7*8+4*1 = 1024+192+56+4 = (1276) 10
Decimal – to – Octal Conversion (359) 10 8 359 8 44 7 8 5 4 0 5 (359) 10 = (547) 8
Octal – to – Binary Conversion • Octal digit can be represented by a 3-bit binary number. • Octal digit binary 0 1 2 3 4 5 6 7 000 001 010 011 100 101 110 111 • Examples: (25) 8 (2 5) 8 (010 101) (010101) 8
Binary – to – Octal Conversion • Conversion binary number to octal number is start with right – most group of three bits and moving from right to left. • Examples: (110101) 2 110101 (6 5) 8 (65) 8
Hexadecimal Numbers The hexadecimal number system has a base of sixteen; it is composed of 16 digits and alphabetic character.
Binary – to – Hexadecimal conversion • 4-bit groups, starting at the right-most bit. • Example: (1100101001010111)2 1100101001010111 C A 5 7 (1100101001010111)2 = (CA57) 16
Hexadecimal – to – Binary Conversion • Example: (10A4) 16 1 0 A 4 0001 0000 1010 0100 (10A4) 16= (1000010100100) 2
Example • Convert the number 235 from decimal to binary 2 235 2 117 1 2 58 1 2 29 0 2 14 1 2 7 0 2 3 1 2 1 1 2 0 1 (235) 10 = (11101011) 2
Example • Convert the number 412 from octal to binary 4 12 100001010 (412) 8 = (100001010) 2
Example • Convert the number 11100011 from binary to octal 011100011 3 4 3 (11100011) 2 = (343) 8
Example • Convert 1000101 from binary to decimal = 26 *1 + 25 * 0 + 24 *0 + 23 *0 + 22 *1 + 21*0+20*1 = 64 + 0 + 0 + 0 + 4 + 0 + 1 = 69 (1000101) 2 = (69) 10
Example • Convert 1110110101 from binary to hexadecimal • 001110110101 • 3 B 5 • (1110110101) 2 = (3B5) 16
Example • Convert 671 from octal to hexadecimal • 5 7 1 • 101111001 • 000101111001 1 7 8 (571) 8 = (178) 10
Example Convert 2CA from hexadecimal to Octal 2 C A 001011001010 001011001010 1 3 1 2 (2CA) 16 = (1312) 8
Homework 1 • Convert 246 from octal to decimal. Hint: you can divided the number to 8 until you get the number zero or you can convert the number to binary and from binary to decimal
Homework 2 Convert E9B from hexadecimal to decimal. Hint or you can convert the number to binary and from binary to decimal
Math Operations 1. Adding Operation . 2. subtraction operation. Note: multiplication is a repeated adding operation and division operation is a repeated subtraction operation
Adding in Octal Numbering System 1 1 Carry ( 5 6 4 ) 8 ( 4 2 7 ) 8 • (1 2 1 3 ) 8 1 Carry ( 3 7 1 ) 8 ( 3 1 2 ) 8 ( 7 0 3 ) 8 ( 2 3 5 ) 8 ( 4 3 2 ) 8 ( 6 6 7 ) 8
Adding in Hexadecimal Numbering System ( 1 7 4 ) 16 ( A 5 5 ) 16 ( B C 9 ) 16 1 1 Carry ( F 8 B ) 16 ( 2 8 7 ) 16 (1 2 1 2 ) 16 1 Carry ( 4 5 A ) 16 ( 6 E 2 ) 16 ( B 3 C ) 16
Adding in Binary Numbering System 1111 1 Carry ( 110111) 2 ( 101111) 2 (1100110 ) 2 ( 1001) 2 ( 0100) 2 (1101 ) 2 11 Carry ( 100110) 2 ( 010011) 2 ( 1110 01 ) 2
Subtraction in Octal Numbering System 312 ( 4 2 6 ) 8 ( 2 6 3 ) 8 ( 1 4 3 ) 8 7 51015 ( 6 0 5 ) 8 ( 3 6 7 ) 8 ( 2 1 6 ) 8 ( 6 4 5 ) 8 ( 1 3 2 ) 8 ( 5 1 3 ) 8
Subtraction in Hexadecimal Numbering System C 13 ( F D 3 ) 16 ( A 6 8 ) 16 ( 5 6 B ) 16 17 8 7 11 ( 9 8 1 ) 16 ( 4 A 4 ) 16 ( 4 D D ) 16 ( F 9 5 ) 16 ( B 6 4 ) 16 ( 4 3 1 ) 16
Subtraction in Binary Numbering System 0 10 ( 11001) 2 ( 10101 )2 (00100)2 1 0 1010 ( 11001) 2 ( 10110 )2 (00011)2 ( 110111)2 ( 100100)2 ( 010011 )2
Subtraction in Binary Numbering System • Subtraction using 1’s • M= 01010100 • N= 01000100 • Find = M-N • Converting N to 1’s Complement N=10111011 • Convert the subtraction operation to adding. • Is there carry in extra bit, the carry will be added to the number. ( 01010100)2 ( 10111011)2 ( 100001111 )2 1 ( 00010000 ) 2
Subtraction in Binary Numbering System M= 01010100 N= 01000100 Find = N-M ( 01000100)2 ( 10101011)2 (11101111)2 No Carry
Subtraction in Binary Numbering System ( 1001)2 ( 1010)2 ( 10011 )2 The carry discarded it is mean it is positive number Subtraction using 2’s • M=1001 • N=0110 • Find = M-N • Converting N to 2’s complement • The 1’s complement of 0110 = 1001 • Adding 1 to 1001 = 1010
Subtraction in Binary Numbering System ( 0110)2 ( 0111)2 ( 01101 )2 There is no carry bit, this means it is negative number to see the number convert the result to 2’complent. Subtraction using 2’s • M=1001 • N=0110 • Find = N-M • Converting M to 2’s complement • The 1’s complement of 1001 = 0110 • Adding 1 to 0110 = 0111
Half Adder The half adder adds two binary digits and produces two outputs as sum and carry; XOR is applied to both inputs to produce sum and AND gate is applied to both inputs to produce carry.
Full Adder A full - adder is a combinational circuit that forms the arithmetic sum of three input bits. It consists of three inputs and two outputs.
Boolean Algebra • Boolean algebra is a mathematical system for the manipulation of variables that can have one of two values. • In formal logic, these values are “true” and “false.” • In digital systems, these values are “on” and “off,” 1 and 0, or “high” and “low.” • Boolean expressions are created by performing operations on Boolean variables. • Common Boolean operators include AND, OR, and NOT.
3.2 Boolean Algebra • A Boolean operator can be completely described using a truth table. • The truth table for the Boolean operators AND and OR are shown at the right. • The AND operator is also known as a Boolean product. The OR operator is the Boolean sum.
3.2 Boolean Algebra • The truth table for the Boolean NOT operator is shown at the right. • The NOT operation is most often designated by an overbar. It is sometimes indicated by a prime mark ( ‘ ) or an “elbow” ().
3.2 Boolean Algebra • A Boolean function has: • At least one Boolean variable, • At least one Boolean operator, and • At least one input from the set {0,1}. • It produces an output that is also a member of the set {0,1}.
3.2 Boolean Algebra • The truth table for the Boolean function: is shown at the right.
3.2 Boolean Algebra • As with common arithmetic, Boolean operations have rules of precedence. • The NOT operator has highest priority, followed by AND and then OR. • This is how we chose the (shaded) function subparts in our table.