Assignment 5 Hardware & Theory of Computation

advertisement
Assignment 5
Hardware & Theory of Computation
1-Consider the following circuit:
a. Write the appropriate logical expressions for the specified points. (Use the convention:
“+” for OR operation, “.” for AND operation and bar for negation.)
b. Draw the table of output (0-1 table) for this circuit as we did in class. Each row of the
table corresponds to a possible combination of input and the output of the circuit to
that output. (Hint: The table should have eight rows.)
c. According to the table you drew, based on input when the output is 1?
d. Think about an application of this circuit in a computer or any other machine (car,
washing machine, … )
2- Design a circuit with inputs A, B and C and output equal to following logical expression:
output = A.B.C + A’.(B + C) + A’.B’.C’
3- Design a circuit with inputs A and B and output O as specified in the following table:
A
B
O
1
1
0
1
0
0
0
1
1
0
0
0
4- Here is a Turing Machine program:
{ (1, 1, 1, R, 2), (2, 1, 1, R, 2), (2, blank, blank, R, 3), (3, 1, blank, L, 4), (4, blank, 1, R, 2) }
Write all the steps of the program (Content of the tape, location of the head and the state of the
control) like the way we did in class for the following input (initial configuration):
111b1111bbb…
^
5- Here is another TM program:
{ (1, 0, 1, R, 1), (1, 1 , 2, R, 1), (1 , 2, 3, R, 1), (1, 3, 4, R, 1), (1, 4, 5, R, 1), (1, 5, 6, R, 1), (1, 6, 7, R, 1),
(1, 7, 8, R, 1), (1, 8, 9, R, 1), (1, 9, 0, R, 1)}
Write all the steps of the program (Content of the tape, location of the head and the state of the
control) like the way we did in class for the following input (initial configuration):
17289302bbb…
^
6- Write a TM program which removes the leading 0’s of a binary number (replace the leading 0’s with
b). Feel free to use any number of states (control states) you want.
Examples:
input:
0 0 0 1 0 1 1 0 1 b b b b … output : b b b 1 0 1 1 0 1 b b b b …
input:
0010000bbb…
output:
bb10000bbb…
input:
11101bbb…
output: 1 1 1 0 1 b b b …
Note: The position of the head when the program halts is not important.
7- Draw the output table for a 2*4 decoder (Input a is being passed to one of the four output lines (x0,
x2, x3, x4) based on two select lines):
8a) What is the reason for studying the Turing machine and TM programs, while there are much
more advanced machines and programs around us?
b)
Define a Turing machine algorithm. (Hint: combine the definition of algorithm with Turing
machine program.)
Download