Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- logic [11:0] count;
- logic [9:0] state;
- logic [10:0] counter;
- logic [9:0] current_state;
- logic [9:0] state_out;
- logic mslong;
- logic sslong;
- logic [9:0] S0 = 10'b0011010001, S1=10'b0101010010, S2=10'b1001001010,
- S3=10'b1000100110, S4=10'b1000100110, S5=10'b1001001010, S6=10'b0101010010;
- /////////////////////////////////////////////////////////////////////
- always_ff @ (posedge clk or negedge rst_n) //laskuri ylös
- begin
- if (rst_n == '0)
- begin
- count <= '0;
- counter <= '0;
- current_state = S0;
- end
- else if (count == 3000)
- begin
- counter <= counter + 1;
- count = '0;
- end
- else
- begin
- count <= count + 1;
- end
- end
- /////////////////////////////////////////////////////
- ////////////////////////////////////////////////////
- always_comb
- begin : valologiikka
- case(current_state)
- S0:
- begin
- if(day == '0)
- begin
- if(counter == 30)
- begin
- if (ss_car == '1)
- begin
- current_state = S1;
- mslong = 0;
- counter = 0;
- end
- else
- begin
- mslong = 1;
- current_state = S0;
- end
- end
- else
- current_state = S0;
- end
- else
- begin
- if(counter == 30)
- begin
- current_state = S1;
- counter = 0;
- end
- else
- current_state = S0;
- end
- end
- S1:
- begin
- if (counter == 0)
- current_state = S1;
- else
- begin
- counter = 0;
- current_state = S2;
- end
- end
- S2:
- begin
- if (counter == 0)
- current_state = S2;
- else
- begin
- current_state = S3;
- counter = 0;
- end
- end
- S3:
- begin
- if (counter == 27)
- current_state = S4;
- else
- begin
- current_state = S4;
- counter = 0;
- end
- end
- S4:
- begin
- if(day == '0)
- begin
- if (counter == 1)
- begin
- if ( ms_car == '0)
- begin
- end
- end
- end
- end
- end
- S5:
- begin
- end
- S6:
- begin
- if (counter == 1)
- current_state = S0;
- else
- current_state = S6;
- end
- end: valologiikka
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement