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
    /qaz_libs/trunk/BFM/src/video_frame
    from Rev 49 to Rev 50
    Reverse comparison

Rev 49 → Rev 50

/video_frame_class.svh
27,7 → 27,6
 
// --------------------------------------------------------------------
class video_frame_class;
logger_class log;
rand int frame_id;
rand int pixels_per_line;
rand int lines_per_frame;
59,7 → 58,6
 
//--------------------------------------------------------------------
function new;
this.log = new;
this.frame_id = 0;
endfunction: new
 
72,7 → 70,6
int pixels_per_clk = 1,
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;
113,7 → 110,6
 
// --------------------------------------------------------------------
function void make_constant(int pixel);
log.info($sformatf("%m"));
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
129,7 → 125,6
 
// --------------------------------------------------------------------
function void make_counting(int offset = 0);
log.info($sformatf("%m"));
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
145,7 → 140,6
 
// --------------------------------------------------------------------
function void make_horizontal();
log.info($sformatf("%m"));
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
161,7 → 155,6
 
// --------------------------------------------------------------------
function void make_vertical();
log.info($sformatf("%m"));
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
177,7 → 170,6
 
// --------------------------------------------------------------------
function void make_random();
log.info($sformatf("%m"));
this.lines = new[lines_per_frame];
 
foreach(this.lines[l])
193,7 → 185,6
 
// --------------------------------------------------------------------
function void copy(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;
212,7 → 203,6
 
// --------------------------------------------------------------------
virtual function video_frame_class clone;
log.info($sformatf("%m"));
clone = new();
clone.copy(this);
endfunction: clone
219,7 → 209,6
 
// --------------------------------------------------------------------
function video_frame_class catenate_horizontally(video_frame_class tail);
log.info($sformatf("%m"));
 
if(this.lines_per_frame != tail.lines_per_frame)
return(null);
248,7 → 237,6
 
// --------------------------------------------------------------------
function void shift_right(ref line_s column);
log.info($sformatf("%m"));
 
foreach(this.lines[l])
for(int p = pixels_per_line - 1; p > 0; p--)
258,114 → 246,127
this.lines[l].pixel[0] = column.pixel[l];
endfunction: shift_right
 
// --------------------------------------------------------------------
function int compare_line
( int line
, int max_mismatches
, video_frame_class to
);
int mismatch_count = 0;
// // --------------------------------------------------------------------
// function int compare_line
// ( int line
// , int max_mismatches
// , video_frame_class to
// );
// int mismatch_count = 0;
 
if(to.bits_per_pixel != this.bits_per_pixel)
begin
log.error($sformatf("to.bits_per_pixel != this.bits_per_pixel | %s", name));
return(-3);
end
// if(to.bits_per_pixel != this.bits_per_pixel)
// begin
// log.error($sformatf("to.bits_per_pixel != this.bits_per_pixel | %s", name));
// return(-3);
// end
 
foreach(this.lines[line].pixel[p])
if(to.lines[line].pixel[p] != this.lines[line].pixel[p])
begin
// foreach(this.lines[line].pixel[p])
// if(to.lines[line].pixel[p] != this.lines[line].pixel[p])
// begin
 
if(max_mismatches > 0)
mismatch_count++;
// if(max_mismatches > 0)
// mismatch_count++;
 
log.error($sformatf("mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s",
line, p, to.lines[line].pixel[p], this.lines[line].pixel[p], name));
// log.error($sformatf("mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s",
// line, p, to.lines[line].pixel[p], this.lines[line].pixel[p], name));
 
if(mismatch_count > max_mismatches)
return(mismatch_count);
end
// if(mismatch_count > max_mismatches)
// return(mismatch_count);
// end
 
return(mismatch_count);
endfunction: compare_line
// return(mismatch_count);
// endfunction: compare_line
 
// --------------------------------------------------------------------
function int compare(int max_mismatches, video_frame_class to);
int mismatch_count = 0;
log.info($sformatf("%m"));
// // --------------------------------------------------------------------
// function int compare(int max_mismatches, video_frame_class to);
// int mismatch_count = 0;
// log.info($sformatf("%m"));
 
if(to.pixels_per_line != this.pixels_per_line)
begin
log.error($sformatf("to.pixels_per_line != this.pixels_per_line | %s", name));
return(-1);
end
// if(to.pixels_per_line != this.pixels_per_line)
// begin
// log.error($sformatf("to.pixels_per_line != this.pixels_per_line | %s", name));
// return(-1);
// end
 
if(to.lines_per_frame != this.lines_per_frame)
begin
log.error($sformatf("to.lines_per_frame != this.lines_per_frame | %s", name));
return(-2);
end
// if(to.lines_per_frame != this.lines_per_frame)
// begin
// log.error($sformatf("to.lines_per_frame != this.lines_per_frame | %s", name));
// return(-2);
// end
 
if(to.bits_per_pixel != this.bits_per_pixel)
begin
log.error($sformatf("to.bits_per_pixel != this.bits_per_pixel | %s", name));
return(-3);
end
// if(to.bits_per_pixel != this.bits_per_pixel)
// begin
// log.error($sformatf("to.bits_per_pixel != this.bits_per_pixel | %s", name));
// return(-3);
// end
 
foreach(this.lines[l])
begin
foreach(this.lines[l].pixel[p])
if(to.lines[l].pixel[p] != this.lines[l].pixel[p])
begin
if(max_mismatches > 0)
mismatch_count++;
// foreach(this.lines[l])
// begin
// foreach(this.lines[l].pixel[p])
// if(to.lines[l].pixel[p] != this.lines[l].pixel[p])
// begin
// if(max_mismatches > 0)
// mismatch_count++;
 
log.error($sformatf("mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s", l, p, to.lines[l].pixel[p], this.lines[l].pixel[p], name));
// log.error($sformatf("mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s", l, p, to.lines[l].pixel[p], this.lines[l].pixel[p], name));
 
if(mismatch_count > max_mismatches)
return(mismatch_count);
end
end
// if(mismatch_count > max_mismatches)
// return(mismatch_count);
// end
// end
 
return(mismatch_count);
endfunction: compare
// return(mismatch_count);
// endfunction: compare
 
// --------------------------------------------------------------------
function void print_line(int line, int pixel, int count);
log.info($sformatf("%m"));
// // --------------------------------------------------------------------
// function void print_line(int line, int pixel, 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
// 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();
// 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 void 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));
$display($sformatf("%m | frame_id = %06d | %s", frame_id, name));
$display($sformatf("%m | pixels_per_line = %06d | %s", pixels_per_line, name));
$display($sformatf("%m | lines_per_frame = %06d | %s", lines_per_frame, name));
$display($sformatf("%m | bits_per_pixel = %06d | %s", bits_per_pixel, name));
$display($sformatf("%m | pixels_per_clk = %06d | %s", pixels_per_clk, name));
$display($sformatf("%m | pattern = %s | %s", pattern, name));
endfunction: print_config
 
// --------------------------------------------------------------------
function string convert2string(int grid=8);
string s;
string s0, s1;
string f ="";
string fs = $sformatf("%%s%%%0d.h" , (bits_per_pixel % 4 == 0)
? bits_per_pixel / 4
: (bits_per_pixel / 4) + 1
);
foreach(this.lines[l])
begin
s = $sformatf("[%4.d]", l);
foreach(this.lines[l].pixel[p])
s = {s, $sformatf(fs, (p % grid == 0) ? "!" : "|", this.lines[l].pixel[p])};
int nibbles = ( bits_per_pixel % 4 == 0)
? bits_per_pixel / 4
: (bits_per_pixel / 4) + 1;
 
f = {f, s, "|\n"};
foreach(this.lines[l]) begin
s0 = $sformatf("[%4.d]", l);
foreach(this.lines[l].pixel[p]) begin
s1 = $sformatf("%.h", this.lines[l].pixel[p]);
s1 = s1.substr(nibbles, s1.len()-1);
s0 = {s0, (p % grid == 0) ? "!" : "|", s1};
end
 
f = {f, s0, "|\n"};
end
 
return f;
endfunction: convert2string
 
// --------------------------------------------------------------------
endclass: video_frame_class
endclass
/video_frame_config.svh
57,4 → 57,4
endfunction : init
 
// --------------------------------------------------------------------
endclass: video_frame_config
endclass
/video_frame_pkg.sv
26,7 → 26,6
//////////////////////////////////////////////////////////////////////
 
package video_frame_pkg;
import logger_pkg::*;
 
// --------------------------------------------------------------------
typedef struct
50,4 → 49,4
`include "video_frame_class.svh"
 
// --------------------------------------------------------------------
endpackage: video_frame_pkg
endpackage

powered by: WebSVN 2.1.0

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