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 25 to Rev 24
- ↔ Reverse comparison
Rev 25 → Rev 24
/qaz_libs/trunk/video_frame_class/src/video_frame_pkg.sv
81,7 → 81,7
input int lines_per_frame, |
input int bits_per_pixel, |
string name = "" |
); |
); |
|
$display("^^^ %16.t | %m", $time); |
|
90,7 → 90,7
this.bits_per_pixel = bits_per_pixel; |
this.name = name; |
|
this.make_constant(0); |
this.make_constant( 0 ); |
|
endfunction: init |
|
101,17 → 101,17
( |
input frame_coordinate_t coordinate, |
input int pixel |
); |
); |
|
extern virtual function int read_pixel |
( |
input frame_coordinate_t coordinate |
); |
); |
|
extern virtual function void make_constant |
( |
input int pixel |
); |
); |
|
extern virtual function void make_counting(); |
|
124,7 → 124,7
extern virtual function void copy |
( |
ref video_frame_class from |
); |
); |
|
extern virtual function video_frame_class clone(); |
|
132,7 → 132,7
( |
input int max_mismatches, |
ref video_frame_class to |
); |
); |
|
extern virtual function void print_line |
( |
139,7 → 139,7
input int line, |
input int pixel, |
input int count |
); |
); |
|
extern virtual function void print_config(); |
|
153,7 → 153,7
( |
input frame_coordinate_t coordinate, |
input int pixel |
); |
); |
|
this.lines[coordinate.y].pixel[coordinate.x] = pixel; |
|
165,7 → 165,7
function int video_frame_class::read_pixel |
( |
input frame_coordinate_t coordinate |
); |
); |
|
read_pixel = this.lines[coordinate.y].pixel[coordinate.x]; |
|
177,18 → 177,18
function void video_frame_class::make_constant |
( |
input int pixel |
); |
); |
|
$display("^^^ %16.t | %m", $time); |
|
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
foreach( this.lines[l] ) |
begin |
|
this.lines[l].pixel = new[pixels_per_line]; |
|
foreach(this.lines[l].pixel[p]) |
foreach( this.lines[l].pixel[p] ) |
this.lines[l].pixel[p] = pixel; |
|
end |
206,12 → 206,12
|
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
foreach( this.lines[l] ) |
begin |
|
this.lines[l].pixel = new[pixels_per_line]; |
|
foreach(this.lines[l].pixel[p]) |
foreach( this.lines[l].pixel[p] ) |
this.lines[l].pixel[p] = (pixels_per_line * l) + p; |
|
end |
229,12 → 229,12
|
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
foreach( this.lines[l] ) |
begin |
|
this.lines[l].pixel = new[pixels_per_line]; |
|
foreach(this.lines[l].pixel[p]) |
foreach( this.lines[l].pixel[p] ) |
this.lines[l].pixel[p] = p; |
|
end |
252,12 → 252,12
|
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
foreach( this.lines[l] ) |
begin |
|
this.lines[l].pixel = new[pixels_per_line]; |
|
foreach(this.lines[l].pixel[p]) |
foreach( this.lines[l].pixel[p] ) |
this.lines[l].pixel[p] = l; |
|
end |
275,13 → 275,13
|
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
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); |
foreach( this.lines[l].pixel[p] ) |
this.lines[l].pixel[p] = $urandom_range( ((2 ** bits_per_pixel) - 1), 0 ); |
|
end |
|
295,7 → 295,7
function void video_frame_class::copy |
( |
ref video_frame_class from |
); |
); |
|
$display("^^^ %16.t | %m", $time); |
|
306,11 → 306,11
this.name = from.name; |
this.lines = new[lines_per_frame]; |
|
foreach(this.lines[l]) |
foreach( this.lines[l] ) |
begin |
this.lines[l].pixel = new[pixels_per_line]; |
|
foreach(this.lines[l].pixel[p]) |
foreach( this.lines[l].pixel[p] ) |
this.lines[l].pixel[p] = from.lines[l].pixel[p]; |
end |
endfunction: copy |
334,48 → 334,48
( |
input int max_mismatches, |
ref video_frame_class to |
); |
); |
|
int mismatch_count = 0; |
|
$display("^^^ %16.t | %m", $time); |
|
if(to.pixels_per_line != this.pixels_per_line) |
if( to.pixels_per_line != this.pixels_per_line ) |
begin |
$display("^^^ %16.t | ERROR! to.pixels_per_line != this.pixels_per_line | %s", $time, name); |
return(-1); |
$display( "^^^ %16.t | ERROR! to.pixels_per_line != this.pixels_per_line | %s", $time, name ); |
return( -1 ); |
end |
|
if(to.lines_per_frame != this.lines_per_frame) |
if( to.lines_per_frame != this.lines_per_frame ) |
begin |
$display("^^^ %16.t | ERROR! to.lines_per_frame != this.lines_per_frame | %s", $time, name); |
return(-2); |
$display( "^^^ %16.t | ERROR! to.lines_per_frame != this.lines_per_frame | %s", $time, name ); |
return( -2 ); |
end |
|
if(to.bits_per_pixel != this.bits_per_pixel) |
if( to.bits_per_pixel != this.bits_per_pixel ) |
begin |
$display("^^^ %16.t | ERROR! to.bits_per_pixel != this.bits_per_pixel | %s", $time, name); |
return(-3); |
$display( "^^^ %16.t | ERROR! to.bits_per_pixel != this.bits_per_pixel | %s", $time, name ); |
return( -3 ); |
end |
|
foreach(this.lines[l]) |
foreach( this.lines[l] ) |
begin |
foreach(this.lines[l].pixel[p]) |
if(to.lines[l].pixel[p] != this.lines[l].pixel[p]) |
foreach( this.lines[l].pixel[p] ) |
if( to.lines[l].pixel[p] != this.lines[l].pixel[p] ) |
begin |
|
if(max_mismatches > 0) |
if( max_mismatches > 0 ) |
mismatch_count++; |
|
$display("^^^ %16.t | ERROR! mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s", $time, l, p, to.lines[l].pixel[p], this.lines[l].pixel[p], name); |
$display( "^^^ %16.t | ERROR! mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s", $time, l, p, to.lines[l].pixel[p], this.lines[l].pixel[p], name ); |
|
if(mismatch_count > max_mismatches) |
return(mismatch_count); |
if( mismatch_count > max_mismatches ) |
return( mismatch_count ); |
|
end |
end |
|
return(mismatch_count); |
return( mismatch_count ); |
|
endfunction: compare |
|
387,12 → 387,12
input int line, |
input int pixel, |
input int count |
); |
); |
|
$display("^^^ %16.t | %m", $time); |
|
for(int i = 0; i < count; i++) |
$display("^^^ %16.t | %4h @ frame[%4h][%4h] | %s", $time, this.lines[line].pixel[(pixel + i)], line, (pixel + i), name); |
for( int i = 0; i < count; i++ ) |
$display( "^^^ %16.t | %4h @ frame[%4h][%4h] | %s", $time, this.lines[line].pixel[(pixel + i)], line, (pixel + i), name ); |
|
endfunction: print_line |
|
/qaz_libs/trunk/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv
28,18 → 28,6
|
package axis_video_frame_bfm_pkg; |
|
typedef struct |
{ |
int width; |
int height; |
int bytes_per_pixel; |
int bits_per_pixel; |
int tiles; |
int outputs_per_tile; |
string name; |
int vertical_blanking; |
} avf_config_t; |
|
typedef enum |
{ |
RIGHT_DOWN, |
48,28 → 36,22
LEFT_UP |
} avf_direction_t; |
|
typedef struct |
{ |
avf_direction_t direction; |
int delay = 0; |
} avf_tile_config_t; |
|
// -------------------------------------------------------------------- |
// |
import video_frame_pkg::*; |
|
class axis_video_frame_bfm_class #(BYTES_PER_PIXEL = 2, OUTPUTS_PER_TILE = 1); |
class axis_video_frame_bfm_class #(BYTES_PER_PIXEL = 2, AVF_OUTPUTS = 1); |
|
localparam AVF_N = BYTES_PER_PIXEL * OUTPUTS_PER_TILE; // data bus width in bytes |
localparam AVF_U = 1; // TUSER width |
localparam AVF_B = BYTES_PER_PIXEL * 8; // bits per pixel on TDATA |
localparam AVF_N = BYTES_PER_PIXEL * AVF_OUTPUTS; // data bus width in bytes |
localparam AVF_U = 1; // TUSER width |
localparam AVF_B = BYTES_PER_PIXEL * 8; // bits per pixel on TDATA |
|
int avf_width = 16; |
int avf_height = 16; |
int avf_vertical_blanking = 0; |
string avf_name = ""; |
string avf_type = ""; |
|
avf_config_t avf; |
avf_tile_config_t tile; |
|
video_frame_class f_h; |
|
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_if; |
90,26 → 72,27
// -------------------------------------------------------------------- |
// |
function void init |
( |
input avf_config_t avf_config, |
input avf_tile_config_t tile_config, |
input string avf_name, |
input string avf_type |
); |
( |
input int avf_width, |
input int avf_height, |
input int avf_bits_per_pixel, |
input string avf_name, |
input string avf_type |
); |
|
this.avf = avf_config; |
this.tile = tile_config; |
this.avf_name = avf_name; |
this.avf_type = avf_type.toupper(); |
|
f_h.init |
( |
.pixels_per_line(avf.width), |
.lines_per_frame(avf.height), |
.bits_per_pixel(avf.bits_per_pixel), |
.pixels_per_line(avf_width), |
.lines_per_frame(avf_height), |
.bits_per_pixel(avf_bits_per_pixel), |
.name(avf_name) |
); |
|
this.avf_width = avf_width; |
this.avf_height = avf_height; |
this.avf_name = avf_name; |
this.avf_type = avf_type.toupper(); |
|
if(avf_type == "RX") |
begin |
avf_axis_if.cb_s.tready <= 1; |
179,18 → 162,18
|
case(direction) |
RIGHT_DOWN: start = '{0, 0 }; |
RIGHT_UP: start = '{0, avf.height - 1 }; |
LEFT_DOWN: start = '{avf.width - 1, 0 }; |
LEFT_UP: start = '{avf.width - 1, avf.height - 1 }; |
RIGHT_UP: start = '{0, avf_height - 1 }; |
LEFT_DOWN: start = '{avf_width - 1, 0 }; |
LEFT_UP: start = '{avf_width - 1, avf_height - 1 }; |
default: $display("^^^ %16.t | %m | [%04d, %04d] | ERROR!!! Incorrect AVF direction.", $time, start.x, start.y ); |
endcase |
|
avf_direction(direction, inc); |
|
x_end = (start.x + (avf.width * inc.x)); |
y_end = (start.y + (avf.height * inc.y)); |
x_end = (start.x + (avf_width * inc.x)); |
y_end = (start.y + (avf_height * inc.y)); |
|
inc.x *= avf.outputs_per_tile; // increment stride by number of outputs |
inc.x *= AVF_OUTPUTS; // increment stride by number of outputs |
x_eol = x_end - inc.x; |
|
endtask: avf_calculate |
230,7 → 213,7
|
wait(avf_axis_if.cb_s.tvalid); |
|
for(int i = 0; i < avf.outputs_per_tile; i++) |
for(int i = 0; i < AVF_OUTPUTS; i++) |
f_h.lines[l].pixel[p + i] = avf_axis_if.cb_s.tdata[i*AVF_B +: AVF_B]; |
|
if(p == x_eol) |
251,10 → 234,13
// -------------------------------------------------------------------- |
// |
task automatic |
avf_fork_rx; |
avf_fork_rx |
( |
input avf_direction_t direction |
); |
|
fork |
avf_rx(tile.direction); |
avf_rx(direction); |
join_none |
|
#0; |
271,7 → 257,7
input int p |
); |
|
for(int i = 0; i < avf.outputs_per_tile; i++) |
for(int i = 0; i < AVF_OUTPUTS; i++) |
avf_axis_if.cb_m.tdata[i*AVF_B +: AVF_B] <= f_h.lines[l].pixel[p + i]; |
|
endtask: output_pixels |
347,10 → 333,14
// -------------------------------------------------------------------- |
// |
task |
avf_fork_tx; |
avf_fork_tx |
( |
input avf_direction_t direction, |
input int unsigned avf_delay |
); |
|
fork |
avf_tx(tile.direction, tile.delay); |
avf_tx(direction, avf_delay); |
join_none |
|
#0; |
369,7 → 359,11
event tx_frame_done; |
|
task automatic |
run_tx_q; |
run_tx_q |
( |
input avf_direction_t direction, |
input int unsigned avf_delay |
); |
|
if(avf_type != "TX") |
begin |
392,12 → 386,12
begin |
|
avf_q.get(f_h); |
avf_fork_tx(); |
avf_fork_tx(direction, avf_delay); |
|
wait fork; |
|
->tx_frame_done; |
repeat(avf.vertical_blanking) @(avf_axis_if.cb_m); |
repeat(avf_vertical_blanking) @(avf_axis_if.cb_m); |
end |
join_none |
|
414,7 → 408,10
int compare_errors = 0; |
|
task automatic |
run_rx_q; |
run_rx_q |
( |
input avf_direction_t direction |
); |
|
if(avf_type != "RX") |
begin |
438,7 → 435,7
begin |
|
avf_q.get(avf_in_frame); |
avf_fork_rx(); |
avf_fork_rx(direction); |
|
wait fork; |
|
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/tests/tb_4_tile_1_outputs/the_test.sv
55,7 → 55,7
|
inject_error : fork |
begin |
#(11us) tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0); |
#(11us) tb_top.avf_agent_i.avf_rx_bfm.f_rx_h[0].f_h.write_pixel('{1,1}, 0); |
end |
join_none |
|
63,33 → 63,36
// -------------------------------------------------------------------- |
wait(~tb_rst); |
|
tb_top.avf_agent_i.avf_tx_bfm.init_avf_tx(); |
tb_top.avf_agent_i.avf_rx_bfm.init_avf_rx(); |
|
|
// -------------------------------------------------------------------- |
repeat(100) @(posedge tb_clk); |
tb_top.avf_agent_h.make_frame("counting"); |
tb_top.avf_agent_h.get_frame(); |
tb_top.avf_agent_h.put_frame(); |
tb_top.avf_agent_i.avf_tx_bfm.make_frame("counting"); |
tb_top.avf_agent_i.avf_rx_bfm.get_frame(); |
tb_top.avf_agent_i.avf_tx_bfm.put_frame(); |
|
wait(~tb_top.avf_agent_h.put_frame_active); |
wait(~tb_top.avf_agent_h.get_frame_active); |
wait(~tb_top.avf_agent_i.avf_tx_bfm.put_frame_active); |
wait(~tb_top.avf_agent_i.avf_rx_bfm.get_frame_active); |
|
mismatch_count = tb_top.avf_agent_h.compare_frame(); |
mismatch_count = tb_top.avf_agent_i.avf_rx_bfm.compare_frame(); |
|
tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0); |
tb_top.avf_agent_i.avf_rx_bfm.f_rx_h[0].f_h.write_pixel('{1,1}, 0); |
|
mismatch_count = tb_top.avf_agent_h.compare_frame(); |
mismatch_count = tb_top.avf_agent_i.avf_rx_bfm.compare_frame(); |
|
|
// -------------------------------------------------------------------- |
repeat(100) @(posedge tb_clk); |
|
tb_top.avf_agent_h.make_frame("constant", 16'habba); |
tb_top.avf_agent_h.queue_frame(); |
tb_top.avf_agent_i.avf_tx_bfm.make_frame("constant", 16'habba); |
tb_top.avf_agent_i.avf_tx_bfm.queue_frame(); |
|
tb_top.avf_agent_h.queue_frame("random"); |
tb_top.avf_agent_h.queue_frame("counting"); |
tb_top.avf_agent_i.avf_tx_bfm.queue_frame("random"); |
tb_top.avf_agent_i.avf_tx_bfm.queue_frame("counting"); |
|
tb_top.avf_agent_h.wait_for_tx_frames(3); |
tb_top.avf_agent_i.avf_tx_bfm.wait_for_tx_frames(3); |
|
repeat(100) @(posedge tb_clk); |
|
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/src/tb_4_tile_1_outputs.sv
41,66 → 41,36
|
// -------------------------------------------------------------------- |
// |
localparam TILES = 4; |
localparam WIDTH = 32; // tile width |
localparam HEIGHT = 16; // tile height |
localparam OUTPUTS_PER_TILE = 1; // outputs per tile |
import axis_video_frame_bfm_pkg::*; |
|
localparam BYTES_PER_PIXEL = 2; |
localparam BITS_PER_PIXEL = 16; |
localparam VERTICAL_BLANKING = 20; |
localparam AVF_OUTPUTS = 1; // outputs per tile |
localparam AVF_TILES = 4; |
localparam AVF_N = BYTES_PER_PIXEL * AVF_OUTPUTS; // data bus width in bytes |
localparam AVF_U = 1; // TUSER width |
localparam AVF_WIDTH = 32; // tile width |
localparam AVF_HEIGHT = 16; // tile height |
localparam AVF_BITS_PER_PIXEL = 16; |
|
|
// -------------------------------------------------------------------- |
// |
localparam AVF_N = BYTES_PER_PIXEL * OUTPUTS_PER_TILE; // data bus width in bytes |
localparam AVF_U = 1; // TUSER width |
axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis[AVF_TILES](.*); |
|
axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis[TILES](.*); |
for(genvar j = 0; j < AVF_TILES; j++) |
assign avf_axis[j].tready = 1; |
|
|
// -------------------------------------------------------------------- |
// |
import axis_video_frame_bfm_pkg::*; |
import avf_agent_class_pkg::*; |
|
|
// -------------------------------------------------------------------- |
// |
avf_agent_config_class avf_agent_config_h; |
avf_agent_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE) avf_agent_h; |
|
initial |
begin |
|
avf_agent_config_h = new |
avf_agent #(BYTES_PER_PIXEL, AVF_OUTPUTS, AVF_TILES, AVF_WIDTH, AVF_HEIGHT, AVF_BITS_PER_PIXEL) |
avf_agent_i |
( |
.width(WIDTH), |
.height(HEIGHT), |
.bytes_per_pixel(BYTES_PER_PIXEL), |
.bits_per_pixel(BITS_PER_PIXEL), |
.tiles(TILES), |
.outputs_per_tile(OUTPUTS_PER_TILE), |
.name("AVF_"), |
.vertical_blanking(VERTICAL_BLANKING) |
.axis_out(avf_axis), |
.axis_in(avf_axis) |
); |
|
avf_agent_config_h.tile[0].direction = RIGHT_DOWN; |
avf_agent_config_h.tile[1].direction = RIGHT_UP; |
avf_agent_config_h.tile[2].direction = LEFT_DOWN; |
avf_agent_config_h.tile[3].direction = LEFT_UP; |
|
avf_agent_h = new |
( |
.avf_agent_config(avf_agent_config_h), |
.avf_axis_in_if(avf_axis), |
.avf_axis_out_if(avf_axis) |
); |
|
avf_agent_h.init(); |
|
end |
|
|
// -------------------------------------------------------------------- |
// sim models |
// | | | | | | | | | | | | | | | | | |
120,8 → 90,8
|
// -------------------------------------------------------------------- |
// debug wires |
for(genvar j = 0; j < TILES; j++) |
axis_video_debug #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE) avf_debug(avf_axis[j]); |
for(genvar j = 0; j < AVF_TILES; j++) |
axis_video_debug #(BYTES_PER_PIXEL, AVF_OUTPUTS) avf_debug(avf_axis[j]); |
|
|
// -------------------------------------------------------------------- |
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/libs/sim_verilog/avf.f
1,9 → 1,11
# |
|
-mfcu |
-mfcu |
|
${ROOT_DIR}/qaz_libs/video_frame_class/src/video_frame_pkg.sv |
${ROOT_DIR}/qaz_libs/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv |
${ROOT_DIR}/qaz_libs/axis_video_frame_bfm_class/src/avf_agent_class_pkg.sv |
${ROOT_DIR}/qaz_libs/video_frame_class/src/video_frame_pkg.sv |
${ROOT_DIR}/qaz_libs/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv |
|
${ROOT_DIR}/qaz_libs/axis_video_frame_bfm_class/src/avf_agent.sv |
${ROOT_DIR}/qaz_libs/axis_video_frame_bfm_class/src/avf_tx.sv |
${ROOT_DIR}/qaz_libs/axis_video_frame_bfm_class/src/avf_rx.sv |
|
qaz_libs/trunk/camera_link
Property changes :
Deleted: svn:ignore
## -1 +0,0 ##
-reference
Index: qaz_libs/trunk
===================================================================
--- qaz_libs/trunk (revision 25)
+++ qaz_libs/trunk (revision 24)
qaz_libs/trunk
Property changes :
Deleted: svn:ignore
## -1 +0,0 ##
-uvm_guide_for_beginners