Question

In: Computer Science

Design a finite state machine that accepts binary strings divisible by 5. Input is fed to...

Design a finite state machine that accepts binary strings divisible by 5. Input is fed to the FSM one bit at a time, from the most significant bit to the least significant bit (left to right). For example, 1010 should be accepted, but 1100 should be rejected. Clearly explain how you designed your state transitions. Showing the FSM alone is worth minimal credit!

Solutions

Expert Solution

We want to design a finite state machine that accepts binary string which is divisible by 5.We know that every natural numbers can be represented as,

5m(remainder 0 when divide by 5)

5m+1(remainder 1 when divide by 5)

5m+2(remainder 2 when divide by 2)

5m+3(remainder 3 when divide by 5)

5m+4(remainder 4 when divide by 5).

In our FSM we use these variables as 5 states.

To design the FSM, we also know that every binary numbers will become double if left shift them and add 0 to the first position.

For example, 10 represents 2

If we left shift 10 and add 0 to its first position, it will become 100=4(double of 2)

Also we know, if we add 1 at the first position after left shifting the binary number, the result will be double+1.

For example, 10 represents 2

If we left shift and add 1 to its first position, it will become 101=5(double of 2+1)

This concept is used to implement the FSM.

Let, 5m be the initial state, if we double it, it become 10 and it is divisible by 5.Which means in state 5m, if we give 0, it will retain in the same state.

Similarly, if we double and add 1to it, it will become 10m+1(remainder 1, when divide by 5) which means when 1 is given to 5m it will go to the state 5m+1.

All the other state can apply the same concept which is applied to state 5m.Then we will get the FSM that accept the binary string which is divisible by 5.The final FSM is shown below,


Related Solutions

Create a Deterministic finite automaton that takes in binary strings and accepts them which has both...
Create a Deterministic finite automaton that takes in binary strings and accepts them which has both an odd number of zeros and a sum that is divisible by 3 (but no others). For example, 0111 should be accepted, but not 011 or 111.
Design B: Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector...
Design B: Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector that contains the sequence of ‘10’. If the sequence ‘10’ is detected, the output Z should go high. The input is to be named W, the output is to be named Z, a Clock input is to be used and an active low reset signal (Resetn) should asynchronously reset the machine. a) Draw the Mealy-type state diagram for the FSM. b) Write the VHDL...
Write a progrm that accepts two strings as input, then indicates if the two strings are...
Write a progrm that accepts two strings as input, then indicates if the two strings are equal when the case of individual letters is ignored. Sample runs are shown below. Use C++ Enter two strings. String 1: PROgraM String 2: proGram PROgraM and proGram are equal. Enter two strings. String 1: litter String 2: LittLe litter and LittLe are not equal.
Using behavioral VHDL, design a Moore-type finite state machine that detects input test vector that contains...
Using behavioral VHDL, design a Moore-type finite state machine that detects input test vector that contains the sequence of ‘100’. If the sequence ‘100’ is detected, the output Z should go high. The input is to be named W, the output is to be named Z, a Clock input is to be used and an active low reset signal (Resetn) should asynchronously reset the machine. a) Draw the Moore-type model state diagram for the FSM. b) Write the VHDL code...
Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector that contains...
Using behavioral VHDL, design a Mealy-type finite state machine that detects input test vector that contains the sequence of ‘100’. If the sequence ‘100’ is detected, the output Z should go high. The input is to be named W, the output is to be named Z, a Clock input is to be used and an active low reset signal (Resetn) should asynchronously reset the machine. a) Draw the Mealy-type state diagram for the FSM. b) Write the VHDL code to...
Construct a finite-state machine, using combinational logic for an apple vending machine that only accepts nickels...
Construct a finite-state machine, using combinational logic for an apple vending machine that only accepts nickels (5 cents). When 15 cents is deposited the user can push a button to receive an apple and the machine resets. If the user inserts more than 15 cents no money will be returned. What are the machine states? What are the inputs? What are the outputs? Draw state table Draw state diagram Write the combinational logic for next state and output Explain if...
Construct a finite-state machine, using combinational logic for an apple vending machine that only accepts nickels...
Construct a finite-state machine, using combinational logic for an apple vending machine that only accepts nickels (5 cents). When 15 cents is deposited the user can push a button to receive an apple and the machine resets. If the user inserts more than 15 cents no money will be returned. What are the machine states? What are the inputs? What are the outputs? Draw state table Draw state diagram Write the combinational logic for next state and output Explain if...
Consider a finite state machine with a control input called mode. When mode = 0, the...
Consider a finite state machine with a control input called mode. When mode = 0, the machine operates as a mod-3 down counter, where the outputs are the count values. When mode = 1, the machine's output progresses through the last 4 digits of your WCU ID (1133) number (1 digit per clock cycle). Complete each of the steps which follow. (a) Draw the state diagram for this machine. (b) Write RTL Verilog code which implements this design. Submit your...
Design a state machine to recognize if a binary string contains any occurrence of the sequence...
Design a state machine to recognize if a binary string contains any occurrence of the sequence “10101”. Is it possible to design this state machine with less states? By using Finite State machine designer. http://madebyevan.com/fsm/
With being given two n-bit binary strings, verify if the strings are identical or not. Design...
With being given two n-bit binary strings, verify if the strings are identical or not. Design a procedure showing all steps and write a pseudo-code. What is the complexity of the procedure? If it can tolerate some error, is there a better than linear time solution? If so, write the pseudo-code.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT