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

Subversion Repositories qaz_libs

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 45 to Rev 44
    Reverse comparison

Rev 45 → Rev 44

/qaz_libs/trunk/BFM/sim/tests/tb_video_frame_dpi/count.raw Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/qaz_libs/trunk/BFM/sim/tests/tb_video_frame_dpi/py_dpi.c
90,6 → 90,7
 
char pre_string[] = "exec(open('./";
char post_string[] = "').read())";
char v_filename[] = "try_it.py";
unsigned int size = (sizeof(pre_string) + sizeof(post_string)) * sizeof(char);
size += strlen(filename);
char *run_string = (char *)malloc(size);
/qaz_libs/trunk/BFM/src/video_frame/video_frame_pkg.sv
50,8 → 50,6
rand int pixels_per_line;
rand int lines_per_frame;
rand int bits_per_pixel;
int bytes_per_pixel;
rand int pixels_per_clk;
line_s lines[];
string name = "";
string pattern = "";
75,6 → 73,7
bits_per_pixel >= 1 && bits_per_pixel <= 32;
}
 
 
//--------------------------------------------------------------------
function new;
this.log = new;
81,40 → 80,127
this.frame_id = 0;
endfunction: new
 
 
// --------------------------------------------------------------------
//
function void init
(
int pixels_per_line,
int lines_per_frame,
int bits_per_pixel,
int pixels_per_clk = 1,
string name = ""
input int pixels_per_line,
input int lines_per_frame,
input int bits_per_pixel,
string name = ""
);
 
log.info($sformatf("%m"));
 
this.pixels_per_line = pixels_per_line;
this.lines_per_frame = lines_per_frame;
this.bits_per_pixel = bits_per_pixel;
this.pixels_per_clk = pixels_per_clk;
this.name = name;
this.bytes_per_pixel = (bits_per_pixel % 8 == 0)
? (bits_per_pixel / 8)
: (bits_per_pixel / 8) + 1;
 
this.make_constant(0);
 
endfunction: init
 
 
// --------------------------------------------------------------------
task write_pixel(frame_coordinate_t coordinate, int pixel);
//
extern virtual task write_pixel
(
input frame_coordinate_t coordinate,
input int pixel
);
 
extern virtual function int read_pixel
(
input frame_coordinate_t coordinate
);
 
extern function flattened_frame_t flatten_frame();
 
extern virtual function void make_constant
(
input int pixel
);
 
extern virtual function void make_counting
(
input int offset = 0
);
 
extern virtual function void make_horizontal();
 
extern virtual function void make_vertical();
 
extern virtual function void make_random();
 
extern virtual function void shift_right(ref line_s column);
 
extern virtual function void copy
(
ref video_frame_class from
);
 
extern virtual function video_frame_class clone();
 
extern virtual function int compare
(
input int max_mismatches,
ref video_frame_class to
);
 
extern virtual function video_frame_class catenate_horizontally
(
ref video_frame_class tail
);
 
extern virtual function int compare_line
(
input int line,
input int max_mismatches,
ref video_frame_class to
);
 
extern virtual function void print_line
(
input int line,
input int pixel,
input int count
);
 
extern virtual function void print_config();
 
endclass: video_frame_class
 
 
// --------------------------------------------------------------------
//
task
video_frame_class::write_pixel
(
input frame_coordinate_t coordinate,
input int pixel
);
 
this.lines[coordinate.y].pixel[coordinate.x] = pixel;
 
endtask: write_pixel
 
 
// --------------------------------------------------------------------
function int read_pixel(frame_coordinate_t coordinate);
//
function int video_frame_class::read_pixel
(
input frame_coordinate_t coordinate
);
 
read_pixel = this.lines[coordinate.y].pixel[coordinate.x];
 
endfunction: read_pixel
 
// --------------------------------------------------------------------
function flattened_frame_t flatten_frame();
//
function flattened_frame_t video_frame_class::flatten_frame();
int i = 0;
log.info($sformatf("%m"));
flatten_frame = new[lines_per_frame*pixels_per_line];
128,88 → 214,136
endfunction: flatten_frame
 
// --------------------------------------------------------------------
function void make_constant(int pixel);
//
function void video_frame_class::make_constant
(
input int pixel
);
 
log.info($sformatf("%m"));
 
 
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
begin
 
this.lines[l].pixel = new[pixels_per_line];
 
foreach(this.lines[l].pixel[p])
this.lines[l].pixel[p] = pixel;
 
end
 
pattern = "constant";
 
endfunction: make_constant
 
 
// --------------------------------------------------------------------
function void make_counting(int offset = 0);
//
function void video_frame_class::make_counting
(
input int offset = 0
);
 
log.info($sformatf("%m"));
 
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
begin
 
this.lines[l].pixel = new[pixels_per_line];
 
foreach(this.lines[l].pixel[p])
this.lines[l].pixel[p] = (pixels_per_line * l) + p + offset;
 
end
 
pattern = "counting";
 
endfunction: make_counting
 
 
// --------------------------------------------------------------------
function void make_horizontal();
//
function void video_frame_class::make_horizontal();
 
log.info($sformatf("%m"));
 
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
begin
 
this.lines[l].pixel = new[pixels_per_line];
 
foreach(this.lines[l].pixel[p])
this.lines[l].pixel[p] = p;
 
end
 
pattern = "horizontal";
 
endfunction: make_horizontal
 
 
// --------------------------------------------------------------------
function void make_vertical();
//
function void video_frame_class::make_vertical();
 
log.info($sformatf("%m"));
 
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
begin
 
this.lines[l].pixel = new[pixels_per_line];
 
foreach(this.lines[l].pixel[p])
this.lines[l].pixel[p] = l;
 
end
 
pattern = "vertical";
 
endfunction: make_vertical
 
 
// --------------------------------------------------------------------
function void make_random();
//
function void video_frame_class::make_random();
 
log.info($sformatf("%m"));
 
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
begin
 
this.lines[l].pixel = new[pixels_per_line];
 
foreach(this.lines[l].pixel[p])
this.lines[l].pixel[p] = $urandom_range(((2 ** bits_per_pixel) - 1), 0);
 
end
 
pattern = "random";
 
endfunction: make_random
 
 
// --------------------------------------------------------------------
function void copy(video_frame_class from);
//
function void video_frame_class::copy
(
ref video_frame_class from
);
 
log.info($sformatf("%m"));
 
this.frame_id = from.frame_id;
this.pixels_per_line = from.pixels_per_line;
this.lines_per_frame = from.lines_per_frame;
226,15 → 360,26
end
endfunction: copy
 
 
// --------------------------------------------------------------------
virtual function video_frame_class clone;
//
function video_frame_class video_frame_class::clone();
 
log.info($sformatf("%m"));
 
clone = new();
clone.copy(this);
 
endfunction: clone
 
 
// --------------------------------------------------------------------
function video_frame_class catenate_horizontally(video_frame_class tail);
//
function video_frame_class video_frame_class::catenate_horizontally
(
ref video_frame_class tail
);
 
log.info($sformatf("%m"));
 
if(this.lines_per_frame != tail.lines_per_frame)
244,6 → 389,7
return(null);
 
catenate_horizontally = new();
 
catenate_horizontally.pixels_per_line = this.pixels_per_line + tail.pixels_per_line;
catenate_horizontally.lines_per_frame = this.lines_per_frame;
catenate_horizontally.bits_per_pixel = this.bits_per_pixel;
263,7 → 409,8
endfunction: catenate_horizontally
 
// --------------------------------------------------------------------
function void shift_right(ref line_s column);
//
function void video_frame_class::shift_right(ref line_s column);
log.info($sformatf("%m"));
 
foreach(this.lines[l])
275,11 → 422,14
endfunction: shift_right
 
// --------------------------------------------------------------------
function int compare_line
( int line
, int max_mismatches
, video_frame_class to
);
//
function int video_frame_class::compare_line
(
input int line,
input int max_mismatches,
ref video_frame_class to
);
 
int mismatch_count = 0;
 
if(to.bits_per_pixel != this.bits_per_pixel)
300,14 → 450,24
 
if(mismatch_count > max_mismatches)
return(mismatch_count);
 
end
 
return(mismatch_count);
 
endfunction: compare_line
 
 
// --------------------------------------------------------------------
function int compare(int max_mismatches, video_frame_class to);
//
function int video_frame_class::compare
(
input int max_mismatches,
ref video_frame_class to
);
 
int mismatch_count = 0;
 
log.info($sformatf("%m"));
 
if(to.pixels_per_line != this.pixels_per_line)
333,6 → 493,7
foreach(this.lines[l].pixel[p])
if(to.lines[l].pixel[p] != this.lines[l].pixel[p])
begin
 
if(max_mismatches > 0)
mismatch_count++;
 
340,46 → 501,44
 
if(mismatch_count > max_mismatches)
return(mismatch_count);
 
end
end
 
return(mismatch_count);
 
endfunction: compare
 
 
// --------------------------------------------------------------------
function void print_line(int line, int pixel, int count);
//
function void video_frame_class::print_line
(
input int line,
input int pixel,
input int count
);
 
log.info($sformatf("%m"));
 
for(int i = 0; i < count; i++)
log.display($sformatf("%4h @ frame[%4h][%4h] | %s", this.lines[line].pixel[(pixel + i)], line, (pixel + i), name));
 
endfunction: print_line
 
 
// --------------------------------------------------------------------
function void print_config();
//
function void video_frame_class::print_config();
 
log.display($sformatf("%m | frame_id = %06d | %s", frame_id, name));
log.display($sformatf("%m | pixels_per_line = %06d | %s", pixels_per_line, name));
log.display($sformatf("%m | lines_per_frame = %06d | %s", lines_per_frame, name));
log.display($sformatf("%m | bits_per_pixel = %06d | %s", bits_per_pixel, name));
log.display($sformatf("%m | pixels_per_clk = %06d | %s", pixels_per_clk, name));
log.display($sformatf("%m | pattern = %s | %s", pattern, name));
 
endfunction: print_config
 
// --------------------------------------------------------------------
function string convert2string();
string s;
string f ="";
foreach(this.lines[l])
begin
s = $sformatf("[%4.d]", l);
foreach(this.lines[l].pixel[p])
s = {s, $sformatf("|%4.h", this.lines[l].pixel[p])};
f = {f, s, "|\n"};
end
return f;
endfunction: convert2string
 
// --------------------------------------------------------------------
endclass: video_frame_class
endpackage: video_frame_pkg
 
// --------------------------------------------------------------------
endpackage: video_frame_pkg
/qaz_libs/trunk/sim/libs/bfm_packages_verilog/BFM.f
1,4 → 1,7
#
 
${LIB_BASE_DIR}/BFM/src/tb/tb_pkg.sv
${LIB_BASE_DIR}/BFM/src/tb/tb_bfm_pkg.sv
 
${LIB_BASE_DIR}/BFM/src/axis_video_frame/axis_video_frame_bfm_pkg.sv
${LIB_BASE_DIR}/BFM/src/axis_video_frame/avf_agent_class_pkg.sv
 
/qaz_libs/trunk/sim/libs/sim_verilog/BFM.f
1,5 → 1,15
#
 
# ${LIB_BASE_DIR}/BFM/src/axis_video_frame/avf_agent.sv
# ${LIB_BASE_DIR}/BFM/src/axis_video_frame/avf_rx.sv
# ${LIB_BASE_DIR}/BFM/src/axis_video_frame/avf_tx.sv
 
# ${LIB_BASE_DIR}/BFM/src/clock/clock_checker.v
# ${LIB_BASE_DIR}/BFM/src/clock/clock_mult.v
# ${LIB_BASE_DIR}/BFM/src/clock/recover_clock.v
# ${LIB_BASE_DIR}/BFM/src/clock/tb_programmable_clk.v
 
# ${LIB_BASE_DIR}/BFM/src/tb/rand_delays_c.sv
${LIB_BASE_DIR}/BFM/src/tb/tb_base.sv
${LIB_BASE_DIR}/BFM/src/tb/tb_clk.sv
${LIB_BASE_DIR}/BFM/src/tb/tb_clk_class.sv
/qaz_libs/trunk/axi4_stream_lib/src/axis_if.sv
28,13 → 28,15
 
interface
axis_if
#( N // data bus width in bytes
, I = 1 // TID width
, D = 1 // TDEST width
, U = 1 // TUSER width
#(
N, // data bus width in bytes
I = 1, // TID width
D = 1, // TDEST width
U = 1 // TUSER width
)
( input aclk
, input aresetn
(
input aclk,
input aresetn
);
wire tvalid;
wire tready;
46,10 → 48,10
wire [D-1:0] tdest;
wire [U-1:0] tuser;
 
 
// --------------------------------------------------------------------
// synthesis translate_off
default clocking cb_m @(posedge aclk);
input aresetn;
default clocking cb_m @(posedge aclk iff aresetn);
output tvalid;
input tready;
output tdata;
61,9 → 63,10
output tuser;
endclocking
 
 
// --------------------------------------------------------------------
clocking cb_s @(posedge aclk);
input aresetn;
//
clocking cb_s @(posedge aclk iff aresetn);
input tvalid;
output tready;
input tdata;
77,6 → 80,7
// synthesis translate_on
// --------------------------------------------------------------------
 
 
// --------------------------------------------------------------------
//
`ifdef USE_MOD_PORTS
101,7 → 105,9
output tuser
);
 
 
// --------------------------------------------------------------------
//
modport
slave
(
124,13 → 130,20
);
`endif
 
 
// --------------------------------------------------------------------
// synthesis translate_off
task zero_cycle_delay;
task
zero_cycle_delay;
 
##0;
 
endtask: zero_cycle_delay
// synthesis translate_on
// --------------------------------------------------------------------
 
 
// --------------------------------------------------------------------
//
endinterface: axis_if
 

powered by: WebSVN 2.1.0

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