CS 110 – Lecture 2

advertisement
CS 300 – Lecture 3
Intro to Computer Architecture
/ Assembly Language
Sequential Circuits
A Mystery Circuit
Consider this circuit:
1
0
1
1
Sequential Circuits
We've just seen a "flip flop" – a 1 bit
memory.
Circuits that use memory are called
"sequential". Note that you don't know what
the output is based on just the inputs!
S'
Q
R'
Q'
Adding A Clock
Input Data
Clock disables input –
1 = follow D, 0 = memory
RS Flipflop
as before
An Edge Triggered D Flip-Flop
Note: And gates should be NAND!
Opposite
Clocks
Slave
Master
A 1 Bit Memory
What you've just seen is a 1 bit memory.
Inputs:
* Data: Value to remember
* Clock: at the rising (falling?) edge of the
clock, whatever value is in the data wire is
clocked in.
This only changes output on the clock edge!
Clocks
A clock is the “heartbeat” a computer. The
signal on a wire carries a new value at each
clock. The clock determines the flow rate of
information along a wire.
If you want information to flow faster you use
more wires (bits) or a faster clock.
A simple processor uses a single clock for
everything in the processor – more complex
ones have multiple clocks.
Finite State Machines
Inputs: a set of wires: i1, i2, … im
Outputs: a set of wires: o1, o2, … , on
State: a set of D flip flops: s1, s2, … s0
The state can also be part of the output.
Use a truth table to define all outputs and the data
input to each flip-flop.
We can always represent the operation of this
circuit as a state machine.
Note that the clock is usually left implicit – all of the
flip-flops share a common clock
Example: A 2-Bit Counter
Input: "reset"
Outputs: counter value
(s0 and s1)
Truth table:
Let's draw this circuit
r
s0
s1
s0'
s1'
1
d
d
0
0
0
0
0
0
1
0
0
1
1
0
0
1
0
1
1
0
1
1
0
0
Creating a State Machine
* Determine inputs and outputs
* Use enough flip-flops to encode all
possible states
* Assign states to flip-flop configurations
The optimal encoding of states is the one
that minimizes the switching logic. This is
the sort of thing you need a computer for!
Sequential Circuits
Why sequential circuits? They allow us to
avoid the "unsynchronized" world of
combinatory circuits where signal
propagation is observable.
We set the clock so that all outputs in the
combinatory part of the circuit are stable
before new data is clocked into the flip-flops.
Sequential Design Patterns
A "register" is just a bunch of flip flops that
shares a common clock (load signal).
A "Ram" is just a multiplexed collection of
registers. Let’s see what a RAM looks like.
A "Shift register" is one in which there is a
data path leading between the bits.
Let's design a shift register.
Memory Structure
* XY Decoding
* Read / write signals
* Use of tri-state logic to express "implicit" or
gates
Download