Advertisement
evage

testebench6

Nov 27th, 2022
1,623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2.  
  3. module testbench();
  4.  
  5.     reg clk1;
  6.     reg clk2;
  7.     wire res;
  8.     reg [7:0] args;
  9.     reg [0:31] error_reg;
  10.     initial begin
  11.         $dumpfile("dump.vcd");
  12.         $dumpvars;
  13.        
  14.     end
  15.     initial begin
  16.         clk1 = 0;
  17.         clk2 = 0;
  18.         args = 0;
  19.         error_reg = 0;
  20.     end
  21.        
  22.     always @(posedge clk1) begin
  23.         error_reg[args] = clk2 ~^ res;
  24.         args = args + 1;
  25.         if (args > 6'd100000) begin
  26.             $finish;
  27.         end
  28.     end
  29.     always #10 clk1 = ~clk1;
  30.     always begin
  31.         #10;
  32.         clk2 = ~clk2;
  33.         #270; // change to DIVIDER * 10 - 10
  34.     end
  35.    frequency_divider #(28) freq(.clock_in(clk1), .clock_out(res));
  36. endmodule
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement