Escolar Documentos
Profissional Documentos
Cultura Documentos
Numbers in a computer:
2
electronically Each bit is represented by an electrical signal which is either a high or low voltage level.
high high
0 1
CMOS
1:High
3.5 4.9 Volts 2.0 2.4 Volts
NO MANS LAND 74LSxx NO MANS LAND 74HCxx
0:Low
It is actually a bit more complicated than this since there are different thresholds for inputs and outputs and their noise margins (indicated here in RED)..
Jordan Nash - Microprocessor Course
It is clear that depending upon the position of the J1 switch the line will be either 0 or 1
Binary Logic
5
perform various operations on the bits The operations which the microprocessor carries out can all be constructed with a few simple circuits The basic building blocks are logic gates
You may
0 0 1 1
0 1 0 1
0 0 0 1
OR
0 0 1 1
0 1 0 1
0 1 1 1
NOT
0 1
1 0
remember from the first year lab the gates AND, OR, NOT Any digital device can be made out of either ORs and NOTs or ANDs and NOTs.
DeMorgans Theorem
7
Exercise: Write truth table for both and prove that this is correct
Exercise: Test the claim that you can make any logic
device exclusively out of NOTs and ORs by making an AND out of NOTs and ORs:
Answer:
9
Exercise: Exclusive OR
10
0 0
0 1
0 1
1 1
0 1
1 0
The Exclusive OR
11
Solution:
Registers are electronic devices capable of storing 0s or 1s D-FLIP-FLOPs are the most elementary registers can store one bit 8 DFFs clocked together make a one byte register Capable of storing 8 bits
When S* is low and R* High, Q is high (Set) When S* is high and R* is low Q is cleared (Reset) Q and Q* are complements
S* 0 1 R* 1 0 Q 1 0 Q* 0 1
SR Latch: Hold
14
When S* and R* are high both states for Q are possible (and stable) The latch remembers the last state it was in, and holds Q in that state
S* 1 R* 1 Q 1 Q* 0
1
Jordan Nash - Microprocessor Course
When S* and R* are low Q and Q* are no longer complementary The latch can also enter a race condition where it oscillates
S* 0
R* 0
Q 1
Q* 1
H H H L L
S/R high is ambiguous, but stable This circuit remembers that S went low
Gated D Latch
17
Ensures that S and R are always complementary. When the Clock is high D is set on the outputs of the latch and it is held there when the clock is low Exercise: Fill out the truth table for this circuit.
Jordan Nash - Microprocessor Course
D latch timing
18
(Q)while the clock is high. Sometimes we want to transfer the data into the register only at a specified moment (for example when the clock changes) The D Flip-Flop uses two d-latches to latch the data on the edge (depending on the design either positive or negative) of the input clock
Jordan Nash - Microprocessor Course
Data is stored in
the Master latch (Qm) when the clock is high When the clock goes from high to low
The data is held in the Master The Data is stored in the slave latch output
CLK
D X X X H L
S L H L H H
R H L L H H
Q H L H H L
One can Set or Reset (Clear) the DFF using S or R When S and R are High, on the rising edge of the clock the data are transferred and stored in Q.
Jordan Nash - Microprocessor Course
Qbar L H H L H
X X X
4-bit Register
21
Byte Register
22
Byte coming in
bits stored in registers We can build additions of large numbers of bits out of units which add two bits
$3+$4 $3+$C $D+$4 $D+$C
0011
+ 0100 = 0111 $7
0011
+ 1100 = 1111 $F
1101
+ 0100 =10001 $11
1101
+ 1100 =11001 $19
Example: Adding two 4 bit numbers results in a 4 bit number plus one carry bit or effectively a 5 bit number Lets construct this adder from gates
J. Nash - Microprocessor Course
Full Adder
In order to add larger numbers, we
25
need to be able to bring the carry from the lower order bits, and add this to the sum The inputs are:
A 0 0 1 1 0 0 1 1
B 0 1 0 1 0 1 0 1
C 0 0 0 0 1 1 1 1
C+ 0 0 0 1 0 1 1 1
S 0 1 1 0 1 0 0 1
The outputs are: The Sum Bit (S) The Carry Out Bit (C+) We can build this from two half
that adds more than 1 bit together by using multiple full adder circuits
Exercise: Construct a circuit that adds two two bit words (Ao,A1) and (B0,B1) and produces three Sum Bits (S0,S1,S2)
Solution
27
building block we can generalize to produce a circuit which adds larger numbers
28
Centre of every
data bus to move data in and out - we will learn about this soon