Professional Documents
Culture Documents
Number Systems
I. DECIMAL NUMBERS
[3] For fractional numbers, the weights are negative powers of ten that
decrease from left to right beginning with 10−1 = 0.1
10−1 10−2 10−3 ………….
The value of a decimal number is the sum of the digits after each digit
has been multiplied by its weight.
Example 1:
Express the number (2014)10 as a sum of the values of each digit
H.W
1
First year class (IT) Evening study Logic Design
2
First year class (IT) Evening study Logic Design
left by a power of two for each bit. The left-most bit is the MSB (most
significant bit); its weight depends on the size of the binary number.
Fractional numbers can also be represented in binary by placing bits to
the right of the binary point, just as fractional decimal digits are placed
to the right of the decimal point. The left-most bit is the MSB in a
binary fractional number and has a weight of 2−1 = 0.5. The fractional
weights decrease from left to right by a negative power of two for each
bit. The weight structure of a binary number is:
(101.001)2
Binary-to-Decimal Conversion
Solution:
Determine the weight of each bit that is a1, and then find the sum of the
weights to get the decimal number.
3
First year class (IT) Evening study Logic Design
25 +23 + 22 + 20
= 32 + 8 + 4 + 1 = (45)10
Solution:
H.W:
Repeated division-by-Two
To get the binary number for a given decimal number, divide the
decimal number by 2 until the quotient is 0 and the remainders will
form the binary number.
Quotient Remainders
𝐴
=𝑄 , 𝑅
𝐵
4
First year class (IT) Evening study Logic Design
Example
Example:
Solution
1 2 5 11 22 45
÷
2 2 2 2 2 2
0 1 2 .5 5 .5 11 22 .5 Q
Stopped When
whole number 0.5 0 0.5 0.5 0 0.5
equal to Zero
× R
2 2 2 2 2 2
1 0 1 1 0 1
5
First year class (IT) Evening study Logic Design
H.W
Binary-to-Hexadecimal Conversion
Converting a binary number to hexadecimal is a straightforward
procedure. Simply break the binary number into 4-bit groups,
starting at the right-most bit (LSB) and replaces each 4-bit group
with the equivalent hexadecimal symbol.
6
First year class (IT) Evening study Logic Design
Example:
Convert the following binary number to hexadecimal
(1100101001010111)2 , (111111000101101001)2
Solution
C A 5 7
(𝐶𝐴57)16
3 F 1 6 9
6
(3𝐹169)16
Note: Two Leading zeros have been added in part (b) to complete
a 4-bit group at the left.
Hexadecimal-to-Binary Conversion
To convert from a hexadecimal number to a binary number,
reverse the process and replace each hexadecimal symbol with the
appropriate four bits.
Example:
Determine the binary number for the following hexadecimal
numbers:
(10𝐴4)16
Solution
1 0 A 4
7
First year class (IT) Evening study Logic Design
Hexadecimal-to-Decimal Conversion
(𝐸5)16 , (𝐵2𝐹8)16
Solution:
= (45816)10
Decimal-to-Hexadecimal Conversion
Repeated division of a decimal number by 16 will produce the
equivalent hexadecimal number, formed by the remainders of the
divisions. The first remainder produced is the least significant digit
(LSD). Each successive division by 16 yields a remainder that
becomes a digit in the equivalent hexadecimal number. This
procedure is similar to repeated division by 2 for decimal-to-
binary conversion.
8
First year class (IT) Evening study Logic Design
Solution
2 40 650
÷
16 16 16
0 2.5 40.625 Q
Stopped When
whole number 0.625
0.125 0.5
equal to Zero
× R
16 16 16
2 8 10
2 8 A
MSD LSD
(28𝐴)16
Octal-to-Decimal Conversion
The evaluation of an octal number in terms of its decimal
equivalent is accomplished by multiplying each digit by its weight
and summing the products.
9
First year class (IT) Evening study Logic Design
(2 × 83 ) + (3 × 82 ) + (7 × 81 ) + (4 × 80 )
Decimal-to-Octal Conversion
A method of converting a decimal number to an octal number is
the repeated division-by 8 methods, which is similar to the method
used in the conversion of decimal numbers to binary or to
hexadecimal. The first remainder generated is the least significant
digit (LSD).
Solution
5 44 359
÷
8 8 8
0 5.5 44.875 Q
Stopped When
whole number 0.875
0.625 0.5
equal to Zero
× R
8 8 8
5 4 7
MSD LSD
(547)8
10
First year class (IT) Evening study Logic Design
Octal-to-Binary Conversion
Because each octal digit can be represented by a 3-bit binary
number, it is very easy to convert from octal to binary. Each octal
digit is represented by three bits as shown in Table below.
Example
Binary-to-Octal Conversion
Start with the right-most group of three bits and, moving from
right to left, convert each 3-bit group to the equivalent octal digit.
If there are not three bits available for the left-most group; add
either zeros to make a complete group. These leading zeros do not
affect the value of the binary number.
Example
11
First year class (IT) Evening study Logic Design
Help Paper
Decimal
Number
it
Repeated division-by 2
Hexadecimal Octal
by
digit
Represent each Hex.digit by four bits Represent each Octal digit by three bits
Binary
System
Grouping each 4 bits starting from right to left Grouping each 3 bits starting from right to left
and convert then to the equivalent Hex digit and convert then to the equivalent octal digit
Hexadecimal Octal
When converting from octal to hex [or vice versa], first convert to binary; then convert
the binary into the desired number system.5. When converting from octal to hex [or vice
versa], first convert to binary; then convert the binary into the desired number system
12
First year class (IT) Evening study Logic Design
V. BINARY-CODED-DECIMAL (BCD)
The ease of conversion between BCD code numbers and the familiar
decimal numbers is the main advantage of this code. All you have to
remember are the ten binary combinations that represent the ten decimal
digits.
Invalid Codes You should realize that, with four bits. Sixteen numbers
(0000 through 1111) can be represented but BCD code, only ten of these
are used. The six code combinations that are not used (1010) to (1111).
To express any decimal number in BCD, simply replace each decimal
digit with the appropriate 4-bit code.
Example: Convert each of the following decimal numbers to BCD:
(35)10 , (170)10
Solution:
Solution:
13
First year class (IT) Evening study Logic Design
14
First year class (IT) Evening study Logic Design
Logic Gates
I. General concepts
Truth Table
1. A truth table is a means for describing how a logic circuit's output
depends on the logic levels present at the circuit's inputs. For example,
figure bellow illustrates a truth table for two-input logic circuit.
Table entry
Or
Combination
2. The truth table lists all possible combinations of logic levels present at
input A and B along with the corresponding output level X. The first
entry in the table shows that when A and B are both at the 0 level, the
output x is at the 1 level or, equivalently, in the 1 state. In a similar
way, the table shows what happen to the output state for any set of input
conditions.
3. The number of input combinations will equal 2𝑛 for an n-input truth
table.
4. The list of all possible input combinations follows the binary counting
sequence and so it is an easy matter to write down all of combinations
without missing any.
16
First year class (IT) Evening study Logic Design
17
First year class (IT) Evening study Logic Design
This expression states that the output is the complement of the input.
The OR Gate
Standard logic symbols for OR Gate are shown in following figure:-
OR gate operation
An OR gate produces a HIGH (logic 1) on the output when any of the inputs
is HIGH (logic 1). The output is LOW (logic zero) only when all of the inputs
are LOW (logic zero).
18
First year class (IT) Evening study Logic Design
19
First year class (IT) Evening study Logic Design
Example:
If the two input waveforms (Digital signals), A and B are applied to the OR
gate, what is the resulting output waveform?
H.W: Determine the output waveform and show the timing diagram if the
middle pulse of input A is replaced by a LOW level.
Notice that Boolean addition differs from binary addition in the case where
two 1s are added. There is no carry in Boolean addition.
20
First year class (IT) Evening study Logic Design
Example: If two waveforms, A and B, are applied to the AND gate inputs,
what is the resulting output waveform?
H.W: Determine the output waveform and show a timing diagram if the
second and fourth pulses in waveform A of the above example are replaced
by LOW levels.
22
First year class (IT) Evening study Logic Design
XOR operation
For an exclusive-OR gate. output X is HIGH when input A is LOW and input
B is HIGH, or when input A is HIGH and input B is LOW . X is LOW when
A and B are either HIGH or both LOW.
23
First year class (IT) Evening study Logic Design
H.W: For the set of input waveforms in Figure bellow. Determine the output
for the XOR gate shown and draw the timing diagram.
If A and B are two inputs for XOR gate and X is the output from this gate then
XOR can represent in Boolean algebra by the following by
𝑋 =𝐴⊕𝐵
24
First year class (IT) Evening study Logic Design
NOR Gate
Standard logic symbol for 2-inputs NOR Gate is shown below:
25
First year class (IT) Evening study Logic Design
Solution
Whenever any input of the NOR gate is HIGH, the output is LOW as shown
by the output waveform X in the timing diagram.
Example
Show the output waveform for the 3-input NOR gate in Figure below with the
proper time relation to the inputs.
Solution
The output X is LOW when any input is HIGH as shown by the output
waveform X in the timing diagram.
26
First year class (IT) Evening study Logic Design
H.W :
1 Invert input B in the first example and determines the output waveform
in relation to the inputs.
2 With the Band C inputs inverted in the second example, determine the
output and show the timing diagram.
Logic Expressions for a NOR Gate
The Boolean expression for the output of a 2-input NOR gate can be written
as:
This equation says that the two input variables are first ORed and then
complemented, as indicated by the bar over the OR expression.
NAND Gate
Standard logic symbol for 2-inputs NAND Gate is shown below:
27
First year class (IT) Evening study Logic Design
Example
If the two waveforms A and B shown in Figure bellow are applied to the
NAND gate inputs, determine the resulting output waveform.
Solution
Output waveform X is LOW only during the four time intervals when both
input waveforms A and B are HIGH as shown in the timing diagram.
28
First year class (IT) Evening study Logic Design
Example
Show the output waveform for the 3-input NAND gate in Figure bellow with
its proper time relationship to the inputs.
Solution
The output waveform X is LOW only when all three input waveforms are
HIGH as shown in the timing diagram.
29
First year class (IT) Evening study Logic Design
H.W.
1 Determine the output waveform and show the timing diagram if input
waveform B is inverted in the first example.
2 Determine the output waveform and show the timing diagram if input
waveform A is inverted for the second example.
This expression says that the two input variables. A and B, are first ANDed
and then complemented, as indicated by the bar over the AND expression.
30
First year class (IT) Evening study Logic Design
Solution
The output waveforms are shown in Figure. Notice that the XOR output is
HIGH only when both inputs are at opposite levels. Notice that the XNOR
output is HIGH only when both inputs are the same.
31
First year class (IT) Evening study Logic Design
H.W
32
First year class (IT) Evening study Logic Design
1- AND gate
𝑿 = 𝑨. 𝑩
2- NAND gate
𝑿 = ̅̅̅̅̅
𝑨. 𝑩
3- OR gate
𝑿=A+B
4- NOR gate
𝑿 = ̅̅̅̅̅̅̅̅
𝑨+𝑩
5- XOR Gate
𝑿 = 𝑨⨁𝑩
33
First year class (IT) Evening study Logic Design
6- XNOR Gate
̅̅̅̅̅̅̅
𝑿 = 𝑨⨁𝑩
7- NOT Gate
̅
𝑿=𝑨
𝑿 = 𝑨. 𝑩 + 𝑪
𝑿 = (𝑨 + 𝑩). 𝑪
34
First year class (IT) Evening study Logic Design
H.W
1. In the first figure above change each AND gate to an OR gate, and change
the OR gate to an AND gate. Then write the expression for output X.
2. In the second figure above change each AND gate to an OR gate, and each
OR gate to AND gate. Then write the expression for x.
35
First year class (IT) Evening study Logic Design
36