



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




L12 - Models of Computation 1
3/17/
011010011011100100100011100011
modified 3/16/09 16:
L12 - Models of Computation 2
6.004 ā Spring 2009
3/17/
Sequential logic:
FSMs
ASEL
0
1
Data Memory
WDRD
Adr
R/W
W
D S E
L
0
1
2
WA
Rc <25:21>
10
XP
PCSEL
JT PC +
Instruction
Memory
A
D
Rb: <15:11>
Ra <20:16>
RA2SEL
Rc <25:21>
Register
File
RA
RA
RD
RD
BSEL
0
1
C: <15:0>
C: <15:0> sign-extended
Z
ALU
A
B
JT
WA
WDWE
C: <15:0> << 2sign-extended
ALUFN
Control Logic
Z PCSELRA2SELASELBSELWDSELALUFNWr
0
1
Wr
0 1
2
3 4 XAdr
ILLOP
WASEL
WASEL
IRQ
W E R F
WERF
00
CPU Architecture:
interpreter
for coded
programs
Fets & voltages
Logic gates
Combinational
logic circuits
L12 - Models of Computation 3
3/17/
i+s
words x (o+s) bits
i
s
0...00 0...
0...
10110
011
o
i+s
s
N+
o
s
N
i
inputs
outputs
(o+s)
i+s
(some may be
equivalent)
An FSMās behavior is completely
determined by its ROM contents.
So how many possible
i-input,o-output,FSMs withs-state bitsexist?
L12 - Models of Computation 4
6.004 ā Spring 2009
3/17/
0...00 0...
0...
10110
011
s
N+
o
s
N
i
inputs
outputs
8
FSMs
64
th
What if
s=2,
i=o=1??
L12 - Models of Computation 5
3/17/
837
1077
1537
89143
22698469884
784362783
72698436563783
Reality: The integer indexes of actual FSMs are
much
bigger
than the examples above. They must include
enough information to constitute a
complete
description
of each deviceās unique structure.
L12 - Models of Computation 6
6.004 ā Spring 2009
3/17/
The roots of computer science stem from thestudy of many alternative mathematical āmodelsāof computation, and study of the classes ofcomputations they could represent.An elusive goal was to find an āultimateā model,capable of representing all practicalcomputations...
Weāve got FSMs ...
what else do we need?
switches
gates
combinational logic
memories
FSMs
L12 - Models of Computation 7
3/17/
Paren
Checker
Paren
Checker
Nix
Given any string of coded left & rightparens, outputs 1 if it is balanced, else 0.
Simple, easy to describe.Is this device equivalent to one of our
enumerated FSMs???
PROBLEM: Requires ARBITRARILY many states,
depending on input. Must "COUNT" unmatchedLEFT parens. An FSM can only keep track of afinite number of unmatched parens: for everyFSM, we can find a string it canāt check.
L12 - Models of Computation 8
6.004 ā Spring 2009
3/17/
S
1
1 1 1 0
0 0 0 1
0 0 0 0
0 0 0 0
S
2
0,(1,R)
0,(1,L)
1,Halt
1,(1,L)
L12 - Models of Computation 13
3/17/
st
how am I going
to beat
that
?
L12 - Models of Computation 14
6.004 ā Spring 2009
3/17/
th
maybe if I gave
away a
microwave oven
with every
Turing Machine...
an N-way TIE!
Which model computes more functions?
L12 - Models of Computation 15
3/17/
Proof Technique:
Constructions that translate between models
Computability, independent of computation scheme chosen
Every discrete function computable
by ANY realizable machine is
computable by some Turing machine.
unproved, but
universallyaccepted...
L12 - Models of Computation 16
6.004 ā Spring 2009
3/17/
k
<x,y> =
nteger whose
even
bits come from x, and whose
odd
bits come from y;
whence
K
K
N
Equivalently: f(x) computable on Cray, Pentium, in C, Scheme, Java, ...
L12 - Models of Computation 17
3/17/
m
i
i
i
i
i
0
1
2
m
VERTICAL AXIS: Enumeration of TMās (computable functions)HORIZONTAL AXIS: Enumeration of input tapes.ENTRY AT (n, m): Result of applying m
th
TM to argument n
INTEGER k: TM halts, leaving k on tape.
: TM never halts.
arenāt
all
well-defined
integer functions
computable?
there are simply too many integer functions to fit in
our enumeration!
L12 - Models of Computation 18
6.004 ā Spring 2009
3/17/
THEOREM: f
H
is different from every function in our
enumeration of computable functions; hence it cannot becomputed by any Turing Machine.
Unfortunately, not every well-defined integer function is computable. The most famous
such function is the so-called Halting function, f
H
(k, j), defined by:
f
H
(k, j) = 1 if T
k
[ j] halts;
0 otherwise.
f
H
(k, j) determines whether the k
th
TM halts when given a tape containing j.
PROOF TECHNIQUE: āDiagonalizationā (after Cantor, Gƶdel)
If f
H
is computable, it is equivalent to some TM (say, T
H
Using T
H
as a component, we can construct another TM whose behavior
differs from every entry in our enumeration and hence must not becomputable.
Hence f
H
cannot be computable.
L12 - Models of Computation 19
3/17/
If f
H
is computable, it is equivalent to some TM (say, T
H
H
k
j
1 iff T
k
[ j] halts,
else 0
Then T
N
(N for āNastyā), which must be computable if T
H
is:
N
H
N
x
x
Finally, consider giving N as an argument to T
N
N
N
N
N
canāt be
computable, hence
H
canāt either!
x
L12 - Models of Computation 20
6.004 ā Spring 2009
3/17/
(clever proof technique used by Cantor, Gƶdel, Turing)
m
i
i
i
i
i
0
1
2
m
If T
H
exists, we can use it to construct T
N
. Hence T
N
is computable if T
H
is.
(informally we argue by Churchās Thesis; but we can show the actual T
N
construction, if pressed)
Why T
N
canāt be computable:
N
differs from every
computable functionfor at least oneargument ā along thediagonal of our table.Hence T
N
canāt be
among the entries inour table!
Hence no such T
H
can be constructed, even in theory.
Computable Functions:
A TINY SUBSET of all
Integer functions!
L12 - Models of Computation 25
6.004 ā Spring 2009
3/17/
enables
COMPILERS: analyze, optimize, transform behavior
Composition, iteration,abstraction of coded behavior
F(x) = g(h(x), p((q(x)))
COMPILER-X-to-Y
X
Y
, such that
X
X
, z] = T
Y
Y
, z]
LANGUAGE DESIGN: Separate specification
from implementation
C, Java, JSIM, Linux, ... all run on X86,PPC, Sun, ...
Parallel development paths:
Language/Software design
Interpreter/Hardware design
L12 - Models of Computation 26
6.004 ā Spring 2009
3/17/