Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

fsmCompute takes one bit at a time as input. Fill in the blanks below so that it behaves as according to the FSM above. ***Hint:

fsmCompute takes one bit at a time as input. Fill in the blanks below so that it behaves as according to the FSM above. ***Hint: your expressions from the previous should come in handy, along with some bitwise operators. Also, note how the state is a static variable, so it is maintained across function calls.

Hint: x is a signed int, so be careful, ~0 == -1 != 1. Also, you cannot use the logical operators, only bitwise operators.

 /* Called once per "clock cycle." Assume input x is 0 or 1. Updates state and outputs FSM output (0 or 1). */ int fsmCompute(int x) { int output; static unsigned int curr_state = 0x1; static unsigned int next_state = 0x1; curr_state = _______________________; output = ___________________________; next_state = _______________________; return output; }

(a) curr_state =________

0

1

next_state

~next_state

curr_state

~curr_state

x

~x

((x)&curr_state)

((x)&curr_state&1)

((~x)&curr_state)

((~x)&curr_state&1)

(((x&~(curr_state >> 1)) << 1) | ((~x)))

(((~(curr_state >> 1)) << 1) | ((~x)&1))

(((x&~(curr_state >> 1)) << 1) | ((~x)&1))

(((x&~(curr_state << 1)) >> 1) | ((~x)&1))

(b) output =________

0

1

next_state

~next_state

curr_state

~curr_state

x

~x

((x)&curr_state)

((x)&curr_state&1)

((~x)&curr_state)

((~x)&curr_state&1)

(((x&~(curr_state >> 1)) << 1) | ((~x)))

(((~(curr_state >> 1)) << 1) | ((~x)&1))

(((x&~(curr_state >> 1)) << 1) | ((~x)&1))

(((x&~(curr_state << 1)) >> 1) | ((~x)&1))

(c) next_state =________

0

1

next_state

~next_state

curr_state

~curr_state

x

~x

((x)&curr_state)

((x)&curr_state&1)

((~x)&curr_state)

((~x)&curr_state&1)

(((x&~(curr_state >> 1)) << 1) | ((~x)))

(((~(curr_state >> 1)) << 1) | ((~x)&1))

(((x&~(curr_state >> 1)) << 1) | ((~x)&1))

(((x&~(curr_state << 1)) >> 1) | ((~x)&1))

***Hint: Expression from previous part:

Come up with the MOST simplified boolean expressions for determining bits for the next state and the output bit given the current state and the input bit.

We'll label the input bit as In, and the left bits as Cur_1 and Next_1 for start state and next state left bits, respectively, and do the same for right bits Cur_0 and Next_0.

Format your answer using C syntax for bit operations:

Answer was:

Out = Cur_0 * ~In Next1 = ~Cur_1 * In Next0 = ~In

Hope this hint is helpfull

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions