2. Computer Architecture
& Microprocessor
22
Session ISession I
Number SystemNumber System
ConversionsConversions
Binary OperationsBinary Operations
CodeCode
Logic GatesLogic Gates
Boolean AlgebraBoolean Algebra
Registers & CountersRegisters & Counters
Computer LanguagesComputer Languages
3. Computer Architecture
& Microprocessor
33
Number SystemNumber System
Systematic representation of data in Numerical FormatSystematic representation of data in Numerical Format
Decimal Number SystemDecimal Number System 0 to 90 to 9
Binary Number SystemBinary Number System 0 and 10 and 1
Octal Number SystemOctal Number System 0 to 70 to 7
Hexa Decimal Number SystemHexa Decimal Number System 0 to 9 and A to F0 to 9 and A to F
4. Computer Architecture
& Microprocessor
44
Decimal Number SystemDecimal Number System
Uses digits from 0 to 9.Uses digits from 0 to 9.
Has a base of 10Has a base of 10
Value of digit corresponds to its position in the numberValue of digit corresponds to its position in the number
number X (base)number X (base)position-1position-1
Example :Example :
4954951010 , 84, 841010
5. Computer Architecture
& Microprocessor
55
Binary Number SystemBinary Number System
Computer uses the Binary Number SystemComputer uses the Binary Number System
Consists of numbers 0 and 1Consists of numbers 0 and 1
Bit (Bit (BBinary diginary digitit))
Byte (8 - bits)Byte (8 - bits)
Example:Example:
1010101022 , 1110, 111022
6. Computer Architecture
& Microprocessor
66
Octal Number SystemOctal Number System
Uses the digits from 0 to 7.Uses the digits from 0 to 7.
Has a base of 8Has a base of 8
can be represented by a group of 3 bitscan be represented by a group of 3 bits
Example:Example:
12312388 , 435, 43588
7. Computer Architecture
& Microprocessor
77
Hexa Decimal Number SystemHexa Decimal Number System
Uses the digits from 0 to 15.Uses the digits from 0 to 15.
Numbers from 10 to 15 represented by alphabets A through FNumbers from 10 to 15 represented by alphabets A through F
Has a base of 16Has a base of 16
Can be represented by a group of 4 bits.Can be represented by a group of 4 bits.
Example:Example:
B3A1B3A11616 , 98C, 98C1616
9. Computer Architecture
& Microprocessor
99
Conversion of decimal Number to Hexadecimal NumberConversion of decimal Number to Hexadecimal Number
To convert, divide the decimal number by 16 successivelyTo convert, divide the decimal number by 16 successively
ExampleExample
To convert 540 to decimalTo convert 540 to decimal
16 54016 540
16 33 -1216 33 -12
2 - 12 - 1
The decimal equivalent of 540The decimal equivalent of 5401010 = 21C= 21C1616
10. Computer Architecture
& Microprocessor
1010
Conversion from Hexadecimal to DecimalConversion from Hexadecimal to Decimal
Multiply the digits of the number by the powers of 16 and addMultiply the digits of the number by the powers of 16 and add
ExampleExample
To convert 21CTo convert 21C1616 to its decimal equivalentto its decimal equivalent
2 1 C
C X160
= 12 X 1 = 12
1 X161
= 1 X 16 = 16
2 X162
= 2 X 256= 512
540
11. Computer Architecture
& Microprocessor
1111
Conversion of Hexadecimal to Binary NumberConversion of Hexadecimal to Binary Number
The binary equivalent of each digit is usedThe binary equivalent of each digit is used
ExampleExample
To convert 5BTo convert 5B1616 to binary equivalent:to binary equivalent:
5 B5 B
010110110101101122
To convert B316 to binary equivalent:To convert B316 to binary equivalent:
B 3B 3
101100111011001122
12. Computer Architecture
& Microprocessor
1212
Conversion of Binary to Decimal NumberConversion of Binary to Decimal Number
Sum of product of each digit with 2 raised to the powerSum of product of each digit with 2 raised to the power
of positional valueof positional value
Example:Example:
To find the decimal equivalent of 1011To find the decimal equivalent of 101122 ::
13. Computer Architecture
& Microprocessor
1313
Conversion from Octal to DecimalConversion from Octal to Decimal
Multiply the digits of the number by the powers of 8 and addMultiply the digits of the number by the powers of 8 and add
ExampleExample
To convert 215To convert 21588 to its decimal equivalentto its decimal equivalent
2 1 5
5 X 80
= 5 X 1 = 5
1 X 81
= 1 X 8 = 8
2 X 82
= 2 X 64= 128
141
14. Computer Architecture
& Microprocessor
1414
9’s Complement9’s Complement
Difference of each digit of a number from 9Difference of each digit of a number from 9
Example:Example:
To find 9’s complement ofTo find 9’s complement of 5454 ::
9 99 9
5 45 4
4 54 5
15. Computer Architecture
& Microprocessor
1515
10’s Complement10’s Complement
Equivalent to the negative of a numberEquivalent to the negative of a number
Obtained by adding 1 to the 9’s complement of a numberObtained by adding 1 to the 9’s complement of a number
Example:Example:
To find 10’s complement of 54To find 10’s complement of 54
= 9’s complement of 54 + 1= 9’s complement of 54 + 1
= 45 + 1= 45 + 1
== 4646
16. Computer Architecture
& Microprocessor
1616
1’s Complement of binary number1’s Complement of binary number
Similar to 9’s complement of decimal numberSimilar to 9’s complement of decimal number
Obtained by subtracting each digit from 1Obtained by subtracting each digit from 1
ExampleExample
To find 1’s complement of 101To find 1’s complement of 101
1 1 11 1 1
1 0 11 0 1
0 1 00 1 0
17. Computer Architecture
& Microprocessor
1717
2’s complement of a binary number2’s complement of a binary number
Equivalent to 10’s complement of a decimal numberEquivalent to 10’s complement of a decimal number
Represents the negative equivalent of that numberRepresents the negative equivalent of that number
ExampleExample
To find the 2’s complement of 1010To find the 2’s complement of 1010
= 1’s complement of 1010 + 1= 1’s complement of 1010 + 1
= 0101 + 1= 0101 + 1
== 01100110
18. Computer Architecture
& Microprocessor
1818
Binary SubtractionBinary Subtraction
To subtractTo subtract 10101010 fromfrom 11001100
Find 2’s complement of 1010Find 2’s complement of 1010
NumberNumber : 1010: 1010
1’s complement1’s complement : 0101: 0101
2’s complement2’s complement : 0110: 0110
Add 2’s complement of 1010 with 1100Add 2’s complement of 1010 with 1100
11001100
01100110
00100010
19. Computer Architecture
& Microprocessor
1919
BCDBCD
Each digit is represented by four bitsEach digit is represented by four bits
Decimal NumberDecimal Number BCDBCD
88 0000100000001000
99 0000100100001001
1010 0001000000010000
1111 0001000100010001
1212 0001001000010010
1313 0001001100010011
1414 0001010000010100
1515 0001010100010101
Decimal NumberDecimal Number BCDBCD
00 00000000
11 00010001
22 00100010
33 00110011
44 01000100
55 01010101
66 01100110
77 01110111
20. Computer Architecture
& Microprocessor
2020
Gray CodeGray Code
Only one bit changes for each consecutive numbersOnly one bit changes for each consecutive numbers
Decimal NumberDecimal Number Gray CodeGray Code
88 11001100
99 11011101
1010 11111111
1111 11101110
1212 10101010
1313 10111011
1414 10011001
1515 10001000
Decimal NumberDecimal Number Gray CodeGray Code
00 00000000
11 00010001
22 00110011
33 00100010
44 01100110
55 01110111
66 01010101
77 01000100
21. Computer Architecture
& Microprocessor
2121
ASCII CodesASCII Codes
American Standard Code for Information InterchangeAmerican Standard Code for Information Interchange
7 bit code7 bit code
Represents upto 128 charactersRepresents upto 128 characters
First 3 bits-zone bitsFirst 3 bits-zone bits
Second 4 bits-numeric bitsSecond 4 bits-numeric bits
22. Computer Architecture
& Microprocessor
2222
ASCII CodesASCII Codes
ASCII Code Character
00 NUL
01 SOH
02 STX
03 ETX
04 EOT
05 ENQ
06 ACK
07 BEL
08 BS
09 HT
0A LF
0B VT
0C FF
0D CR
0E S1
0F S0
10 DLE
ASCII Code Character
11 DC1 (X-on)
12 DC2 (Tape)
13 DC3 (X-off)
14 DC4
15 NAK
16 SYN
17 ETB
18 CAN
19 EM
1A SUB
1B ESC
1C FS
1D GS
1E RS
1F US
20 SP
21 !
24. Computer Architecture
& Microprocessor
2424
ASCII Code Character
42 B
43 C
44 D
45 E
46 F
47 G
48 H
49 I
4A J
4B K
4C L
4D M
4E N
4F O
50 P
51 Q
52 R
53 S
54 T
55 U
ASCII Characters
56 V
57 W
58 X
59 Y
5A Z
5B [
5C
5D ]
5E ^ ( )
5F - ( )
61 a
62 b
63 c
64 d
65 e
66 f
67 g
69 h
6A i
6B j
34. Computer Architecture
& Microprocessor
3434
Boolean AlgebraBoolean Algebra
Algebra of binary values(1 & 0)Algebra of binary values(1 & 0)
Types of operationsTypes of operations
OR (+)OR (+)
AND ( . )AND ( . )
NOT (- or ‘ )NOT (- or ‘ )
Minimizes the basic circuits to perform digital operationsMinimizes the basic circuits to perform digital operations
35. Computer Architecture
& Microprocessor
3535
Algebraic TheoremsAlgebraic Theorems
OR LawsOR Laws
• A + 0 = AA + 0 = A
• A + 1 =1A + 1 =1
• A + A = AA + A = A
• A + A = 1A + A = 1
AND LawsAND Laws
• A . 0 = 0A . 0 = 0
• A . 1 = AA . 1 = A
• A . A = AA . A = A
• A . A = 0A . A = 0
36. Computer Architecture
& Microprocessor
3636
Laws of ComplementationLaws of Complementation
A = AA = A
1 = 01 = 0
0 = 10 = 1
If A=0, then A =1If A=0, then A =1
If A=1, then A = 0If A=1, then A = 0
Commutative LawsCommutative Laws
A + B = B + AA + B = B + A
A .B = B .AA .B = B .A
Associative LawsAssociative Laws
(A + B) + C = A + (B + C) = A + B + C(A + B) + C = A + (B + C) = A + B + C
(A.B).C = A.(B.C) = A.B.C(A.B).C = A.(B.C) = A.B.C
37. Computer Architecture
& Microprocessor
3737
Distributive LawsDistributive Laws
A . (B+C) = A .B + A .CA . (B+C) = A .B + A .C
A + B.C = (A + B) . (A + C)A + B.C = (A + B) . (A + C)
Other ExpressionsOther Expressions
A + AB = AA + AB = A
A . (A + B) = AA . (A + B) = A
A + AB = A + BA + AB = A + B
A . (A + B) = ABA . (A + B) = AB
AB + AB = AAB + AB = A
(A + B)(A + B) = A(A + B)(A + B) = A
AB + AC = (A + C) . (A + B)AB + AC = (A + C) . (A + B)
(A + B) ( A + C) = AC + AB(A + B) ( A + C) = AC + AB
AB + AC + BC = AB + ACAB + AC + BC = AB + AC
(A + B)(A + C)(B + C) = (A + B)(A + C)(A + B)(A + C)(B + C) = (A + B)(A + C)
42. Computer Architecture
& Microprocessor
4242
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
1 1 1 1 1 1 0
0 1 1 0 0 0 0
1 1 0 1 1 0 1
1 1 1 1 0 0 1
0 1 1 0 0 1 1
1 0 1 1 0 1 1
1 0 1 1 1 1 1
1 1 1 0 0 0 0
1 1 1 1 1 1 1
1 1 1 1 0 1 1
INPUTS
X Y Z W A B C D E F G
OUTPUT
L
E
G
A
L
D
I
G
I
T
S
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
1 0 0 1 1 1 1
1 0 0 1 1 1 1
1 0 0 1 1 1 1
1 0 0 1 1 1 1
1 0 0 1 1 1 1
1 0 0 1 1 1 1
E
R
R
O
R
7 Segment LED Display– Truth Table
43. Computer Architecture
& Microprocessor
4343
TTL CircuitTTL Circuit
Stands for transistor - transistor logic.Stands for transistor - transistor logic.
Operates between cut-off and saturation.Operates between cut-off and saturation.
Advantages:Advantages:
• SpeedSpeed
• good fan – in and fan – outgood fan – in and fan – out
• easy interface with other digital circuitryeasy interface with other digital circuitry
44. Computer Architecture
& Microprocessor
4444
Flip FlopFlip Flop
Stores a binary digitStores a binary digit
Stable till a signal switches itStable till a signal switches it
Types of Types of flip flopTypes of Types of flip flop
S-R flip flopS-R flip flop
J-K flip flopJ-K flip flop
D flip flopD flip flop
T flip flopT flip flop
45. Computer Architecture
& Microprocessor
4545
RegistersRegisters
Group of flip-flopsGroup of flip-flops
Connected in parallelConnected in parallel
D flip-flop commonly usedD flip-flop commonly used
Shift RegisterShift Register
Shifts content unchangedShifts content unchanged
Temporary storageTemporary storage
Types:Types:
Serial-in, serial-outSerial-in, serial-out
Serial-in, parallel-outSerial-in, parallel-out
Parallel in, serial-outParallel in, serial-out
Parallel in, parallel outParallel in, parallel out
46. Computer Architecture
& Microprocessor
4646
CountersCounters
Counts no. of pulsesCounts no. of pulses
Modulus of CounterModulus of Counter
• Binary CounterBinary Counter
• Decade CounterDecade Counter
• Pre settable CounterPre settable Counter
Binary CounterBinary Counter
J
k
Q
Q
J
k
Q
Q
J
k
Q
Q
J
k
Q
Q
CLK
3 2 1 0
47. Computer Architecture
& Microprocessor
4747
Types of CountersTypes of Counters
Up CounterUp Counter
Down CounterDown Counter
Up-Down CounterUp-Down Counter
Controlled CounterControlled Counter
Ring CounterRing Counter
Synchronous
Asynchronous
48. Computer Architecture
& Microprocessor
4848
Computer LanguagesComputer Languages
Machine LanguageMachine Language
–– 0 and 10 and 1
Assembly LanguageAssembly Language
–– mnemonicsmnemonics
–– assemblerassembler
High Level LanguageHigh Level Language
–– English like languageEnglish like language
–– Interpreters and CompilersInterpreters and Compilers
49. Computer Architecture
& Microprocessor
4949
Execution of Assembly Language programExecution of Assembly Language program
Source Program
Assembler
Object Program
Loader
Floppy Disk
Floppy Disk
One to One Translation