106k views
5 votes
Design a Finite State Moore Machine (FSM) that will take an arbitrary-sized integer as input, one bit at a time (starting from most significant bit), and return the remainder after this integer is divided by 5. This is also called as MOD 5 function. For example if the input number is 34, then its binary representation will be 100010 and 34 MOD 5 will return 4 as an output.

User Dutow
by
4.2k points

1 Answer

7 votes

Answer:

attached below

Step-by-step explanation:

Applying the state transition Formula

state - next = ( state *2 + in ) % 5

how this works : remainder of previous cycle is doubled to enable the calculation of the new remainder.

Input of current cycle is represented as either 1 or 0

since the dividing number = 5 . possible remainders = 1,2,3,4,0

each remainder is represented as :

S0 = zero remainder , S1 = 1 remainder , S2 = 2 remainder, S3 = 3 remainder,

S4 = 4 remainder

Design a Finite State Moore Machine (FSM) that will take an arbitrary-sized integer-example-1
User Arun Badole
by
4.9k points