Advertisement
kekellner

Lab10 - Ej04 - FF T y su Testbench

Nov 8th, 2021
2,407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module FF_T (input clk, reset, output reg Q);
  2.  
  3.     always @ (posedge clk or posedge reset)
  4.         if (reset)
  5.             Q <= 1'b0;
  6.         else
  7.             Q <= ~Q;
  8.  
  9. endmodule
  10.  
  11. module tb();
  12.  
  13.     reg clk, reset;
  14.     wire Q;
  15.  
  16.     FF_T DUT(clk, reset, Q);
  17.  
  18.     initial begin
  19.         $dumpfile("timing.vcd");
  20.         $dumpvars(0, tb);
  21.     end
  22.  
  23.     initial
  24.         #100 $finish;
  25.  
  26.     always
  27.         #5 clk = ~clk;
  28.  
  29.     initial begin
  30.         clk = 0; reset = 0;
  31.         #32
  32.         reset = 1;
  33.         #20
  34.         reset = 0;
  35.     end
  36.  
  37. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement