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 30

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
  //
20
  wire [13:0] cl_pixel_counter;
21
  wire [15:0] cl_frame_x;
22
  wire [15:0] cl_frame_y;
23
  wire        cl_fval_fall;
24
  wire        cl_fval_rise;
25
  wire        cl_lval_fall;
26
  wire        cl_lval_rise;
27
  wire        cl_data_en;
28
  reg         cl_base_format = 0;
29
  reg         cl_full_format = 0;
30
 
31
  cl_util
32
    util
33
    (
34
      .cl_fval(cl_fval),
35
      .cl_lval(cl_lval),
36
      .cl_dval(cl_dval),
37
      .cl_data(cl_data),
38
      .cl_clk(cl_clk),
39
 
40
      .cl_base_format(cl_base_format),
41
      .cl_full_format(cl_full_format),
42
 
43
      .cl_fval_fall(cl_fval_fall),
44
      .cl_fval_rise(cl_fval_rise),
45
      .cl_lval_fall(cl_lval_fall),
46
      .cl_lval_rise(cl_lval_rise),
47
      .cl_data_en(cl_data_en),
48
 
49
      .cl_pixel_counter(cl_pixel_counter),
50
      .cl_frame_x(cl_frame_x),
51
      .cl_frame_y(cl_frame_y),
52
 
53
      .cl_reset(cl_reset)
54
    );
55
 
56
 
57
  // --------------------------------------------------------------------
58
  //
59
 
60
  task init;
61
  input integer fpa_outputs;
62
    begin
63
 
64
      cl_base_format = 0;
65
      cl_full_format = 0;
66
 
67
      if( (fpa_outputs == 1) | (fpa_outputs == 2) )
68
        begin
69
          $display( "-!- %16.t | %m: FPA with %0d outputs. Assuming Base CameraLink Format", $time, fpa_outputs );
70
          cl_base_format = 1;
71
        end
72
      else if( (fpa_outputs == 4) | (fpa_outputs == 8) )
73
        begin
74
          $display( "-!- %16.t | %m: FPA with %0d outputs. Assuming Full CameraLink Format", $time, fpa_outputs );
75
          cl_full_format = 1;
76
        end
77
      else
78
        begin
79
          $display( "-!- %16.t | %m: FPA with %0d not supported.", $time, fpa_outputs );
80
          $stop();
81
        end
82
 
83
    end
84
  endtask
85
 
86
  task disable_checker;
87
    begin
88
 
89
      cl_base_format = 0;
90
      cl_full_format = 0;
91
 
92
    end
93
  endtask
94
 
95
 
96
  // --------------------------------------------------------------------
97
  //
98
  task checker;
99
  input integer pixel_counter;
100
    begin
101
 
102
      if( cl_base_format )
103
        begin
104
          if( cl_data[15:0] != pixel_counter )
105
            begin
106
              log.inc_fail_count;
107
              $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 );
108
            end
109
        end
110
      else if( cl_full_format )
111
        begin
112
          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)) )
113
            begin
114
              log.inc_fail_count;
115
              $display( "-!- %16.t | %m: data error somewhere between pixel 0x%4x and 0x%4x.", $time, pixel_counter, pixel_counter + 4 );
116
            end
117
        end
118
 
119
   end
120
  endtask
121
 
122
 
123
  // --------------------------------------------------------------------
124
  //
125
  always @(negedge cl_clk)
126
    if( cl_data_en )
127
      checker( cl_pixel_counter );
128
 
129
 
130
 
131
endmodule
132
 

powered by: WebSVN 2.1.0

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