Transcript Document

Digital Logic Design
Lecture # 2
University of Tehran
Outline


Design Flow
Transistors and Switches



NMOS
PMOS
Number Systems



Binary System
Sign and Magnitude System
2’s Complement System
Design Flow
System
SubSystem
RTL
subtr
Gate level
adder
Treansistor level
Arith Reg. Mem.
Design
Implementation
CPU
Behavioral level
...
Design Flow (continued…)


When designing a digital system, partitioning of the
whole comes first. While doing so we run into so
called sub-systems of our main system which are
simpler definition-wise.
Considering the figure shown in the latter slide our
design procedure which is normally a Top-Down
procedure, starts by dividing the digital system
needed down to components we already have and/or
if a component that has not yet been designed is
reached, we move lower into the levels of design
until we have all needed parts.
Design Follow (continued…)


Implementation being the procedure of putting
together smaller parts in order to form what is
needed is a Bottom-Up procedure.
In the process of design, we would have a very hard
and almost impossible job if we were to put together
-for all essential components- their transistors and
wire them together. Hence we consider a few
modules with a more defined application in order to
decrease the labor in this repetitive task.
Design Follow (continued…)


The first set of modules would be gates, now instead
of having a million transistors we have only 200’000
to 300’000 gates. Making meaningful structures helps
a designer who reached such a package in his/her
process not to go any further.
A decrease in component variation is seen as we sink
deeper in the design level. We only have 2 types of
transistors, while 30 to 40 types of components can
be recognized.
Design Follow (continued…)

Even in high levels of design, a designer may need to
work with transistors or gates at some levels of his
work. In comparison with building a house by
putting together built blocks and connecting them
with bricks, this can be called glue logic.
Transistors and Switches
Drain
PMOS
Gate
Source

Drain
NMOS
Gate
Source
Transistors can be simply defined as on-off switches.
In the CMOS technology we have 2 main types of
transistors: NMOS and PMOS.
Transistors and Switches
(continued…)



The only thing that concerns us here is whether or
not the transistor conducts at a special instance
The NMOS type conducts when a ‘1’ logic value is fed
to it’s gate input while the same happens for a PMOS
type when a ‘0’ logic value is fed
Because of the transistors-being our building brickshas 2 states, we will have to be working in base 2.
Number Systems



Binary
Sign and Magnitude
2’s Complement
Binary System

Weight of each position in the Binary System :
Binary Point
4
3
2
1
0
2
2
2
2
2
-1
2
.
-2
2
-3
2
-4
2
Binary System (continued…)

Conversion of a binary number to it’s equivalent
decimal number: As shown in the latter slide, each
position has a weight which is multiplied by the 0 or
1 in that position. The sum of the products is equal
to the equivalent decimal number. Example:
(1011)2=1*20+1*21+0*22+1*23=(11)10
Binary System (continued…)

Conversion of a decimal number to it’s equivalent
binary number: For this conversion, we attempt to
subtract each weight from the left most digit in order
to find the decimal number equivalent in binary.
Another procedure for this conversion is multiple
divisions and collecting the remainders, the first digit
resulted is the nearest digit to the binary point.
Example:
29
2
14
1
Binary Point
2
7
0
2
3
1
1
(29)D = (11101.)B
2
1
Binary System (continued…)

A decimal number can also consist of an integer and
a fractional part, which sum up to make the whole
number. Example: (29.61)10=(?)2
(29)10 = 1*24 + 1*23 + 1*22 + 0*21 + 1*20
=(11101)2
(0.61)10 = 1*2-1 + 0*2-2 + 0*2-3 + 1*2-4 + 1*2-5 +
1*2-6 =(0.100111)2
32 16 8 4 2 1
( 1 1 0 1 0 1
.5 .25 .125 .625
. 1 0 1
1 ) = ( 53.6785 )
B
D
Binary System (continued…)

Another way is to use multiplication to find the
fractional part. Example:
0.37 * 2 = 0.74 0.74 * 2 = 1.48 1.48 * 2 = 0.96 0.96 * 2 = 1.92 1.92 * 2 = 1.84 1.84 * 2 = 1.64
( 35.37 )D = ( 1 0 0 0 1 1 . 0 1 0 1 1 1 )B

The integer part can be exactly found whereas the
fractional part may not. In such a case we should
find three binary digits to represent each decimal
digit to maintain accuracy.
Binary System (continued…)


In our usage of the binary number system-although
we are benefiting because of it’s relativity to
transistors-some problems such as those seen in data
transmission can occur. This where the use of
hexadecimal and octal number systems is considered
useful.
To do conversions from base 2 to base 8(16), each
3(4) bits in base 2 must be converted into it’s
equivalent in base 8(16). Example:
( 35.37 )D = ( 0 0 1 0 0 0 1 1 . 0 1 0 1 1 1 0 0 )B
( 23.5C )hex = ( 43.27 )octal
Binary System (continued…)

Binary Arithmetic: Summing numbers in base 2 can
be considered the same as decimal summing (The
same rules apply to summing in base 8 and 16). The
main problems can occur when doing subtractions.
But even in this case the borrowing is just as it is in
decimal numbers. Example:
+2 +2 +2 +2
+1 +1
+1
101101
+ 011001
1000110
1 01101
+1 +1 +1 +1
- 0 01110
0 11111
Sign and Magnitude System

Our need for negative number is obvious in
arithmetic, because of this need and considering the
fact that in base 2 we can use nothing but 0s and 1s
for our representations, we define the left-most digit
as the number’s sign digit. The definition constructs
the Sign and Magnitude representation of numbers.
In this representation all digits except the left-most
construct the magnitude of the number, while the
left-most digit being 1 shows that the number is
negative or positive otherwise.
Sign Bit
Sign Bit
+12
0
0 0 0 1 1 0 0
-12
1
0 0 0 1 1 0 0
Sign and Magnitude System
(continued…)

The main problem remaining in this system and it’s
arithmetic, is that we have to use 2 completely
different algorithms and thus 2 completely different
circuits for addition and subtraction.
2’s Complement System

With another look at the arithmetic in our decimal
number system:
The Largest number with the same number
of digits plus 1 as our operand is added
and subtracted
52 - 37 = 52 - 37 + 100 - 100 = 52 - (37 + 99) + 1 - 100 =
52 + (62 + 1) - 100 = 52 + 63 - 100 = 115 - 100 = 15

We have reached our aim which was finding a new
way of subtraction with the same steps as addition.
And we have done it through eliminating the
borrowing procedure.
2’s Complement System
(continued…)


We have actually found a new way to negate 37 and
that is the result of subtracting it from 99 and adding
1 to it.
The same steps can be applied to the binary number
system:
00110100 - 00100101 = 00110100 - 00100101 + 100000000 - 100000000 =
00110100 - 00100101 + 11111111 + 1 - 100000000 =
00110100 + 11011011 - 100000000 = 100001111 - 100000000 = 00001111
The negative of 00100101

This representation for negative numbers is used in
the 2’s Complement System.
2’s Complement System
(continued…)



2’s complementing a number is consisted of
complementing it and then adding 1.
The same rule as the sign and magnitude
representation for distinguishing positive numbers
from negative ones applies in the 2’s complement
system.
In the 2’s complement system, the positive numbers
have the same form as they have in the sign and
magnitude system.
2’s Complement System
(continued…)

2’s complementing a negative number is performed
as starting from the right-most digit until the first ‘1’
is reached and then complementing the rest of the
digits.
+1+1+1 +1 +1
Addition Example:

Subtraction Example:

00011011
+ 01001101
01101000
+1 +1
+1 +1
0 0 0 1 1 0 1 1 negating 0 0 0 1 1 0 1 1
- 01001101
+ 10110011
-(00110010)
11001110
Binary