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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [basal/] [sim/] [tests/] [tb_PRBS-23/] [prbs_23_to_8_testbench.v] - Blame information for rev 34

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_23_to_8_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_data_out;
34
 
35
  prbs_23_to_8 i_prbs_23_to_8
36
  (
37
    .data_in( 8'h0 ),
38
    .scram_en( 1'b1 ),
39
    .scram_rst( reset ),
40
    .data_out(prbs_data_out),
41
    .rst( reset ),
42
    .clk( clock )
43
  );
44
 
45
 
46
  // --------------------------------------------------------------------
47
  reg [7:0] prbs_data_out_1;
48
  reg [7:0] prbs_data_out_2;
49
  reg [7:0] prbs_data_out_3;
50
 
51
  always @( posedge clock )
52
    prbs_data_out_1 <= prbs_data_out;
53
 
54
  always @( posedge clock )
55
    prbs_data_out_2 <= prbs_data_out_1;
56
 
57
  always @( posedge clock )
58
    prbs_data_out_3 <= prbs_data_out_2;
59
 
60
  wire hit = (prbs_data_out == 8'h0a) & (prbs_data_out_1 == 8'h20) & (prbs_data_out_2 == 8'hf2) & (prbs_data_out_3 == 8'h4e);
61
 
62
  always @( negedge clock )
63
    if( hit == 1'b1 )
64
      $stop();
65
 
66
 
67
  // --------------------------------------------------------------------
68
  integer i = 0;
69
  integer fh;
70
 
71
  initial
72
    begin
73
      fh = $fopen( "prbs.csv" );
74
      $fdisplay( fh, "count, parallel 8 bit" );
75
    end
76
 
77
  always @( posedge clock )
78
    begin
79
 
80
      if( ~reset )
81
        begin
82
          $display( "-#- %16.t | 0x%2x", $time, prbs_data_out );
83
 
84
          $fdisplay( fh, "%d,'%2x", i, prbs_data_out );
85
 
86
          i = i + 1;
87
        end
88
 
89
    end
90
 
91
endmodule
92
 

powered by: WebSVN 2.1.0

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