//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2018 Authors and OPENCORES.ORG ////
|
//// Copyright (C) 2018 Authors and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
class video_frame_dpi;
|
class video_frame_dpi;
|
mailbox #(video_array_t) array_buffer;
|
mailbox #(video_array_t) array_buffer;
|
mailbox #(video_frame_class) buffer_in, buffer_out;
|
mailbox #(video_frame_class) buffer_in, buffer_out;
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
function void py_file(string filename, string py_args[]);
|
function void py_file(string filename, string py_args[]);
|
int return_status;
|
int return_status;
|
return_status = py_run_file(filename, py_args.size(), py_args);
|
return_status = py_run_file(filename, py_args.size(), py_args);
|
endfunction : py_file
|
endfunction : py_file
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
task do_it();
|
task do_it();
|
$display("^^^ %16.t | %m |", $time);
|
$display("^^^ %16.t | %m |", $time);
|
c_do_it();
|
c_do_it();
|
endtask
|
endtask
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
task get_frame(ref video_array_t va);
|
task get_frame(ref video_array_t va);
|
$display("^^^ %16.t | %m |", $time);
|
$display("^^^ %16.t | %m |", $time);
|
array_buffer.get(va);
|
array_buffer.get(va);
|
c_get_array(va);
|
c_get_array(va);
|
$display("^^^ %16.t | %m | %p |", $time, va);
|
$display("^^^ %16.t | %m | %p |", $time, va);
|
endtask
|
endtask
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
function new;
|
|
$display("^^^ | video_frame_dpi | new");
|
|
endfunction
|
|
|
|
// --------------------------------------------------------------------
|
|
function void init(int width, int height, buffer_in_size=2, buffer_out_size=2);
|
function void init(int width, int height, buffer_in_size=2, buffer_out_size=2);
|
video_array_t a_h;
|
video_array_t a_h;
|
$display("^^^ | video_frame_dpi | init");
|
$display("^^^ | video_frame_dpi | init");
|
this.array_buffer = new(buffer_in_size);
|
this.array_buffer = new(buffer_in_size);
|
this.buffer_in = new(buffer_in_size);
|
this.buffer_in = new(buffer_in_size);
|
this.buffer_out = new(buffer_out_size);
|
this.buffer_out = new(buffer_out_size);
|
|
|
for(int i = 0; i < buffer_in_size; i++)
|
for(int i = 0; i < buffer_in_size; i++)
|
begin
|
begin
|
a_h = new[height];
|
a_h = new[height];
|
|
|
foreach(a_h[y])
|
foreach(a_h[y])
|
a_h[y] = new[width];
|
a_h[y] = new[width];
|
|
|
if(array_buffer.try_put(a_h) == 0)
|
if(array_buffer.try_put(a_h) == 0)
|
begin
|
begin
|
$display("^^^ | video_frame_dpi | init ERROR!");
|
$display("^^^ | video_frame_dpi | init ERROR!");
|
$stop;
|
$stop;
|
end
|
end
|
end
|
end
|
|
|
init_py_dpi(width, height);
|
init_py_dpi(width, height);
|
endfunction
|
endfunction
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
function void exit;
|
function void exit;
|
$display("^^^ | video_frame_dpi | exit");
|
$display("^^^ | video_frame_dpi | exit");
|
exit_py_dpi();
|
exit_py_dpi();
|
endfunction
|
endfunction
|
|
|
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
|
function new;
|
|
$display("^^^ | video_frame_dpi | new");
|
|
endfunction
|
|
|
|
// --------------------------------------------------------------------
|
endclass : video_frame_dpi
|
endclass : video_frame_dpi
|
|
|
|
|