Professional Documents
Culture Documents
Chapter 8 Isct Caamp
Chapter 8 Isct Caamp
You cannot conceive the many without the one….The study of the unit is among
those that lead the mind on and turn it to the vision of reality.
Plato (428-348 BC), Greek philosopher, one of the most creative and influential thinkers in
Western philosophy.
Figure 8-1. A simple, single tape Turing machine with binary encoding. The tape is infinitely
long. The read/write head moves, and not the tape, to eliminate any concerns over the weight
of an infinite-length tape.
There are many variations on the single tape, multiple character set
Turing machine with infinite-length tape. There are machines that use
various symbol sets and two or more tapes and even two-dimensional tapes.
But all such machines can be shown to be equivalent [Turing36]. The most
important observation is that anything computable by a Turing machine is
computable by a more sophisticated and complex computer or processor.
The Böhm-Jacopini theorem states that only the three grammar rules,
sequence, selection, and repetition, are needed to construct any other
instructions or a program [Böhm66]. Since by the Church-Turing thesis all
processors are equivalent in power, the question of instruction set
completeness is one of effectively constructing a program, or having the
minimum functionality of instructions to do so.
8.1.3.1 Sequence
x: GOTO x+1
x+1: GOTO x+2
…
x+k: GOTO x+k+1
58 Chapter 8
8.1.3.2 Selection
Selection also implies that a single bit, true or false status register is
present. The instruction uses the condition of the status register to select
forward, or to default to a sequence statement.
8.1.3.3 Repetition
One type of instruction that does not fit in with the Böhm-Jacopini
Theorem’s formation rules is of the form:
If m < 0, then the form is repetition; if m > 0 then the form is sequence.
Implementing the GOTO instruction set using the three formation rules of
Böhm-Jacopini leads to some interesting observations.
Another way to express the table, is with the continuation equation in the
form of:
x → x + k
Table 8-3. State transition diagram showing transitions (Moore state machine)
State Next State
λ=0 λ=1
0 1 1
1 2 3
2 3 3
3 4 1
4 4 4
The graphical representation for this finite state machine is shown in Fig.
8-2.
Figure 8-2. State transition diagram showing transitions (Moore state machine).
Instruction Set Completeness 61
This state machine can be mapped to the hypothetical instruction set. The
state represents the address of the instruction, and the next state function
represents each instruction. If the next state function is constant regardless
of the symbol, then the GOTO instruction is used. If the next state function
is such that the next state is different based upon symbol, then a conditional
GOTO is used.
Using this approach, the state machine maps into the hypothetical GOTO
instruction set as:
The hypothetical GOTO instruction set can create any grammar formation
or state transition for a finite state machine. Given an existing finite state
machine, it can be mapped into the hypothetical GOTO instruction set, and in
principle, vice-versa.
; go to address x
GOTO x
When the status register is true, the GOTO on true will go to the address
specified. When false, it will go to the next address. If the address
conditional upon the status register being true is the next address, it will go
to the next address either way. Table 8-4 summarizes the behavior based
upon the status register, and what the effective instruction is given.
Table 8-4. Hypothetical GOTO behavior based upon the status register and what the effective
instruction is given.
Instruction Status Register (SR) Effective Instruction
x GOTO on true k true x GOTO k
x GOTO on true k false x GOTO x+1
x GOTO on true x+1 true x GOTO x+1
x GOTO on true x+1 false x GOTO x+1
x GOTO on true j ? x GOTO j GOTO x+1
The last row indicates that when the status register is not preset to true,
or reset to false, then the GOTO on true instruction will behave like a
selection formation rule. This is a subtle problem in the hypothetical GOTO
instruction set, and the finite state machine- the code is pre-existing. The
change of the status register to true or false will magically happen somehow,
but not through any means of the instruction set. The next state function is
independent of the hypothetical GOTO instruction set, so the instruction set is
not complete. By contradiction to the single instruction, GOTO on true,
demonstrates the incompleteness.
There are five principles that govern instruction set completeness. Four
focus on explicitly and implicitly modifying the state and next state
functions. The fifth principle specifies that there is statefulness in the state
and next state function. These principles, stated succinctly, are that in order
for an instruction set to be complete it must satisfy the following properties:
The principles seem self-evident, but are, in fact, subtle. State references
the current address where the instruction set is executing, and can refer to
the program counter, though this is not necessary. The next state function is
for conditionals and selection, and can refer to the status register, but again
this is not necessary. In fact, registers are just a convenient means to
represent information in a processor architecture, and make that information
available to the instruction set.
The principles do not state that one instruction every instruction can be
complete. If one instruction is to form a complete set, however, it must
satisfy the five principles.
Completeness Theorem
It was previously seen that the hypothetical GOTO instruction set was
not complete. This fact, however, can be seen in another way. The
hypothetical instruction set only satisfies some of the criteria for
completeness.
The hypothetical instruction set does not, however, satisfy the Explicit or
Implicit Next State Change Principles, which would be represented by an
instruction to change the single-bit status register. There are no instructions
to preset to true, reset to false, or to setthe single-bit of the status register by
a comparison. The GOTO instruction uses the next state function or status
register, but there is no means within the hypothetical GOTO instruction set
to alter it. Somehow, magically outside the instruction set the status register
single-bit is either true or false. Failing to alter the next state function, that is
the status register, illustrates something about the hypothetical GOTO
instruction set: it does not perform any processing of information. In essence
the GOTO x+1 at location x is a no operation or NOP instruction. The GOTO
x+1 could be eliminated from the instruction set as a 4-tuple instruction with
the next address or state as the fourth parameter. The GOTO if true would
have the third and fourth parameters as the if-true GOTO address, and next
address respectively.
By choice of the input symbol lambda λ and the next state function
parameter k, any of the three formation rules: sequence, selection, repetition
can be formed.
66 Chapter 8
Hence direct and indirect modification of the next state function (the
status register) and the state (the program counter) allows any possible state
under the simple alphabet Σ = {0,1} to be reached from any other state. The
program in question is determined by the exact nature of state transitions,
the parameter k of the next state function, and the symbol λ.
Definition
PROPOSITION 1
PROOF
PROPOSITION 2 (Böhm-Jacopini)
PROOF
See [Böhm66].
PROPOSITION 3
PROOF
The net result of Propositions 1 through 3 is that any instruction set that
can implement LOAD, STORE, INC and GOTO is functionally equivalent
to a realization of a Turing machine. Hence, if a single instruction type can
be found, and through clever manipulation can be used to induce the four
instructions, such an architecture is not only theoretically complete, but
functionally complete and powerful. This will be illustrated further
throughout the text.
8.3.1 SBN
To prove this it must be shown that SBN instruction can produce the 1-
address instructions LOAD, STORE, INC and GOTO. Then by Proposition
2, it follows trivially that SBN is complete. By Proposition 3, it will then
follow that any Turing computable program can be constructed.
68 Chapter 8
Case 1: LOAD
Case 2: STORE
Case 3: INC
Case 4: GOTO:
This has been shown that the SBN instruction set is compete and, hence,
by Proposition 3 can be used to construct any Turing computable program.
8.3.2 MOVE
And with the same hypothetical processor using the registers shown in
Table 8-8.
Table 8-8. Registers for the hypothetical processor described in Table 8-7.
Register Address
Program Counter 0x0000000
Processor Status 0x0000001
Accumulator 0x0000002
Most instructions are binary, taking two operands. In such a case, the
MOVE instruction must move two operands, but the processor operation is
located at only one memory address. This creates an operational
inconsistency, unless two MOVE operations to the same memory location
are required. By use of an accumulator register, a specialized area of
memory can be created that is used by all binary operations on the OISC
70 Chapter 8
Using this template the four necessary instructions, LOAD, STORE, INC
and GOTO can be synthesized as follows:
Case 1: LOAD
Case 2: STORE
CASE 3: INC
The INC instruction can by synthesized from the ADD instruction easily.
The ADD instruction is simply
Case 4: GOTO
The half adder architecture is complete and can be used to construct any
Turing computable program.
Instruction Set Completeness 71
8.4 Exercises