Title: Finite State Machine, Memory Systems Cache memory
1Finite State Machine, Memory SystemsCache memory
- Prof. Sin-Min Lee
- Department of Computer Science
CS147 Lecture 11
2Note that when Clear is 1, everything goes to
0. When Clear is 0, this does not affect the
others.
clk
T
clear
Q
1
3Finite State Machines and Flip-Flops
X/Y x input y output
Now, suppose we have an FSM with two states like
this
Although it may be confusing, the inputs and
outputs are labeled 0 and 1, and our two
states are also have the labels 0 and 1.
This somewhat awkward naming convention means it
is easier to translate this to computer code
later on.
4Finite State Machines and Flip-Flops
We can think of the starting state as Q(t) and
the ending state as Q(t1), with x and y being
our inputs and outputs, leading to this chart
5Implementing this FSM using a T Flip-Flop
Using the values from the first chart, we can get
this second chart. Then, we apply the same
reverse method to determine what input values we
would need to arrive at the ones listed in this
second chart.
6Implementing this FSM using a T Flip-Flop
T XQ' X'Q
7Implementing this FSM using a D Flip-Flop
This time we use the same FSM and same initial
chart, but now derive an equation for D.
8Implementing this FSM using a D Flip-Flop
Since this is a delay, the corresponding chart is
the same.
9Implementing JK Flip-Flop using only a T Flip-Flop
This is the final Karnaugh map and the associated
equation for T.
10Implementing T Flip-Flop using only a JK Flip-Flop
This time, we are doing the reverse again, asking
what values of J and K will give us the
corresponding values in the T chart above. 00 or
01 will give 0, so we enter 0X. X is our
don't care value it can be 0 or 1.
11Implementing T Flip-Flop using only a JK Flip-Flop
Once we derive all the values, we have to split
this into two, in order to get an equation that
defines J and another than defines K.
12Implementing T Flip-Flop using only a JK Flip-Flop
Here is the final implementation.
13(No Transcript)
14(No Transcript)
15(No Transcript)
16(No Transcript)
17(No Transcript)
18(No Transcript)
19Implementing JK Flip-Flop using only a T Flip-Flop
Note how the areas marked off with a blue box
behave like a T flip-flop, while the area within
the purple box behave like a D flip-flop.
From this last chart, we can derive the following
chart
20Implementing JK Flip-Flop using only a T Flip-Flop
To derive the next chart, we work in reverse,
asking, What is the input into the T (toggle)
function that will result in the output shown in
the previous chart? In this case, the first
column of Q is 0 and our circled value is a 0 a
0 will give this result.
The input that will give us a 1, when Q is 1, is
also 0. Refer back to the T flip-flop chart to
see that on 0, there is no change 1 toggles.
21Implementing this FSM using a D Flip-Flop
Finally, here is our graph.
22(No Transcript)
23(No Transcript)
24(No Transcript)
25(No Transcript)
26(No Transcript)
27(No Transcript)
28(No Transcript)
29(No Transcript)
30(No Transcript)
31(No Transcript)
32Memory Hierarchy
- Can only do useful work at the top
- 90-10 rule 90 of time is spent of 10 of
program - Take advantage of locality
- temporal locality
- keep recently accessed memory locations in cache
- spatial locality
- keep memory locations nearby accessed memory
locations in cache
33(No Transcript)
34(No Transcript)
35(No Transcript)
36(No Transcript)
37(No Transcript)
38The connection between the CPU and cache is very
fast the connection between the CPU and memory
is slower
39(No Transcript)
40(No Transcript)
41(No Transcript)
42(No Transcript)
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47There are three methods in block placement
Direct mapped if each block has only one place
it can appear in the cache, the cache is said to
be direct mapped. The mapping is usually (Block
address) MOD (Number of blocks in cache) Fully
Associative if a block can be placed anywhere
in the cache, the cache is said to be fully
associative. Set associative if a block can
be placed in a restricted set of places in the
cache, the cache is said to be set associative .
A set is a group of blocks in the cache. A block
is first mapped onto a set, and then the block
can be placed anywhere within that set. The set
is usually chosen by bit selection that is,
(Block address) MOD (Number of sets in cache)
48(No Transcript)
49(No Transcript)
50(No Transcript)
51(No Transcript)
52(No Transcript)
53(No Transcript)
54(No Transcript)
55(No Transcript)
56(No Transcript)
57(No Transcript)
58(No Transcript)
59- Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
                                        Â
- A pictorial example for a cache with only 4
blocks and a memory with only 16 blocks.
60(No Transcript)
61(No Transcript)