Question
Suppose we want to design a synchronous circuit that processes a string of 0's and 1's. Given a string, it produces another string by replacing the first 1 in any subsequence of consecutive 1's by a 0. Consider the following example.
A Mealy Machine is a state machine where both the next state and the output are functions of the present state and the current input.
The above mentioned circuit can be designed as a two-state Mealy machine. The states in the Mealy machine can be represented using Boolean values 0 and 1. We denote the current state, the next state, the next incoming bit, and the output bit of the Mealy machine by the variables , , and respectively.
Assume the initial state of the Mealy machine is 0.
What are the Boolean expressions corresponding to and in terms of and ?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2021 answer key
Solution
Construct the state transition and output table of the two-state Mealy machine based on the required sequence transformation.
The circuit processes an input bit stream and replaces the first 1 of any consecutive sequence of 1's with a 0, while keeping subsequent 1's as 1, and keeping 0's as 0.
- State : Initial state, representing that the circuit is outside a run of 1's (or just saw a 0).
- State : Representing that the circuit is inside a consecutive run of 1's.
Determine the next state and output for each combination of current state and input bit :
- Present state , input :
The bit is 0 outside a run. Output , next state . - Present state , input :
This is the FIRST 1 of a run. It must be replaced by 0: output . The machine enters the run state: next state . - Present state , input :
The run of 1's has ended. Output , next state . - Present state , input :
This is a SUBSEQUENT 1 in the run. It must remain 1: output , next state .
Summarizing the truth table:
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
From the table:
- The next state column is exactly equal to the input bit : .
- The output column is 1 only when both and : .
Thus, and , which matches option B.
B
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 38 of 65, printed as CS Q.28
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.