Advertisement
tariq786

testbench_lcbbc

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