OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [basal/] [sim/] [tests/] [tb_PRBS-7/] [prbs_7_testbench.v] - Blame information for rev 50

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
// --------------------------------------------------------------------
2
//
3
// --------------------------------------------------------------------
4
 
5
`timescale 10ps/1ps
6
 
7
 
8
module
9
  prbs_7_testbench();
10
 
11
  // --------------------------------------------------------------------
12
  reg clock = 0;
13
 
14
  always
15
    #(20) clock <= ~clock;
16
 
17
 
18
  // --------------------------------------------------------------------
19
  reg reset = 1;
20
 
21
  initial
22
    begin
23
      reset <= 1'b1;
24
 
25
      repeat(3)
26
        @(posedge clock);
27
 
28
      reset <= 1'b0;
29
    end
30
 
31
 
32
  // --------------------------------------------------------------------
33
  wire [7:0] prbs_7_to_8_data_out;
34
 
35
  prbs_7_to_8 i_prbs_7_to_8
36
  (
37
    .data_in( 8'h0 ),
38
    .scram_en( 1'b1 ),
39
    .scram_rst( reset ),
40
    .data_out(prbs_7_to_8_data_out),
41
    .rst( reset ),
42
    .clk( clock )
43
  );
44
 
45
 
46
  // --------------------------------------------------------------------
47
  wire [13:0] prbs_7_to_14_data_out;
48
 
49
  prbs_7_to_14 i_prbs_7_to_14
50
  (
51
    .data_in( 14'h0 ),
52
    .scram_en( 1'b1 ),
53
    .scram_rst( reset ),
54
    .data_out(prbs_7_to_14_data_out),
55
    .rst( reset ),
56
    .clk( clock )
57
  );
58
 
59
 
60
  // --------------------------------------------------------------------
61
  //  LFSR pseudo-random  x^7 + x^6 + 1  
62
  reg [7:0] lfsr;
63
  wire      lfsr_feedback = lfsr[6] ^ lfsr[5];
64
 
65
  always @(posedge clock)
66
    if( reset )
67
      lfsr <= 8'hff;
68
    else
69
      lfsr <= {lfsr[6:0], lfsr_feedback};
70
 
71
 
72
  // --------------------------------------------------------------------
73
  integer i = 0;
74
  integer fh;
75
 
76
  initial
77
    begin
78
      fh = $fopen( "prbs_7.csv" );
79
      $fdisplay( fh, "count, parallel 8 bit, parallel 14 bit, serial" );
80
    end
81
 
82
  always @( posedge clock )
83
    begin
84
 
85
      if( ~reset )
86
        begin
87
          $display( "-#- %16.t | 0x%2x | 0x%4x | 0x%2x", $time, prbs_7_to_8_data_out, prbs_7_to_14_data_out, lfsr );
88
 
89
          $fdisplay( fh, "%d,'%2x,'%4x,'%2x", i, prbs_7_to_8_data_out, prbs_7_to_14_data_out, lfsr );
90
 
91
          i = i + 1;
92
        end
93
 
94
    end
95
 
96
endmodule
97
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.