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.

testbench.sv 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // ==================================================================
  2. // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
  3. // ------------------------------------------------------------------
  4. // Copyright (c) 2017 by Lattice Semiconductor Corporation
  5. // ALL RIGHTS RESERVED
  6. // ------------------------------------------------------------------
  7. //
  8. // Permission:
  9. //
  10. // Lattice SG Pte. Ltd. grants permission to use this code
  11. // pursuant to the terms of the Lattice Reference Design License Agreement.
  12. //
  13. //
  14. // Disclaimer:
  15. //
  16. // This VHDL or Verilog source code is intended as a design reference
  17. // which illustrates how these types of functions can be implemented.
  18. // It is the user's responsibility to verify their design for
  19. // consistency and functionality through the use of formal
  20. // verification methods. Lattice provides no warranty
  21. // regarding the use or functionality of this code.
  22. //
  23. // --------------------------------------------------------------------
  24. //
  25. // Lattice SG Pte. Lt++++++++++++++++d.
  26. // 101 Thomson Road, United Square #07-02
  27. // Singapore 307591
  28. //
  29. //
  30. // TEL: 1-800-Lattice (USA and Canada)
  31. // +65-6631-2000 (Singapore)
  32. // +1-503-268-8001 (other locations)
  33. //
  34. // web: http://www.latticesemi.com/
  35. // email: techsupport@latticesemi.com
  36. //
  37. // --------------------------------------------------------------------
  38. //
  39. // Project: iCE5UP 5K RGB LED Tutorial
  40. // File: testbench.v
  41. // Title: LED PWM control
  42. // Description: Creates RGB PWM per control inputs
  43. //
  44. //
  45. // --------------------------------------------------------------------
  46. //
  47. //------------------------------------------------------------
  48. // Notes:
  49. //
  50. //
  51. //------------------------------------------------------------
  52. // Development History:
  53. //
  54. // __DATE__ _BY_ _REV_ _DESCRIPTION___________________________
  55. // 04/05/17 RK 1.0 Initial tutorial design for Lattice Radiant
  56. //
  57. //------------------------------------------------------------
  58. // Dependencies:
  59. //
  60. //
  61. //
  62. //------------------------------------------------------------
  63. //------------------------------------------------------------
  64. //
  65. //
  66. // Testbench
  67. //
  68. //------------------------------------------------------------
  69. `timescale 1ns/1ps
  70. module tb;
  71. //GSR GSR_INST ( .GSR(1));
  72. //PUR PUR_INST ( .PUR(1));
  73. reg clk12M;
  74. reg rst;
  75. reg [9:0]data_input;
  76. reg data_valid;
  77. wire RED;
  78. wire GRN;
  79. wire alarm;
  80. led_top dut(.clk12M(clk12M),
  81. .rst(rst),
  82. .data_input(data_input),
  83. .data_valid(data_valid),
  84. .RED(RED),
  85. .GRN(GRN),
  86. .alarm(alarm)
  87. );
  88. initial
  89. begin
  90. clk12M=1'b0;
  91. end
  92. always
  93. #41.666666 clk12M=~clk12M; //clock generation
  94. initial
  95. begin
  96. rst=1'b1;
  97. data_input=10'b0000000010; // data for green
  98. data_valid=1'b0;
  99. #500000
  100. rst=1'b0;
  101. #500000
  102. data_valid = 1'b1;
  103. #500000
  104. data_valid = 1'b0;
  105. #500000
  106. rst=1'b1;
  107. #500000
  108. rst=1'b0;
  109. data_valid=1'b1;
  110. data_input=10'b1000000001; // data for yellow
  111. #500000
  112. data_valid=1'b0;
  113. data_input = 10'b1100000001; //data for red
  114. #500000
  115. data_valid = 1'b1;
  116. #500000
  117. data_input=10'b1000000001; // data for yellow
  118. #500000
  119. rst=1'b1;
  120. #500000
  121. $stop;
  122. end
  123. initial
  124. begin
  125. $monitor("time=%t,rst=%d,",$time,rst);
  126. end
  127. endmodule