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] - Rev 44

Compare with Previous | Blame | View Log

//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2018 Authors and OPENCORES.ORG                 ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
//////////////////////////////////////////////////////////////////////

// --------------------------------------------------------------------
class video_frame_dpi;
  mailbox #(video_array_t) array_buffer;
  mailbox #(video_frame_class) buffer_in, buffer_out;

  // --------------------------------------------------------------------
  function void py_file(string filename, string py_args[]);
    int return_status;
    return_status = py_run_file(filename, py_args.size(), py_args);
  endfunction : py_file

  // --------------------------------------------------------------------
  task do_it();
    $display("^^^ %16.t | %m |", $time);
    c_do_it();
    endtask

  // --------------------------------------------------------------------
  task get_frame(ref video_array_t va);
    $display("^^^ %16.t | %m |", $time);
    array_buffer.get(va);
    c_get_array(va);
    $display("^^^ %16.t | %m | %p |", $time, va);
  endtask

  // --------------------------------------------------------------------
   function void init(int width, int height, buffer_in_size=2, buffer_out_size=2);
    video_array_t a_h;
    $display("^^^ | video_frame_dpi | init");
    this.array_buffer = new(buffer_in_size);
    this.buffer_in = new(buffer_in_size);
    this.buffer_out = new(buffer_out_size);

    for(int i = 0; i < buffer_in_size; i++)
    begin
      a_h = new[height];

      foreach(a_h[y])
        a_h[y] = new[width];

      if(array_buffer.try_put(a_h) == 0)
      begin
        $display("^^^ | video_frame_dpi | init ERROR!");
        $stop;
      end
    end

    init_py_dpi(width, height);
   endfunction

  // --------------------------------------------------------------------
   function void exit;
    $display("^^^ | video_frame_dpi | exit");
    exit_py_dpi();
   endfunction

  // --------------------------------------------------------------------
   function new;
    $display("^^^ | video_frame_dpi | new");
   endfunction

// --------------------------------------------------------------------
endclass : video_frame_dpi

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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