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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [camera_link/] [cl_line_scan_checker.v] - Blame information for rev 43

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

powered by: WebSVN 2.1.0

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