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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [sim/] [tests/] [tb_video_frame_dpi/] [sv_video_frame_dpi.svh] - Blame information for rev 49

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

Line No. Rev Author Line
1 43 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2018 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
// --------------------------------------------------------------------
29
class video_frame_dpi;
30
  mailbox #(video_array_t) array_buffer;
31
  mailbox #(video_frame_class) buffer_in, buffer_out;
32
 
33
  // --------------------------------------------------------------------
34
  function void py_file(string filename, string py_args[]);
35
    int return_status;
36
    return_status = py_run_file(filename, py_args.size(), py_args);
37
  endfunction : py_file
38 44 qaztronic
 
39 43 qaztronic
  // --------------------------------------------------------------------
40
  task do_it();
41
    $display("^^^ %16.t | %m |", $time);
42
    c_do_it();
43
    endtask
44
 
45
  // --------------------------------------------------------------------
46
  task get_frame(ref video_array_t va);
47
    $display("^^^ %16.t | %m |", $time);
48
    array_buffer.get(va);
49
    c_get_array(va);
50
    $display("^^^ %16.t | %m | %p |", $time, va);
51
  endtask
52
 
53
  // --------------------------------------------------------------------
54
   function void init(int width, int height, buffer_in_size=2, buffer_out_size=2);
55
    video_array_t a_h;
56
    $display("^^^ | video_frame_dpi | init");
57
    this.array_buffer = new(buffer_in_size);
58
    this.buffer_in = new(buffer_in_size);
59
    this.buffer_out = new(buffer_out_size);
60 44 qaztronic
 
61 43 qaztronic
    for(int i = 0; i < buffer_in_size; i++)
62
    begin
63
      a_h = new[height];
64 44 qaztronic
 
65 43 qaztronic
      foreach(a_h[y])
66
        a_h[y] = new[width];
67 44 qaztronic
 
68 43 qaztronic
      if(array_buffer.try_put(a_h) == 0)
69
      begin
70
        $display("^^^ | video_frame_dpi | init ERROR!");
71
        $stop;
72
      end
73
    end
74 44 qaztronic
 
75 43 qaztronic
    init_py_dpi(width, height);
76
   endfunction
77
 
78
  // --------------------------------------------------------------------
79
   function void exit;
80
    $display("^^^ | video_frame_dpi | exit");
81
    exit_py_dpi();
82
   endfunction
83
 
84 44 qaztronic
  // --------------------------------------------------------------------
85
   function new;
86
    $display("^^^ | video_frame_dpi | new");
87
   endfunction
88
 
89 43 qaztronic
// --------------------------------------------------------------------
90
endclass : video_frame_dpi
91 44 qaztronic
 

powered by: WebSVN 2.1.0

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