Projektdaten für das ESY1B Praktikum im Sommersemester 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Fsm.sv 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. module Fsm
  2. (
  3. input wire clk,
  4. input wire inAlarmAmpel,
  5. input wire inDataValid,
  6. input wire inTasteAktiv,
  7. output logic outAlarm_R,
  8. output logic outSendData,
  9. output logic outTimerEN
  10. );
  11. real IDLE = 0;
  12. real ALARM = 1;
  13. logic state;
  14. initial begin
  15. #0 state <= IDLE;
  16. #0 outAlarm_R <= 0;
  17. #0 outSendData <= 0;
  18. #0 outTimerEN <= 0;
  19. end
  20. always @(posedge clk) begin
  21. case(state)
  22. IDLE: begin
  23. if(inDataValid) begin
  24. outSendData <= 1;
  25. end
  26. else begin
  27. outSendData <= 0;
  28. end
  29. if(inAlarmAmpel) begin
  30. outAlarm_R <= 1;
  31. state <= ALARM;
  32. end
  33. end
  34. ALARM: begin
  35. if(inDataValid) begin
  36. outSendData <= 1;
  37. end
  38. else begin
  39. outSendData <= 0;
  40. end
  41. if(inTasteAktiv) begin
  42. outAlarm_R <= 0;
  43. state <= IDLE;
  44. end
  45. end
  46. default: ;
  47. endcase
  48. end
  49. endmodule