Question

In: Computer Science

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++)

Solutions

Expert Solution

Question

VHDL code to get the moore and mealy machine to detect the sequence 1101.

Solution

Moore machine

module sd1101_moore(input bit clk,
                   input logic reset,
                   input logic din,
                   output logic dout);

typedef enum logic [2:0] {S0, S1, S2, S3, S4} state_t;
state_t state;

always @(posedge clk or posedge reset) begin
    if(reset) begin
      dout <= 1'b0;
      state <= S0;
    end
    else begin
      case(state)
        S0: begin
          dout <=1'b0;
          if(din)
            state <= S1;
        end
        S1: begin
          dout <= 1'b0;
          if(din)
            state <= S2;
          else
            state <= S0;
        end
        S2: begin
          dout <= 1'b0;
          if(~din)
            state <= S3;
        end
        S3: begin
          dout <= 1'b0;
          if(din)
            state <= S4;
          else
            state <= S0;
        end
        S4: begin
          dout <= 1'b1;
          if(din)
            state <= S1;
          else
            state <= S0;
        end
      endcase
    end
end
endmodule

Mealy Machine

module sd1101_mealy(input bit clk,
                   input logic reset,
                   input logic din,
                   output logic dout);

typedef enum logic [1:0] {S0, S1, S2, S3} state_t;
state_t state;

always @(posedge clk or posedge reset) begin
    if(reset) begin
      dout <= 1'b0;
      state <= S0;
    end
    else begin
      case(state)
        S0: begin
          if(din) begin
            state <= S1;
            dout <=1'b0;
          end
          else
            dout <=1'b0;
        end
        S1: begin
          if(din) begin
            state <= S2;
            dout <=1'b0;
          end
          else begin
            state <= S0;
            dout <=1'b0;
          end
        end
        S2: begin
          if(~din) begin
            state <= S3;
            dout <=1'b0;
          end
          else begin
            dout <=1'b0;
          end
        end
        S3: begin
          if(din) begin
            state <= S0;
            dout <=1'b1;
          end
          else begin
            state <= S0;
            dout <=1'b0;
          end
        end
      endcase
    end
end

endmodule


Related Solutions

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...
Write a VHDL code to implement a Finite State Machine that with an 8 bit sequence...
Write a VHDL code to implement a Finite State Machine that with an 8 bit sequence input (can be any sequence, but lets say it is 11001000), determine how many states there are as well; so if the input sequence is correct it will show the number 1 in a 7 segment display, otherwise it will be 0 in the same 7 segment display. If the input sequence is incorrect, start from the beginning.
Write a VHDL mealy state machine that detects the pattern 01110 in a stream of bits....
Write a VHDL mealy state machine that detects the pattern 01110 in a stream of bits. The machine should have three inputs; in, clk, reset. The output of the machine goes high whenever the pattern is detected.
for this set of assignment, Moore state machine Design a sequence detector to detect "001", where...
for this set of assignment, Moore state machine Design a sequence detector to detect "001", where 0 arrives first, then 0, then 1. You need to show the test sequences you used to confirm that your state diagram is operating correctly. When the complete "001" sequence has been detected, the output goes high. Otherwise, the output stays at zero. Shows your state diagram, state table, encoded state table (use minimized bit encoding), logic equations, and logic circuit. (30 points) 3....
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?  
Write the Verilog code and test bench for the following circuits: - Mealy State machine design...
Write the Verilog code and test bench for the following circuits: - Mealy State machine design for a Serial Adder Circuit - Moore State Machine design for a Serial Adder Circuit
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...
Write a program to detect the deadlock occurrence and write the sequence if there is a...
Write a program to detect the deadlock occurrence and write the sequence if there is a safe state. Noted: C or C++
design the '10' sequence detector by mealy and moore model using T f/f, D f/f, JK...
design the '10' sequence detector by mealy and moore model using T f/f, D f/f, JK f/f
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT