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 43

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
 
39
  // --------------------------------------------------------------------
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 new;
55
    $display("^^^ | video_frame_dpi | new");
56
   endfunction
57
 
58
  // --------------------------------------------------------------------
59
   function void init(int width, int height, buffer_in_size=2, buffer_out_size=2);
60
    video_array_t a_h;
61
    $display("^^^ | video_frame_dpi | init");
62
    this.array_buffer = new(buffer_in_size);
63
    this.buffer_in = new(buffer_in_size);
64
    this.buffer_out = new(buffer_out_size);
65
 
66
    for(int i = 0; i < buffer_in_size; i++)
67
    begin
68
      a_h = new[height];
69
 
70
      foreach(a_h[y])
71
        a_h[y] = new[width];
72
 
73
      if(array_buffer.try_put(a_h) == 0)
74
      begin
75
        $display("^^^ | video_frame_dpi | init ERROR!");
76
        $stop;
77
      end
78
    end
79
 
80
    init_py_dpi(width, height);
81
   endfunction
82
 
83
  // --------------------------------------------------------------------
84
   function void exit;
85
    $display("^^^ | video_frame_dpi | exit");
86
    exit_py_dpi();
87
   endfunction
88
 
89
// --------------------------------------------------------------------
90
endclass : video_frame_dpi
91
 

powered by: WebSVN 2.1.0

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