Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module sw10_2(
  2. input [9:0] SW,
  3. input [1:0] KEY,
  4. output [9:0] LEDR,
  5. output [0:6] HEX0);
  6. counter ex1(SW[0], KEY[0], cout);
  7. rom ex2(cout, KEY[0],q);
  8. proc ex3(q, SW[0], KEY[1], SW[9],LEDR[9], LEDR[8:0]);
  9. decoder_hex_16 ex4(cout, HEX0);
  10. endmodule
  11. module counter(Clear, Clock, Q);
  12. input Clear, Clock;
  13. output [2:0] Q;
  14. reg [2:0] Q;
  15. always @(posedge Clock)
  16. if (Clear)
  17. Q <= 2'b0;
  18. else
  19. Q <= Q + 1;
  20. endmodule
  21. module decoder_hex_16(
  22. input [3:0] liczba,
  23. output reg [0:6] H);
  24. always @(*)
  25. case (liczba)
  26. 0: H = 7'b0000001;
  27. 1: H = 7'b1001111;
  28. 2: H = 7'b0010010;
  29. 3: H = 7'b0000110;
  30. 4: H = 7'b1001100;
  31. 5: H = 7'b0100100;
  32. 6: H = 7'b0100000;
  33. 7: H = 7'b0001111;
  34. 8: H = 7'b0000000;
  35. 9: H = 7'b0000100;
  36. 10: H = 7'b0001000;
  37. 11: H = 7'b1100000;
  38. 12: H = 7'b0110001;
  39. 13: H = 7'b1000010;
  40. 14: H = 7'b0110000;
  41. 15: H = 7'b0111000;
  42. default: H = 7'b1111111;
  43. endcase
  44. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement