Electrical Engineering help Show all work when complete Left

Electrical Engineering help? Show all work when complete.

Left 1 South (Reset) && Count 13 Right 1 otherwise otherwise S1 S3 SO S2 Locked 1 Locked 1 Locked 1 Left 1 Otherwise & & Center 1 Count 13 && Count 17 Right 1 S4 Count 7 Figure 8: Rotary Combination-Lock State Diagram The reset state is S0. This is indicated by the arrow labeled \"South 1\" pointing to the S0 node. This arrow differs from the other arrows in the diagram in that it does not represent a transition from one state to the next. Rather, it signifies the fact that no matter what state the machine is in, it will return to S0 when reset is asserted (i.e. \"South l\'\'). We can see that the FSM will remain in state S0 until the Right input is equal to 1\', indicating the knob is being rotated to the right. When this happens, the FSM will transition to S1, where it will remain until the knob is rotated to the left (i.e. Left I). Two transitions away from Si are possible when Left I. If Count 13, the FSM will move to state S2; otherwise, it will move back to SO. In other words, if the knob was at position 13 when it began rotating to the left, the first number combination was dialed in correctly, so the FSM will move to the next state; otherwise, it will move back to the starting state as though no combination was entered.

Solution

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Chegg
// Engineer: Kranthi Kumar
// Create Date: 23:25:20 11/18/2016
// Design Name:
// Module Name: combination_lock_fsm
// Project Name:
//////////////////////////////////////////////////////////////////////////////////
module combination_lock_fsm(
               output reg [2:0]state,
               output wire Locked, //assreted when locked
               input wire Right, Left, // indicate direction
               input wire [4:0] Count, // indicate position
               input wire Center, // the unlock button
               input wire Clk, South // clock and reset
               );
              
parameter s0=0;
parameter s1=1;
parameter s2=2;
parameter s3=3;
parameter s4=4;

assign Locked = (state==s0 ||state==s1 || state==s2)? 1 :0;
  

always@(posedge Clk or South) begin
   if(South) begin
       state<=s0;
   end else begin
       case(state)
       s0: if(Right==1) begin
               state <=s1;
           end
       s1: if(Left==1 && Count==13) begin
                   state<=s2;
           end else if(Left==1 && Count!=13) begin
                   state<=s0;
           end else state<=s1;
       s2: if(Right==1 && Count==7) begin
                   state<=s3;
           end else if(Right==1 && Count!=7) begin
                   state<=s0;
           end else state<=s2;
       s3: if(Center==1 && Count==17) begin
                   state<=s4;
           end else if(Center==1 && Count!=17) begin
                   state<=s0;
           end else state<=s3;   
       s4: state<=s4;
       endcase
   end
end
      
endmodule

Electrical Engineering help? Show all work when complete. Left 1 South (Reset) && Count 13 Right 1 otherwise otherwise S1 S3 SO S2 Locked 1 Locked 1 Loc
Electrical Engineering help? Show all work when complete. Left 1 South (Reset) && Count 13 Right 1 otherwise otherwise S1 S3 SO S2 Locked 1 Locked 1 Loc

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site