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.

Input sequence: 00100011000011100\text{Input sequence: } 00100011000011100
Output sequence: 00000001000001100\text{Output sequence: } 00000001000001100

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 ss, tt, bb and yy respectively.

Assume the initial state of the Mealy machine is 0.

What are the Boolean expressions corresponding to tt and yy in terms of ss and bb?

Choose one option
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 s=0s = 0: Initial state, representing that the circuit is outside a run of 1's (or just saw a 0).
  • State s=1s = 1: Representing that the circuit is inside a consecutive run of 1's.

Determine the next state tt and output yy for each combination of current state ss and input bit bb:

  1. Present state s=0s = 0, input b=0b = 0:
    The bit is 0 outside a run. Output y=0y = 0, next state t=0t = 0.
  2. Present state s=0s = 0, input b=1b = 1:
    This is the FIRST 1 of a run. It must be replaced by 0: output y=0y = 0. The machine enters the run state: next state t=1t = 1.
  3. Present state s=1s = 1, input b=0b = 0:
    The run of 1's has ended. Output y=0y = 0, next state t=0t = 0.
  4. Present state s=1s = 1, input b=1b = 1:
    This is a SUBSEQUENT 1 in the run. It must remain 1: output y=1y = 1, next state t=1t = 1.

Summarizing the truth table:

ss bb tt yy
0 0 0 0
0 1 1 0
1 0 0 0
1 1 1 1

From the table:

  • The next state column tt is exactly equal to the input bit bb: t=bt = b.
  • The output column yy is 1 only when both s=1s=1 and b=1b=1: y=sby = sb.

Thus, t=bt = b and y=sby = sb, which matches option B.

Final answer

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.