SHARE
TWEET

alpha_lights_tb

grzemot Jun 19th, 2019 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 10 ns/ 1 ps
  2.  
  3. `define DELAY 1
  4.  
  5. module test_bench;
  6.  
  7. parameter ENDTIME  = 4000000;
  8.  
  9. reg clk, rst;
  10. wire [2:0]alpha,beta,gamma;
  11. //wire [2:0]beta;
  12. //wire [2:0]gamma;
  13. wire alpha_cond, beta_cond;
  14.  
  15. Alpha_lights tb(alpha, beta, gamma, alpha_cond, beta_cond, clk, rst);
  16.  
  17.  
  18. initial
  19.  begin
  20.  
  21.  rst = 0;
  22.  clk = 1'b0;
  23.  end
  24.  
  25. initial
  26.  begin
  27.  main;
  28.  end
  29. task main;
  30.  fork
  31.  clock_gen;
  32. reset_gen;
  33.  debug_output;
  34.  sim_end;
  35.  join
  36. endtask
  37. task clock_gen;
  38.  begin
  39.  forever #`DELAY clk = !clk;
  40.  end
  41. endtask
  42. task reset_gen;
  43.  begin
  44.  rst= 0;
  45.  #1
  46.  rst = 1;
  47.  #1000 rst =0;
  48.  #2000 rst =1;
  49.  end
  50. endtask
  51.  
  52.  
  53. task debug_output;
  54.  begin
  55.  
  56.  $display("----------------------------------------------");
  57.  $monitor("TIME = %d, alpha = %h, beta = %h, gamma =%h, alpha_cond = %h, beta_cond = %h",$time ,alpha, beta, gamma, alpha_cond, beta_cond );
  58.  end
  59. endtask
  60.  
  61.  
  62. task sim_end;
  63.  begin
  64.  #ENDTIME
  65.  $finish;
  66.  end
  67. endtask
  68.    
  69. endmodule
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top