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 8 to Rev 9
    Reverse comparison

Rev 8 → Rev 9

/qaz_libs/trunk/video_frame_class/src/video_frame_class.sv
5,8 → 5,8
{
int pixel[];
} line_s;
 
 
class video_frame_class;
rand int frame_id;
rand int pixels_per_line;
14,7 → 14,7
rand int bits_per_pixel;
line_s lines[];
 
constraint default_pixels_per_line
constraint default_pixels_per_line
{
pixels_per_line >= 4;
pixels_per_line % 2 == 0;
21,7 → 21,7
pixels_per_line <= 16384;
}
 
constraint default_lines_per_frame
constraint default_lines_per_frame
{
lines_per_frame >= 4;
lines_per_frame % 2 == 0;
28,12 → 28,12
lines_per_frame <= 16384;
}
 
constraint default_bits_per_pixel
constraint default_bits_per_pixel
{
bits_per_pixel >= 1 && bits_per_pixel <= 16;
}
 
 
//--------------------------------------------------------------------
function new;
this.frame_id = 0;
45,27 → 45,27
input int lines_per_frame,
input int bits_per_pixel
);
 
extern virtual function void make_constant
(
input int pixel
);
 
extern virtual function void make_counting();
 
extern virtual function void make_random();
 
extern virtual function void copy
(
ref video_frame_class to
);
 
extern virtual function int compare
(
input int max_mismatches,
ref video_frame_class to
);
 
endclass: video_frame_class
 
 
81,8 → 81,8
this.lines_per_frame = lines_per_frame;
this.bits_per_pixel = bits_per_pixel;
endfunction: init
 
 
// --------------------------------------------------------------------
//
function void video_frame_class::make_constant
89,60 → 89,60
(
input int pixel
);
this.lines = new[lines_per_frame];
 
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
 
endfunction: make_constant
 
 
// --------------------------------------------------------------------
//
function void video_frame_class::make_counting();
this.lines = new[lines_per_frame];
 
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;
 
end
 
endfunction: make_counting
 
 
// --------------------------------------------------------------------
//
function void video_frame_class::make_random();
this.lines = new[lines_per_frame];
 
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
 
endfunction: make_random
 
 
// --------------------------------------------------------------------
//
function void video_frame_class::copy
149,26 → 149,26
(
ref video_frame_class to
);
 
to.frame_id = this.frame_id;
to.pixels_per_line = this.pixels_per_line;
to.lines_per_frame = this.lines_per_frame;
to.bits_per_pixel =this.bits_per_pixel ;
 
to.lines = new[lines_per_frame];
 
foreach( this.lines[l] )
begin
 
to.lines[l].pixel = new[pixels_per_line];
 
foreach( this.lines[l].pixel[p] )
to.lines[l].pixel[p] = this.lines[l].pixel[p];
 
end
endfunction: copy
 
 
// --------------------------------------------------------------------
//
function int video_frame_class::compare
178,22 → 178,22
);
 
int mismatch_count = 0;
 
if( to.pixels_per_line != this.pixels_per_line )
begin
$display( "^^^ %16.t | to.pixels_per_line != this.pixels_per_line ", $time );
$display( "^^^ %16.t | to.pixels_per_line != this.pixels_per_line", $time );
return( -1 );
end
 
if( to.lines_per_frame != this.lines_per_frame )
begin
$display( "^^^ %16.t | to.lines_per_frame != this.lines_per_frame ", $time );
$display( "^^^ %16.t | to.lines_per_frame != this.lines_per_frame", $time );
return( -2 );
end
 
if( to.bits_per_pixel != this.bits_per_pixel )
begin
$display( "^^^ %16.t | to.bits_per_pixel != this.bits_per_pixel ", $time );
$display( "^^^ %16.t | to.bits_per_pixel != this.bits_per_pixel", $time );
return( -3 );
end
 
202,21 → 202,20
foreach( this.lines[l].pixel[p] )
if( to.lines[l].pixel[p] != this.lines[l].pixel[p] )
begin
 
if( max_mismatches > 0 )
mismatch_count++;
$display("^^^ %16.t | mismatch @ frame[%4h][%4h] | to == %4h | this == %4h ", $time, to.lines[l].pixel[p], this.lines[l].pixel[p] );
 
$display( "^^^ %16.t | mismatch @ frame[%4h][%4h] | to == %4h | this == %4h ", $time, to.lines[l].pixel[p], this.lines[l].pixel[p] );
 
if( mismatch_count > max_mismatches )
return( -4 );
 
end
end
 
return( mismatch_count );
 
endfunction: compare
 
 
/qaz_libs/trunk/video_frame_class/sim/tests/debug/the_test.sv
40,11 → 40,11
else
$display("^^^ %16.t | f_h != fc_h | mismatches = %0d", $time, return_code );
 
$display("^^^ %16.t | inserting errors @ fc_h[11][22]", $time );
fc_h.lines['h11].pixel['h22] = ~(fc_h.lines['h11].pixel['h22])
$display("^^^ %16.t | inserting error @ fc_h[11][22]", $time );
fc_h.lines['h11].pixel['h22] = ~(fc_h.lines['h11].pixel['h22]);
 
$display("^^^ %16.t | inserting errors @ fc_h[33][44]", $time );
fc_h.lines['h33].pixel['h44] = ~(fc_h.lines['h33].pixel['h44])
$display("^^^ %16.t | inserting error @ fc_h[33][44]", $time );
fc_h.lines['h33].pixel['h44] = ~(fc_h.lines['h33].pixel['h44]);
 
return_code = f_h.compare( 16, fc_h );
 
/qaz_libs/trunk/video_frame_class/sim/src/tb_top.v
3,9 → 3,6
// --------------------------------------------------------------------
 
 
`timescale 1ps/1ps
 
 
module tb_top();
 
// --------------------------------------------------------------------
19,14 → 16,8
// --------------------------------------------------------------------
//
parameter CLK_PERIOD = 2000;
 
// --------------------------------------------------------------------
//
 
 
 
// --------------------------------------------------------------------
// sim models
// | | | | | | | | | | | | | | | | |
62,7 → 53,6
$display("^^^ %16.t | Testbench done.", $time);
$display("^^^---------------------------------");
 
log.log_fail_count();
$display("^^^---------------------------------");
 
`ifdef MAKEFILE_TEST_RUN

powered by: WebSVN 2.1.0

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