tariq786

testbench_lcbbc

Oct 28th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //AUTHOR: Tariq Bashir
  2. //Testbench for unambiguous codes (lcbbc)
  3. //released into the public under GPL
  4.  
  5. `timescale 1ns/1ps
  6.  
  7. module tb_lcbbc;
  8.  
  9.   parameter N = 8;
  10.   parameter MIN_HD = 2;
  11.   parameter MEM_DEPTH=256;
  12.  
  13.   reg clk;
  14.   reg rst;
  15.   reg [N-1:0] n;
  16.   reg         start;
  17.   reg [N-1:0] min_hd;
  18.   wire [N-1:0] codes;
  19.  
  20.   initial
  21.     begin
  22.       clk <= 1'b0;
  23.       rst = 1'b1;
  24.     end
  25.  
  26.   always
  27.     #5 clk = ~clk;
  28.  
  29.  
  30.   initial
  31.     begin
  32.       repeat(10) @(negedge clk);
  33.       rst = 1'b0; //disable reset
  34.       @(negedge clk);
  35.       start = 1;
  36.       n = N;
  37.       min_hd = MIN_HD;
  38.     end
  39.  
  40.  
  41.   /* lcbbc AUTO_TEMPLATE
  42.    (
  43.    
  44.    );
  45.   */
  46.  
  47.   lcbbc #(.N(N),.depth(MEM_DEPTH),.width(N)) LCBBC_INST
  48.     (/*AUTOINST*/
  49.      // Outputs
  50.      .codes                             (codes[N-1:0]),
  51.      // Inputs
  52.      .clk                               (clk),
  53.      .rst                               (rst),
  54.      .n                                 (n[N-1:0]),
  55.      .min_hd                            (min_hd[N-1:0]),
  56.      .start                             (start));
  57.  
  58.  
  59. /* -----\/----- EXCLUDED -----\/-----
  60.   initial
  61.     begin
  62.       #15000;
  63.       $finish;
  64.     end
  65.  
  66.  -----/\----- EXCLUDED -----/\----- */
  67.   initial
  68.     begin
  69.       $monitor("codeword = %b\t ",codes);
  70.     end
  71.  
  72.  
  73. endmodule // tb_lcbbc
Advertisement
Add Comment
Please, Sign In to add comment