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 50 to Rev 49
- ↔ Reverse comparison
Rev 50 → Rev 49
/video_frame_class.svh
27,6 → 27,7
|
// -------------------------------------------------------------------- |
class video_frame_class; |
logger_class log; |
rand int frame_id; |
rand int pixels_per_line; |
rand int lines_per_frame; |
58,6 → 59,7
|
//-------------------------------------------------------------------- |
function new; |
this.log = new; |
this.frame_id = 0; |
endfunction: new |
|
70,6 → 72,7
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; |
110,6 → 113,7
|
// -------------------------------------------------------------------- |
function void make_constant(int pixel); |
log.info($sformatf("%m")); |
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
125,6 → 129,7
|
// -------------------------------------------------------------------- |
function void make_counting(int offset = 0); |
log.info($sformatf("%m")); |
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
140,6 → 145,7
|
// -------------------------------------------------------------------- |
function void make_horizontal(); |
log.info($sformatf("%m")); |
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
155,6 → 161,7
|
// -------------------------------------------------------------------- |
function void make_vertical(); |
log.info($sformatf("%m")); |
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
170,6 → 177,7
|
// -------------------------------------------------------------------- |
function void make_random(); |
log.info($sformatf("%m")); |
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
185,6 → 193,7
|
// -------------------------------------------------------------------- |
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; |
203,6 → 212,7
|
// -------------------------------------------------------------------- |
virtual function video_frame_class clone; |
log.info($sformatf("%m")); |
clone = new(); |
clone.copy(this); |
endfunction: clone |
209,6 → 219,7
|
// -------------------------------------------------------------------- |
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); |
237,6 → 248,7
|
// -------------------------------------------------------------------- |
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--) |
246,127 → 258,114
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(); |
$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)); |
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(int grid=8); |
string s0, s1; |
string s; |
string f =""; |
int nibbles = ( bits_per_pixel % 4 == 0) |
? bits_per_pixel / 4 |
: (bits_per_pixel / 4) + 1; |
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])}; |
|
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"}; |
f = {f, s, "|\n"}; |
end |
|
return f; |
endfunction: convert2string |
|
// -------------------------------------------------------------------- |
endclass |
endclass: video_frame_class |
/video_frame_config.svh
57,4 → 57,4
endfunction : init |
|
// -------------------------------------------------------------------- |
endclass |
endclass: video_frame_config |
/video_frame_pkg.sv
26,6 → 26,7
////////////////////////////////////////////////////////////////////// |
|
package video_frame_pkg; |
import logger_pkg::*; |
|
// -------------------------------------------------------------------- |
typedef struct |
49,4 → 50,4
`include "video_frame_class.svh" |
|
// -------------------------------------------------------------------- |
endpackage |
endpackage: video_frame_pkg |