Question

In: Electrical Engineering

1. Using Moore machine approach design a sequence detector with one input and one output. When...

1. Using Moore machine approach design a sequence detector with one input and one output. When input sequence 010 occurs the output becomes 1 and remains 1 until the sequence 010 occurs again in which case the
output returns to 0. The output remains 0 until, 010 occurs the third time, and so on. Your design should be able to handle overlapping sequences, i.e., input sequence 11001010100 should produce the output 00000110011.
Implement your detector using D flip-flops and the combinatorial gates of your
choice in Behavioral Verilog. Design a behavioral test
circuit which generates the test sequence shown above: ”11001010100”.

Code in VERILOG

Solutions

Expert Solution

module moore_fsm (clk, rst,w, z);
input clk;
input rst;
input w;
output reg z;

parameter S0 = 3'b000,
S1 = 3'b000,
S2 = 3'b010,
S3 = 3'b011,
S4 = 3'b100,
S5 = 3'b101;

//Internal reg and wires decalarations
reg [2:0] cur_state, next_state;

// current state logic
always @(posedge clk)
begin
if(rst)
cur_state <= S0;
else
cur_state <= next_state;
end

// Logic for next state and output
always @(*)
begin
case(cur_state)
S0 : begin
z = 1'b0;
next_state = w ? S0 : S1;
end

S1 : begin
z = 1'b0;
next_state = w ? S2 : S1;
end

S2 : begin
z = 1'b0;
next_state = w ? S0 : S1;
end

S3 : begin
z = 1'b1;
next_state = w ? S4 : S3;
end

S4 : begin
z = 1'b1;
next_state = w ? S5 : S1;
end

S5 : begin
z = 1'b1;
next_state = w ? S5 : S3;
end

default : begin
z = 1'b0;
next_state = S0;
end
endcase
end

endmodule


module moore_fsm_tb;
// Inputs
reg clk;
reg rst;
reg w;

// Outputs
wire z;

// Instantiate the Unit Under Test (UUT)
moore_fsm uut (
   .clk(clk),
   .rst(rst),
   .w(w),
   .z(z)
);

always
#5 clk = !clk;

initial
begin
$monitor("rst = %d, w = %d, z = %d", rst, w, z);
       // Initialize Inputs
       clk = 1'b0; rst = 1'b1;
       w = 1'b1; #10;
       rst = 1'b0;
       w = 1'b1; #10;
       w = 1'b1; #10;
       w = 1'b0; #10;
       w = 1'b0; #10;
       w = 1'b1; #10;
       w = 1'b0; #10;
       w = 1'b1; #10;
       w = 1'b0; #10;
       w = 1'b1; #10;
       w = 1'b0; #10;
       w = 1'b0; #10;
   $finish;
end
  
endmodule


Related Solutions

Design a detector for the input sequence X = 01011. The output Y must be 1...
Design a detector for the input sequence X = 01011. The output Y must be 1 when the sequence is detected, 0 in any other case. Draw the status diagram and generate a status table. Using the status table, design a logic circuit that generates the output function using T-type flip-flops. Please help me! Thanks!!!!
design a sequence detector that detects the sequence: 110. The device has one input x and...
design a sequence detector that detects the sequence: 110. The device has one input x and one output Y. When the input sequence is set to 1 followed by a 1 followed by a 0, then Y is set to 1 otherwise Y is set to 0. Use J-K flip-flops and minimum number of states is designing this detector and show the followings: a) Show the state diagram b)Show the state table for this detector
Design a Moore state machine that has an input w and an output z that should...
Design a Moore state machine that has an input w and an output z that should output a ‘1’ when the previous 4 values of w were 1001 or 1111. Overlapping patterns are allowed. Show the state diagram and state table. Use a simple binary counting order for the state assignment. Derive all of the next-state and output equations. You do not need to draw the resulting circuit, instead write a Verilog module for it.
1. Design a sequence detector, a Mealy finite state machine to detect the serial bit sequence...
1. Design a sequence detector, a Mealy finite state machine to detect the serial bit sequence 1101, where the most significant bit (MSB) comes first and the least significant bit comes last. A) Draw the state diagram B) Draw the state table C) The circuit is to be implemented using JK flip-flops and combinational logic circuit. Derive the Boolean expression necessary for this implementation. D) Sketch the circuit diagram for your design. This should show all the flipflops, logic gates...
Design a Mealy state diagram for a sequence detector that has a single input and a...
Design a Mealy state diagram for a sequence detector that has a single input and a single output. The output is to be “1” unless the input has been “0” for four consecutive clock pulses or “1” for three consecutive pulses. Implement your design using D flip-flops and any logic gates. Assume non-overlapping input sequences are to be detected.
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...
Design a system with one input called “Up” such that when “Up” equals 1, the machine...
Design a system with one input called “Up” such that when “Up” equals 1, the machine counts 2, 3, 4, 5, 6, and repeat. If the “Up” input equals 0, the machine counts down 6, 5, 4, 3, 2, and repeat. Show the State Transition Diagram, State Transition table, K-maps, and equations assuming JK flip flops and AND/OR/NOT combinational logic. Make sure to indicate on your State Transition Diagram what happens if the system initially is in one of the...
A sequence detector is monitoring a serial input stream looking for either 0101 or 0110. The...
A sequence detector is monitoring a serial input stream looking for either 0101 or 0110. The output is two consecutive cycles of 1’s, with the first of the two being asserted in the same cycle as the last input matching the sequence; in other words, it has to be a Mealy machine. Draw the state diagram for this sequence detector Assign states and create the state table, showing next states and output as a function of current state and input....
Design a mealy machine that generates the output Z=1 when it detects an even number of...
Design a mealy machine that generates the output Z=1 when it detects an even number of 1s and odd number of zeros. Draw the state table and circuit diagram for it with D flipflops. Example of input is 00101 Example of output is 10011
Design a four-link mechanism when the motions of the input and the output links are governed...
Design a four-link mechanism when the motions of the input and the output links are governed by a function y = x2 and x varies from 0 to 2 with an interval of 1. Assume to vary from 50° to 150° and from 80° to 160°.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT