Advertisement
Sidsh

LED_tb

Feb 1st, 2022
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns/1ns
  2.  
  3. module LED_tb;
  4. //inputs
  5. reg[2:0] hl;
  6. reg hl1;
  7. reg [2:0] id;
  8. reg clk;
  9.  
  10. //output
  11. wire r1;
  12. wire g2;
  13. wire b3;
  14.  
  15. //instantiate unit under test
  16.  
  17. LED uut (
  18. .hl(hl) ,
  19. .hl1(hl1),
  20. .id(id),
  21. .clk_50(clk),
  22. .r1(r1),
  23. .g2(g2),
  24. .b3(b3)
  25. );
  26.  
  27. initial begin
  28.      // Initialize Inputs
  29. $monitor(" ",hl," ",hl1," ",id," ",r1," ", g2," ",b3);
  30.  
  31.  $dumpfile("LED.vcd");
  32.     $dumpvars;
  33.     $dumpvars(6,hl,hl1,id,r1,g2,b3);
  34.    
  35.   end
  36. always begin
  37.    
  38.     clk = 0; #10;
  39.     clk = 1; #10;
  40.    
  41. end
  42. initial begin
  43.  id = 1;hl = 0;
  44.  end
  45. always@(posedge clk)
  46. begin
  47. id[2:0] = 3'b001;hl = 0; #10000;
  48. id[2:0] = 3'b010; hl = 1; #10000;
  49. id[2:0] = 3'b011; hl =2 ;#10000;
  50. id[2:0] = 3'b001;hl = 3; #10000;
  51. id[2:0] = 3'b010; hl = 4; #10000;
  52. id[2:0] = 3'b011; hl =5 ;#10000;
  53. id[2:0] = 3'b001;hl = 6; #10000;
  54. id[2:0] = 3'b010; hl = 7; #10000;
  55. id[2:0] = 3'b011; hl = 8;#10000;
  56. end
  57.  
  58. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement