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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [camera_link/] [cl_area_scan_checker.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 qaztronic
//
2
//
3
//
4
 
5
 
6
module cl_area_scan_checker
7
  (
8
    input               cl_fval,
9
    input               cl_lval,
10
    input               cl_dval,
11
    input       [63:0]  cl_data,
12
    input               cl_clk,
13
 
14
    input               cl_reset
15
  );
16
 
17
  // --------------------------------------------------------------------
18
  //
19
  localparam FPA_FS1  = 14'h3fff;
20
  localparam FPA_FS2  = 14'h3ffe;
21
  localparam FPA_LS   = 14'h3ffd;
22
  localparam FPA_HB   = 14'h3ffc;
23
  localparam FPA_VB   = 14'h3ffb;
24
  localparam FPA_BLK  = 14'h3ff3;
25
  localparam FPA_IT   = 14'h3ff2;
26
  localparam FPA_EOD  = 14'h3ff1;
27
 
28
 
29
  // --------------------------------------------------------------------
30
  //
31
  wire [13:0] cl_pixel_counter;
32
  wire [15:0] cl_frame_x;
33
  wire [15:0] cl_frame_y;
34
  wire        cl_fval_fall;
35
  wire        cl_fval_rise;
36
  wire        cl_lval_fall;
37
  wire        cl_lval_rise;
38
  wire        cl_data_en;
39
  reg         cl_base_format = 0;
40
  reg         cl_full_format = 0;
41
 
42
  cl_util
43
    util
44
    (
45
      .cl_fval(cl_fval),
46
      .cl_lval(cl_lval),
47
      .cl_dval(cl_dval),
48
      .cl_data(cl_data),
49
      .cl_clk(cl_clk),
50
 
51
      .cl_base_format(cl_base_format),
52
      .cl_full_format(cl_full_format),
53
 
54
      .cl_fval_fall(cl_fval_fall),
55
      .cl_fval_rise(cl_fval_rise),
56
      .cl_lval_fall(cl_lval_fall),
57
      .cl_lval_rise(cl_lval_rise),
58
      .cl_data_en(cl_data_en),
59
 
60
      .cl_pixel_counter(cl_pixel_counter),
61
      .cl_frame_x(cl_frame_x),
62
      .cl_frame_y(cl_frame_y),
63
 
64
      .cl_reset(cl_reset)
65
    );
66
 
67
 
68
  // --------------------------------------------------------------------
69
  //
70
 
71
  task init;
72
  input integer fpa_outputs;
73
    begin
74
 
75
      cl_base_format = 0;
76
      cl_full_format = 0;
77
 
78
      if( (fpa_outputs == 1) | (fpa_outputs == 2) )
79
        begin
80
          $display( "-!- %16.t | %m: FPA with %0d outputs. Assuming Base CameraLink Format", $time, fpa_outputs );
81
          cl_base_format = 1;
82
        end
83
      else if( (fpa_outputs == 4) | (fpa_outputs == 8) )
84
        begin
85
          $display( "-!- %16.t | %m: FPA with %0d outputs. Assuming Full CameraLink Format", $time, fpa_outputs );
86
          cl_full_format = 1;
87
        end
88
      else
89
        begin
90
          $display( "-!- %16.t | %m: FPA with %0d not supported.", $time, fpa_outputs );
91
          $stop();
92
        end
93
 
94
    end
95
  endtask
96
 
97
  task disable_checker;
98
    begin
99
 
100
      cl_base_format = 0;
101
      cl_full_format = 0;
102
 
103
    end
104
  endtask
105
 
106
 
107
  // --------------------------------------------------------------------
108
  //
109
  task checker;
110
  input integer pixel_counter;
111
    begin
112
 
113
      if( cl_base_format )
114
        begin
115
          if( cl_data[15:0] != pixel_counter )
116
            begin
117
              log.inc_fail_count;
118
              $display( "-!- %16.t | %m: data error at pixel 0x%4x. Pixel is 0x%4x and should be 0x%4x", $time, pixel_counter, cl_data[15:0], pixel_counter );
119
            end
120
        end
121
      else if( cl_full_format )
122
        begin
123
          if( (cl_data[15:0] != pixel_counter) | (cl_data[31:16] != (pixel_counter + 1)) | (cl_data[47:32] != (pixel_counter + 2)) | (cl_data[63:48] != (pixel_counter + 3)) )
124
            begin
125
              log.inc_fail_count;
126
              $display( "-!- %16.t | %m: data error somewhere between pixel 0x%4x and 0x%4x.", $time, pixel_counter, pixel_counter + 4 );
127
            end
128
        end
129
 
130
   end
131
  endtask
132
 
133
 
134
  // --------------------------------------------------------------------
135
  //
136
  always @(negedge cl_clk)
137
    if( cl_data_en )
138
      checker( cl_pixel_counter );
139
 
140
 
141
 
142
endmodule
143
 

powered by: WebSVN 2.1.0

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