Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. module top_1
  2. (
  3. input CLK, // Тактовый сигнал 12 MHz
  4. inout [48:1] pio // GPIO, General-Purpose Input/Output
  5. );
  6.  
  7. wire clock = CLK;
  8. wire reset_n = ! pio [8];
  9.  
  10. reg [26:0] counter;
  11.  
  12. always @(posedge clock or negedge reset_n)
  13. begin
  14. if (! reset_n)
  15. counter <= 27'b0;
  16. else
  17. counter <= counter + 27'b1;
  18. end
  19.  
  20. wire [2:0] number = counter [25:23];
  21.  
  22. // a b c d e f g dp Буквы с картинки
  23. // 7 6 4 2 1 9 10 5 Выводы 7-сегментного индикатора
  24. // 7 6 5 4 3 2 1 Выводы сигнала pio РІ РџР›Р?РЎ
  25.  
  26. // --a--
  27. // | |
  28. // f b
  29. // | |
  30. // --g--
  31. // | |
  32. // e c
  33. // | |
  34. // --d--
  35.  
  36. reg [6:0] abcdefg;
  37.  
  38. always @*
  39. case (number)
  40. 3'h0: abcdefg = 7'b0000001;
  41. 3'h1: abcdefg = 7'b1110111;
  42. 3'h2: abcdefg = 7'b0010101;
  43. 3'h3: abcdefg = 7'b0111101;
  44. 3'h4: abcdefg = 7'b0000101;
  45. 3'h5: abcdefg = 7'b1001111;
  46. 3'h6: abcdefg = 7'b0111011;
  47. 'h7: abcdefg = 7'b0000000;
  48. /*4'h8: abcdefg = 7'b1111111;
  49. 4'h9: abcdefg = 7'b1111011;
  50. 4'ha: abcdefg = 7'b1110111;
  51. 4'hb: abcdefg = 7'b0011111;
  52. 4'hc: abcdefg = 7'b1001110;
  53. 4'hd: abcdefg = 7'b0111101;
  54. 4'he: abcdefg = 7'b1001111;
  55. 4'hf: abcdefg = 7'b1000111;*/
  56. endcase
  57.  
  58. assign pio [7:1] = abcdefg;
  59.  
  60. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement