Question

In: Electrical Engineering

Currently, this model detects the overlapping sequence "101" ----> REDESIGN the Moore FSM below to detect...

Currently, this model detects the overlapping sequence "101" ----> REDESIGN the Moore FSM below to detect the NEW sequence "011" , simulate using the same test bench, and create a Moore Transition Diagram for the new sequence 011.

module moore_seq
(
   input clock, reset, x,
   output reg z
);
//assign binary encoded codes to the states A through D
parameter
   A = 2'b00,
   B = 2'b01,
   C = 2'b10,
   D = 2'b11;
reg [1 : 0] current_state, next_state;

//Section 1: Next state generator (NSG)
always@(*)
begin
   casex (current_state)

   A: if ( x == 1)
       next_state = B;

   else

       next_state = A;

   B: if (x ==1)
       next_state = B;

   else

       next_state = C;

   C: if (x == 1)
       next_state = D;

   else

       next_state = A;

   D: if (x == 1)
       next_state = B;

   else

       next_state = C;

   endcase
end

//Section 2: Output generator
always@(*)
begin
   if (current_state == D)
       z = 1;
   else
       z = 0;
end


//Section 3: The Flip-flops
always@(posedge clock, posedge reset)
begin
   if (reset == 1)
       current_state <= A;

   else

       current_state <= next_state;
   end

endmodule

// This the test bench

`include "moore_seq.v"

module moore_seq_tb();

reg clock, reset, x;

wire z;

moore_seq u1(clock, reset, x, z);


initial begin
$monitor("%4d: z = %b", $time, z);
clock = 0;
reset = 1;
x = 0;
#10 reset = 0;
end


always begin
#5clock = ~clock;
end

initial begin

#10 x = 1; $display("%4d: x = %b", $time, x);
#10 x = 1; $display("%4d: x = %b", $time, x);
#10 x = 1; $display("%4d: x = %b", $time, x);
#10 x = 0; $display("%4d: x = %b", $time, x);
#10 x = 1; $display("%4d: x = %b", $time, x);
#10 x = 0; $display("%4d: x = %b", $time, x);
#10 x = 1; $display("%4d: x = %b", $time, x);
#10 x= 1; $display("%4d: x = %b", $time, x);
#10 x = 0; $display("%4d: x = %b", $time, x);
#10 x= 0; $display("%4d: x = %b", $time, x);
#10 $finish;
end
endmodule

Solutions

Expert Solution

//verilog code for 011 moore FSM

module moore_seq

(

input clock, reset, x,

output reg z

);

//assign binary encoded codes to the states A through D

parameter

A = 2'b00,

B = 2'b01,

C = 2'b10,

D = 2'b11;

reg [1 : 0] current_state, next_state;

//Section 1: Next state generator (NSG)

always@(*)

begin

casex (current_state)

A: if ( x == 1)

next_state = A;

else

next_state = B;

B: if (x ==1)

next_state = C;

else

next_state = B;

C: if (x == 1)

next_state = D;

else

next_state = B;

D: if (x == 1)

next_state = A;

else

next_state = B;

endcase

end

//Section 2: Output generator

always@(*)

begin

if (current_state == D)

z = 1;

else

z = 0;

end

//Section 3: The Flip-flops

always@(posedge clock, posedge reset)

begin

if (reset == 1)

current_state <= A;

else

current_state <= next_state;

end

endmodule

// This the test bench

'include "design.sv"

module moore_seq_tb();

reg clock, reset, x;

wire z;

moore_seq u1(clock, reset, x, z);

initial begin

$monitor("%4d: z = %b", $time, z);

clock = 0;

reset = 1;

x = 0;

#10 reset = 0;

end

always begin

#5clock = ~clock;

end

initial begin

#10 x = 1; $display("%4d: x = %b", $time, x);

#10 x = 1; $display("%4d: x = %b", $time, x);

#10 x = 1; $display("%4d: x = %b", $time, x);

#10 x = 0; $display("%4d: x = %b", $time, x);

#10 x = 1; $display("%4d: x = %b", $time, x);

#10 x = 0; $display("%4d: x = %b", $time, x);

#10 x = 1; $display("%4d: x = %b", $time, x);

#10 x= 1; $display("%4d: x = %b", $time, x);

#10 x = 0; $display("%4d: x = %b", $time, x);

#10 x= 0; $display("%4d: x = %b", $time, x);

#10 $finish;

end

endmodule

// Simulation waveforms


Related Solutions

Can you explain the difference between overlapping and nonoverlapping in a moore sequence recognizer and mealy sequence recognizer?
  Can you explain the difference between overlapping and nonoverlapping in a moore sequence recognizer and mealy sequence recognizer?  
Derive a minimal state table for a Moore model FSM that acts as a three-bit parity...
Derive a minimal state table for a Moore model FSM that acts as a three-bit parity generator. For every three bits that are observed on inputw during three consecutive clock cycles, the FSM generates the parity bit outputq = 1 if the number of 1s received in the sequence so far is odd. Thus, this is an even parity generator. Implement the FSM as a circuit in Logisim Evolution. Note that the FSM outputs a 1 as long as the...
write the vhdl code to get the moore and mealy machine to detect the sequence 1101...
write the vhdl code to get the moore and mealy machine to detect the sequence 1101 (in c++)
Below is a segment of coding sequence from the overlapping Ink4A-Arflocus (top line) and protein sequence...
Below is a segment of coding sequence from the overlapping Ink4A-Arflocus (top line) and protein sequence from Ink4A(line 2, zero frame) and Arf(line 3, +2 frame). caggtcatgatgatgggcagcgcccgagtggcggagctgctgctgctccacggcgcggag Q  V  M M  M  G  S  A R  V  A  E  L L  L  L  H G  A  E G  H  D D  G  Q R  P  S G  G  A A  A  A  P  R  R  G -What bases could be used to maintain this Leucine codon in Ink4A but mutate the Proline codon in Arf? - What amino acid codons could be introduced into Arf Proline codon without changing the Ink4A Leucine codon? - What mutant amino acids may...
Seven Company produces a model fan, which currently has a net loss. Below are its sales...
Seven Company produces a model fan, which currently has a net loss. Below are its sales and costs Sales revenue $101,740 Less: Variable costs 64,930 Contribution margin $? Less: Direct fixed costs 57,394 Segment margin $? Less: Common fixed costs 53,226 Net operating income (loss) $? Eliminating the model fan product line would eliminate all of direct fixed costs. All of the common fixed costs would be redistributed to Seven's remaining product lines. By how much will Pope’s net operating...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT