2 - ComputerOrganization - Data Rep
2 - ComputerOrganization - Data Rep
1 2 3 . 3 2 1
1 0 1 . 0 1 1
MSB LSB
100 = 1
101 = 10
102 = 100
103 = 1000
104 = 10000
• So a denary number 248 is expanded in Base 10
system as
2x102 + 4x101 + 8x100
Binary System concept
• Base 2 system
20 = 1
21 = 2
22 = 4
23 = 8
24 = 16
25 = 32 and so on
• So a binary number 110 is expanded in base 2
system as
1x22 + 1x 21 + 0x20
How to convert a binary number to denary?
• Example 1
• Binary 1110
0 x 20 = 0
1 x 21 = 2
1 x 22 = 4
1 x 23 = 8
Total = 14
Equivalent Denary Number = 14
How to convert a binary number to denary?
• Example 2
• Binary 101101010
0 x 20 = 0
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
1 x 26 = 64
0 x 27 = 0
1 x 28 = 256
Total = 256 + 64 + 32 + 8 + 4 + 2 = 362
How to convert a binary number to denary?
• Example 3
• Binary 1011.011
1 x 2-3 = 1/8 = 0.125
1 x 2-2 = 1/4 = 0.25
0 x 2-1 = 0
1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
Total = 0.125+ 0.25 + 0+ 1+ 2+ 0+8 = 11.375
Equivalent Denary Number = 11.375
How to convert a denary number to binary?
– Method 1
• We follow trial and error method using the place values.
• This can be used for small numbers.
27 26 25 24 23 22 21 20 Denary
128 64 32 16 8 4 2 1 Number
1 1 1 7
1 1 0 6
1 1 1 0 14
1 0 1 0 0 20
1 0 0 0 1 1 0 70
1 1 0 1 0 1 1 107
Fill up the appropriate position and make the total equal to the required
denary number.
How to convert a denary number to binary?
– Method 2
• We also follow successive or repetitive division by 2.
• This is more methodical.
• Example
• Take a denary number 245.
2| 245
2| Quotient 122 – Remainder 1
2| Quotient 61 – Remainder 0
2| Quotient 30 – Remainder 1
2| Quotient 15 – Remainder 0
2| Quotient 7 – Remainder 1
2| Quotient 3 – Remainder 1
2| Quotient 1 – Remainder 1
2| Quotient 0 – Remainder 1
http://www3.ntu.edu.sg/home/ehchua/programming/java/
datarepresentation.html
Introduction
• Basic Gates
• 1. NOT gate
• 2. AND gate
• 3. OR gate
• 4. NAND gate
• 5. NOR gate
• 6. XOR gate.
• Logic diagram - A graphical representation of a
circuit
– Each type of gate is represented by a specific
graphical symbol
• Truth table - A table showing all possible input
values and the associated output values
Symbols Used
NOT GATE
• A NOT gate accepts one input value and
produces one output value
• Fundamental laws
• If X ≠ 0 then X = 1
• If X ≠ 1 then X = 0
• OR Relations
– 0+0=0
– 0+1=1
– 1+0=1
– 1+1=1
• AND Relations
– 0.0=0
– 0.1=0
– 1.0=0
– 1.1=1
• Complement Rules
– 0=1
– 1=0
Basic Theorems
• 0+X=X
• 1+X=1
• 0.X=0
• 1.X=X
• X+X=X
• X.X=X
• X’’ = X
Basic Theorems – De Morgan’s Theorem
• (A + B)’ = A’ . B’
• (AB)’ = A’ + B’
• Principle – Break the line and change the sign
Universal Gates
• NOR & NAND gates are universal gates
• Because using NAND/NOR gates, we can form
the other logic gates
NAND as Universal Gate
NOT Gate
AND Gate
OR Gate
NAND as Universal Gate
NAND as Universal Gate
NOR as Universal Gate
NOT Gate
OR Gate
AND Gate
NOR as Universal Gate
• Draw a logic network and truth table to show all the possible situations when the stop
signal could be received.
Example
• The first thing to do is to try and turn the question into a series of logic gates and
then the problem becomes much simplified.
• The first statement can be re-written as: (L = 1 AND V = NOT 1) since Length > 100
meters
• corresponds to a binary value of 1 and Velocity < 10 m/s corresponds to a binary
value of 0 (i.e. NOT 1).
• Both these statements are joined together by OR which gives us the logic
statement: