Guest User

Untitled

a guest
Jan 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. `timescale 1ns / 1ps
  2.  
  3. module H2(start, rxrdy, reset, num12, dreq, clk, txrdy, rdy, incarca, depl, ddisp);
  4. input start, rxrdy, reset, num12, dreq, clk;
  5. output txrdy, rdy, incarca, depl, ddisp;
  6. reg txrdy, rdy, incarca, depl, ddisp;
  7. reg[2:0] s;
  8.  
  9. always@(posedge clk or reset or start or dreq or rxrdy)
  10. begin
  11. if(reset)
  12. begin
  13. s = 0;
  14. txrdy = 0;
  15. rdy = 1;
  16. incarca = 0;
  17. depl = 0;
  18. ddisp = 0;
  19. end
  20. else
  21. begin
  22. if(s == 0)
  23. begin
  24. if(start)
  25. begin
  26. s = 1;
  27. rdy = 0;
  28. incarca = 1;
  29. end
  30. end
  31. else if (s == 1)
  32. begin
  33. incarca = 0;
  34. ddisp = 1;
  35. s = 2;
  36. end
  37. else if (s == 2)
  38. begin
  39. if (dreq)
  40. begin
  41. s = 3;
  42. ddisp = 0;
  43. depl = 1;
  44. end
  45. end
  46. else if (s == 3)
  47. begin
  48. s = 4;
  49. end
  50. else if (s == 4)
  51. begin
  52. if(num12)
  53. begin
  54. s = 5;
  55. txrdy = 1;
  56. depl = 0;
  57. end
  58. end
  59. if (s == 5)
  60. begin
  61. depl = 0;
  62. if (rxrdy)
  63. begin
  64. s = 0;
  65. txrdy = 0;
  66. rdy = 1;
  67. end
  68. else
  69. s = 5;
  70. end
  71. end
  72. end
  73.  
  74.  
  75. endmodule
Add Comment
Please, Sign In to add comment