Professional Documents
Culture Documents
• Smallest Unsigned
0000 (0)
Magnitude
1111 (-7)
complement complement
1000 (-7) 1000 (-8)
• Largest 1111 (15) 0111 (+7) 0111 (+7) 0111 (+7)
• In general, with n-bit numbers including
the sign, the ranges are:
•
•
•
Converting signed numbers to
decimal
• Convert 110101 to decimal, assuming this
is a number in:
(a) signed magnitude format
•
Our four-bit unsigned adder
circuit
• Here is the four-bit unsigned additionNope, never saw
circuit from last Wednesday. it
before in my life.
Making a subtraction
circuit
• We could build a subtraction circuit directly, similar to the
way we made unsigned adders yesterday.
• However, by using two’s complement we can convert
any subtraction problem into an addition problem.
Algebraically,
A - B = A + (-B)
INFIX POSTFIX
A+B AB+
12 + 60 – 23 12 60 + 23 –
(A + B)*(C – D ) AB+CD–*
A B * C – D + E/F A B C*D – E F/+
• In the postfix form, parentheses
are not used.
• Consider the infix expressions
as ‘4+3*5’ and ‘(4+3)*5’.
• The parentheses are not
needed in the first but are
necessary in the second
expression. The postfix forms
are:
• 4+3*5 435*+
• (4+3)*5 43+5*
• In case of not using the
parenthesis in the infix form,
you have to see the
precedence rule before
evaluating the expression.
• In the postfix form, we do not need
to use parenthesis.
6 6
2 2
6
3 3
2
6
+ 2 3 5 5
6
- 6 5 1 1
3 6 5 1 3
1
8 6 5 1 8
3
1
2 6 5 1 2
8
3
1
/ 8 2 4 4
3
1
+ 3 4 7 7
1
* 1 7 7 7
2 1 7 7 2
7
7 2 49 49
3 7 2 49 3
49
+ 49 3 52 52
•With the help of stack
we can easily solve a
very big postfix
expression.
Conversion from infix to postfix
A A
+ A +
B AB +
* AB *
+
C ABC* +
ABC*+
• Sometimes we do need the
parenthesis in the infix form.