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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 [1:0]color_sel;
  76. reg rw;
  77. wire REDn;
  78. wire BLUn;
  79. wire GRNn;
  80. wire RED;
  81. wire BLU;
  82. wire GRN;
  83. led_top dut(.clk12M(clk12M),
  84. .rst(rst),
  85. .color_sel(color_sel),
  86. .rw(rw),
  87. .REDn(REDn),
  88. .BLUn(BLUn),
  89. .GRNn(GRNn),
  90. .RED(RED),
  91. .BLU(BLU),
  92. .GRN(GRN)
  93. );
  94. initial
  95. begin
  96. clk12M=1'b0;
  97. end
  98. always
  99. #41.666666 clk12M=~clk12M; //clock generation
  100. initial
  101. begin
  102. rst=1'b1;
  103. color_sel=2'b01;
  104. RGB_Blink_En=1'b0;
  105. #1000
  106. rst=1'b0;
  107. #3000000
  108. color_sel=2'b11;
  109. #3000000
  110. $stop;
  111. end
  112. initial
  113. begin
  114. $monitor("time=%t,RGB_Blink_En=%d,rst=%d,color_sel=%2d, REDn=%d, BLUn=%d, GRNn=%d",$time,RGB_Blink_En,rst,color_sel,REDn,BLUn,GRNn);
  115. end
  116. endmodule