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
- from Rev 24 to Rev 25
- ↔ Reverse comparison
Rev 24 → Rev 25
/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 |
|
trunk/camera_link
Property changes :
Added: svn:ignore
## -0,0 +1 ##
+reference
Index: trunk/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv
===================================================================
--- trunk/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv (revision 24)
+++ trunk/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv (revision 25)
@@ -28,6 +28,18 @@
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,
@@ -36,22 +48,28 @@
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, AVF_OUTPUTS = 1);
+ class axis_video_frame_bfm_class #(BYTES_PER_PIXEL = 2, OUTPUTS_PER_TILE = 1);
- 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
+ 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
- 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;
@@ -72,27 +90,26 @@
// --------------------------------------------------------------------
//
function void init
- (
- input int avf_width,
- input int avf_height,
- input int avf_bits_per_pixel,
- input string avf_name,
- input string avf_type
- );
+ (
+ input avf_config_t avf_config,
+ input avf_tile_config_t tile_config,
+ 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;
@@ -162,18 +179,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; // increment stride by number of outputs
+ inc.x *= avf.outputs_per_tile; // increment stride by number of outputs
x_eol = x_end - inc.x;
endtask: avf_calculate
@@ -213,7 +230,7 @@
wait(avf_axis_if.cb_s.tvalid);
- for(int i = 0; i < AVF_OUTPUTS; i++)
+ for(int i = 0; i < avf.outputs_per_tile; i++)
f_h.lines[l].pixel[p + i] = avf_axis_if.cb_s.tdata[i*AVF_B +: AVF_B];
if(p == x_eol)
@@ -234,13 +251,10 @@
// --------------------------------------------------------------------
//
task automatic
- avf_fork_rx
- (
- input avf_direction_t direction
- );
+ avf_fork_rx;
fork
- avf_rx(direction);
+ avf_rx(tile.direction);
join_none
#0;
@@ -257,7 +271,7 @@
input int p
);
- for(int i = 0; i < AVF_OUTPUTS; i++)
+ for(int i = 0; i < avf.outputs_per_tile; i++)
avf_axis_if.cb_m.tdata[i*AVF_B +: AVF_B] <= f_h.lines[l].pixel[p + i];
endtask: output_pixels
@@ -333,14 +347,10 @@
// --------------------------------------------------------------------
//
task
- avf_fork_tx
- (
- input avf_direction_t direction,
- input int unsigned avf_delay
- );
+ avf_fork_tx;
fork
- avf_tx(direction, avf_delay);
+ avf_tx(tile.direction, tile.delay);
join_none
#0;
@@ -359,11 +369,7 @@
event tx_frame_done;
task automatic
- run_tx_q
- (
- input avf_direction_t direction,
- input int unsigned avf_delay
- );
+ run_tx_q;
if(avf_type != "TX")
begin
@@ -386,12 +392,12 @@
begin
avf_q.get(f_h);
- avf_fork_tx(direction, avf_delay);
+ avf_fork_tx();
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
@@ -408,10 +414,7 @@
int compare_errors = 0;
task automatic
- run_rx_q
- (
- input avf_direction_t direction
- );
+ run_rx_q;
if(avf_type != "RX")
begin
@@ -435,7 +438,7 @@
begin
avf_q.get(avf_in_frame);
- avf_fork_rx(direction);
+ avf_fork_rx();
wait fork;
/trunk/axis_video_frame_bfm_class/src/avf_agent_class_pkg.sv
0,0 → 1,321
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2015 Authors and OPENCORES.ORG //// |
//// //// |
//// This source file may be used and distributed without //// |
//// restriction provided that this copyright statement is not //// |
//// removed from the file and that any derivative work contains //// |
//// the original copyright notice and the associated disclaimer. //// |
//// //// |
//// This source file is free software; you can redistribute it //// |
//// and/or modify it under the terms of the GNU Lesser General //// |
//// Public License as published by the Free Software Foundation; //// |
//// either version 2.1 of the License, or (at your option) any //// |
//// later version. //// |
//// //// |
//// This source is distributed in the hope that it will be //// |
//// useful, but WITHOUT ANY WARRANTY; without even the implied //// |
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //// |
//// PURPOSE. See the GNU Lesser General Public License for more //// |
//// details. //// |
//// //// |
//// You should have received a copy of the GNU Lesser General //// |
//// Public License along with this source; if not, download it //// |
//// from http://www.opencores.org/lgpl.shtml //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
|
package avf_agent_class_pkg; |
|
// -------------------------------------------------------------------- |
// |
import video_frame_pkg::*; |
import axis_video_frame_bfm_pkg::*; |
|
|
// -------------------------------------------------------------------- |
// |
class avf_agent_config_class; |
|
avf_config_t avf; |
avf_tile_config_t tile[]; |
|
//-------------------------------------------------------------------- |
// |
function new |
( |
input int width, |
input int height, |
input int bytes_per_pixel, |
input int bits_per_pixel, |
input int tiles, |
input int outputs_per_tile, |
input string name, |
input int vertical_blanking |
); |
|
this.avf.width = width; |
this.avf.height = height; |
this.avf.bytes_per_pixel = bytes_per_pixel; |
this.avf.bits_per_pixel = bits_per_pixel; |
this.avf.tiles = tiles; |
this.avf.outputs_per_tile = outputs_per_tile; |
this.avf.name = name; |
this.avf.vertical_blanking = vertical_blanking; |
|
this.tile = new[avf.tiles]; |
|
endfunction: new |
|
endclass: avf_agent_config_class |
|
|
// -------------------------------------------------------------------- |
// |
class avf_agent_class #(BYTES_PER_PIXEL = 2, OUTPUTS_PER_TILE = 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 |
|
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_in_if[]; |
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if[]; |
|
axis_video_frame_bfm_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE) tx_bfm_h[]; |
axis_video_frame_bfm_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE) rx_bfm_h[]; |
|
avf_agent_config_class avf_agent_config; |
video_frame_class clone_h; |
|
|
//-------------------------------------------------------------------- |
// |
function new |
( |
input avf_agent_config_class avf_agent_config, |
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_in_if[], |
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if[] |
); |
|
this.avf_agent_config = avf_agent_config; |
|
this.avf_axis_in_if = new[avf_agent_config.avf.tiles]; |
this.avf_axis_in_if = avf_axis_in_if; |
|
this.avf_axis_out_if = new[avf_agent_config.avf.tiles]; |
this.avf_axis_out_if = avf_axis_out_if; |
|
this.tx_bfm_h = new[avf_agent_config.avf.tiles]; |
foreach(this.tx_bfm_h[i]) |
this.tx_bfm_h[i] = new(avf_axis_out_if[i]); |
|
this.rx_bfm_h = new[avf_agent_config.avf.tiles]; |
foreach(this.rx_bfm_h[i]) |
this.rx_bfm_h[i] = new(avf_axis_in_if[i]); |
|
endfunction: new |
|
|
// -------------------------------------------------------------------- |
// |
task automatic init; |
|
$display("^^^ %16.t | %m |", $time); |
|
foreach(this.tx_bfm_h[i]) |
this.tx_bfm_h[i].init |
( |
.avf_config(avf_agent_config.avf), |
.tile_config(avf_agent_config.tile[i]), |
.avf_name($psprintf("%s%0d", avf_agent_config.avf.name, i)), |
.avf_type("TX") |
); |
|
foreach(this.rx_bfm_h[i]) |
this.rx_bfm_h[i].init |
( |
.avf_config(avf_agent_config.avf), |
.tile_config(avf_agent_config.tile[i]), |
.avf_name($psprintf("%s%0d", avf_agent_config.avf.name, i)), |
.avf_type("RX") |
); |
|
foreach(tx_bfm_h[i]) |
tx_bfm_h[i].run_tx_q(); |
|
foreach(rx_bfm_h[i]) |
rx_bfm_h[i].run_rx_q(); |
|
endtask: init |
|
|
// -------------------------------------------------------------------- |
// |
task automatic |
make_frame |
( |
string pattern, |
int pixel = 0 |
); |
|
case(pattern.tolower) |
"constant": foreach(tx_bfm_h[i]) tx_bfm_h[i].f_h.make_constant(pixel); |
"counting": foreach(tx_bfm_h[i]) tx_bfm_h[i].f_h.make_counting(); |
"horizontal": foreach(tx_bfm_h[i]) tx_bfm_h[i].f_h.make_horizontal(); |
"vertical": foreach(tx_bfm_h[i]) tx_bfm_h[i].f_h.make_vertical(); |
"random": foreach(tx_bfm_h[i]) tx_bfm_h[i].f_h.make_random(); |
default: $display("^^^ %16.t | %m | ERROR! %s pattern not supported", $time, pattern); |
endcase |
|
endtask: make_frame |
|
|
// -------------------------------------------------------------------- |
// |
task automatic |
queue_frame |
( |
string pattern = "" |
); |
|
if(pattern != "") |
make_frame(pattern); |
|
foreach(tx_bfm_h[i]) |
begin |
clone_h = tx_bfm_h[i].f_h.clone(); |
tx_bfm_h[i].avf_q.put(clone_h); |
rx_bfm_h[i].avf_q.put(clone_h); |
end |
|
$display("^^^ %16.t | %m | using %s pattern", $time, pattern); |
|
endtask: queue_frame |
|
|
// -------------------------------------------------------------------- |
// |
task |
wait_for_tx_frames |
( |
input int unsigned count |
); |
|
repeat(count) |
@(tx_bfm_h[0].tx_frame_done); |
|
endtask: wait_for_tx_frames |
|
|
// -------------------------------------------------------------------- |
// |
logic put_frame_active = 0; |
semaphore put_frame_semaphore = new(1); |
|
task automatic |
put_frame; |
|
if(put_frame_semaphore.try_get() == 0) |
begin |
$display("^^^ %16.t | %m | ERROR! Already put a frame.", $time); |
return; |
end |
|
$display("^^^ %16.t | %m | Putting a frame.", $time); |
put_frame_active = 1; |
|
fork |
begin |
|
foreach(tx_bfm_h[i]) |
tx_bfm_h[i].avf_fork_tx(); |
|
wait fork; |
put_frame_active = 0; |
$display("^^^ %16.t | %m | Put a frame.", $time); |
put_frame_semaphore.put(); |
|
end |
join_none |
|
endtask: put_frame |
|
|
// -------------------------------------------------------------------- |
// |
task |
wait_for_rx_frames |
( |
input int unsigned count |
); |
|
repeat(count) |
@(rx_bfm_h[0].rx_frame_done); |
|
endtask: wait_for_rx_frames |
|
|
// -------------------------------------------------------------------- |
// |
semaphore get_frame_semaphore = new(1); |
logic get_frame_active = 0; |
|
task automatic |
get_frame; |
|
if(get_frame_semaphore.try_get() == 0) |
begin |
$display("^^^ %16.t | %m | ERROR! Already getting a frame.", $time); |
return; |
end |
|
$display("^^^ %16.t | %m | getting a frame.", $time); |
get_frame_active = 1; |
|
fork |
begin |
|
foreach(rx_bfm_h[i]) |
rx_bfm_h[i].avf_fork_rx(); |
|
wait fork; |
get_frame_active = 0; |
$display("^^^ %16.t | %m | Got a frame.", $time); |
get_frame_semaphore.put(); |
|
end |
join_none |
|
|
endtask: get_frame |
|
|
// -------------------------------------------------------------------- |
// |
function automatic |
int compare_frame; |
|
int mismatch_count[]; |
mismatch_count = new[avf_agent_config.avf.tiles]; |
|
$display("^^^ %16.t | %m", $time); |
|
foreach(rx_bfm_h[i]) |
mismatch_count[i] = rx_bfm_h[i].f_h.compare(8, tx_bfm_h[i].f_h); |
|
|
endfunction: compare_frame |
|
|
// -------------------------------------------------------------------- |
// |
|
endclass: avf_agent_class |
|
endpackage: avf_agent_class_pkg |
|
|
|
|
|
/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/wip.do
0,0 → 1,12
# |
|
|
vlog -f ../../libs/sim_verilog/avf.f |
|
# simulation $root |
vlog ../../src/tb_1_tile_4_outputs.sv |
|
# compile test last |
vlog ./the_test.sv |
|
|
/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/init_test.do
0,0 → 1,33
# ------------------------------------ |
# |
# ------------------------------------ |
|
global env |
|
set env(ROOT_DIR) ../../../../.. |
set env(PROJECT_DIR) ../../.. |
set env(SIM_TARGET) fpga |
|
# load sim procedures |
do $env(ROOT_DIR)/qaz_libs/scripts/sim_procs.do |
|
radix -hexadecimal |
|
make_lib work 1 |
|
# sim_compile_all FPGA |
sim_compile_all sim |
|
# simulation $root |
vlog $env(PROJECT_DIR)/sim/src/tb_1_tile_4_outputs.sv |
|
# compile test last |
vlog ./the_test.sv |
|
# vopt work.glbl tb_top -L secureip -L simprims_ver -L unisims_ver -f opt_tb_top.f -o opt_tb_top |
|
# run the sim |
sim_run_test |
|
|
|
/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/wave.do
0,0 → 1,31
onerror {resume} |
quietly WaveActivateNextPane {} 0 |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/aclk} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/aresetn} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/tvalid} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/tready} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/tdata} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/tlast} |
add wave -noupdate -expand -group {avf_axis[0]} {/tb_top/avf_axis[0]/tuser} |
add wave -noupdate -divider {New Divider} |
add wave -noupdate -divider {New Divider} |
TreeUpdate [SetDefaultTree] |
WaveRestoreCursors {{Cursor 1} {0 ps} 0} |
quietly wave cursor active 0 |
configure wave -namecolwidth 188 |
configure wave -valuecolwidth 100 |
configure wave -justifyvalue left |
configure wave -signalnamewidth 0 |
configure wave -snapdistance 10 |
configure wave -datasetprefix 0 |
configure wave -rowmargin 4 |
configure wave -childrowmargin 2 |
configure wave -gridoffset 0 |
configure wave -gridperiod 1 |
configure wave -griddelta 40 |
configure wave -timeline 0 |
configure wave -timelineunits ps |
update |
WaveRestoreZoom {0 ps} {4512375 ps} |
/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/the_test.sv
0,0 → 1,105
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2015 Authors and OPENCORES.ORG //// |
//// //// |
//// This source file may be used and distributed without //// |
//// restriction provided that this copyright statement is not //// |
//// removed from the file and that any derivative work contains //// |
//// the original copyright notice and the associated disclaimer. //// |
//// //// |
//// This source file is free software; you can redistribute it //// |
//// and/or modify it under the terms of the GNU Lesser General //// |
//// Public License as published by the Free Software Foundation; //// |
//// either version 2.1 of the License, or (at your option) any //// |
//// later version. //// |
//// //// |
//// This source is distributed in the hope that it will be //// |
//// useful, but WITHOUT ANY WARRANTY; without even the implied //// |
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //// |
//// PURPOSE. See the GNU Lesser General Public License for more //// |
//// details. //// |
//// //// |
//// You should have received a copy of the GNU Lesser General //// |
//// Public License along with this source; if not, download it //// |
//// from http://www.opencores.org/lgpl.shtml //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
`timescale 1ps/1ps |
|
|
module |
the_test( |
input tb_clk, |
input tb_rst |
); |
|
// -------------------------------------------------------------------- |
// |
int mismatch_count = 0; |
|
|
// -------------------------------------------------------------------- |
// |
task run_the_test; |
|
// -------------------------------------------------------------------- |
// insert test below |
// -------------------------------------------------------------------- |
$display("^^^---------------------------------"); |
$display("^^^ %16.t | Testbench begun.\n", $time); |
$display("^^^---------------------------------"); |
// -------------------------------------------------------------------- |
|
tb_top.tb.timeout_stop(20us); |
|
inject_error : fork |
begin |
#(3.5us) tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0); |
end |
join_none |
|
|
// -------------------------------------------------------------------- |
wait(~tb_rst); |
|
|
// -------------------------------------------------------------------- |
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(); |
|
wait(~tb_top.avf_agent_h.put_frame_active); |
wait(~tb_top.avf_agent_h.get_frame_active); |
|
mismatch_count = tb_top.avf_agent_h.compare_frame(); |
|
tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0); |
|
mismatch_count = tb_top.avf_agent_h.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_h.queue_frame("random"); |
tb_top.avf_agent_h.queue_frame("counting"); |
|
tb_top.avf_agent_h.wait_for_tx_frames(3); |
|
repeat(100) @(posedge tb_clk); |
|
|
// -------------------------------------------------------------------- |
// insert test above |
// -------------------------------------------------------------------- |
|
endtask |
|
|
endmodule |
|
/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/sim.do
0,0 → 1,21
# |
# |
|
|
quit -sim |
|
# vsim opt_tb_top |
|
vsim -novopt work.tb_top |
# vsim -novopt -L secureip -L simprims_ver -L unisims_ver work.glbl work.tb_top |
|
# vsim -voptargs="+acc=rn+/tb_top/dut" -L secureip -L simprims_ver -L unisims_ver work.glbl work.tb_top |
# vsim -pli "C:/Xilinx/Vivado/2015.4/lib/win64.o/libxil_vsim.dll" -novopt -L secureip -L simprims_ver -L unisims_ver work.glbl work.tb_top |
|
|
# # log all signals |
# log -r * |
|
# run -all |
|
|
/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_i.avf_rx_bfm.f_rx_h[0].f_h.write_pixel('{1,1}, 0); |
#(11us) tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0); |
end |
join_none |
|
63,36 → 63,33
// -------------------------------------------------------------------- |
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_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(); |
tb_top.avf_agent_h.make_frame("counting"); |
tb_top.avf_agent_h.get_frame(); |
tb_top.avf_agent_h.put_frame(); |
|
wait(~tb_top.avf_agent_i.avf_tx_bfm.put_frame_active); |
wait(~tb_top.avf_agent_i.avf_rx_bfm.get_frame_active); |
wait(~tb_top.avf_agent_h.put_frame_active); |
wait(~tb_top.avf_agent_h.get_frame_active); |
|
mismatch_count = tb_top.avf_agent_i.avf_rx_bfm.compare_frame(); |
mismatch_count = tb_top.avf_agent_h.compare_frame(); |
|
tb_top.avf_agent_i.avf_rx_bfm.f_rx_h[0].f_h.write_pixel('{1,1}, 0); |
tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0); |
|
mismatch_count = tb_top.avf_agent_i.avf_rx_bfm.compare_frame(); |
mismatch_count = tb_top.avf_agent_h.compare_frame(); |
|
|
// -------------------------------------------------------------------- |
repeat(100) @(posedge tb_clk); |
|
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.make_frame("constant", 16'habba); |
tb_top.avf_agent_h.queue_frame(); |
|
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.queue_frame("random"); |
tb_top.avf_agent_h.queue_frame("counting"); |
|
tb_top.avf_agent_i.avf_tx_bfm.wait_for_tx_frames(3); |
tb_top.avf_agent_h.wait_for_tx_frames(3); |
|
repeat(100) @(posedge tb_clk); |
|
/trunk/axis_video_frame_bfm_class/sim/src/tb_4_tile_1_outputs.sv
41,36 → 41,66
|
// -------------------------------------------------------------------- |
// |
import axis_video_frame_bfm_pkg::*; |
|
localparam TILES = 4; |
localparam WIDTH = 32; // tile width |
localparam HEIGHT = 16; // tile height |
localparam OUTPUTS_PER_TILE = 1; // outputs per tile |
localparam BYTES_PER_PIXEL = 2; |
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 BITS_PER_PIXEL = 16; |
localparam VERTICAL_BLANKING = 20; |
|
|
// -------------------------------------------------------------------- |
// |
axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis[AVF_TILES](.*); |
localparam AVF_N = BYTES_PER_PIXEL * OUTPUTS_PER_TILE; // data bus width in bytes |
localparam AVF_U = 1; // TUSER width |
|
for(genvar j = 0; j < AVF_TILES; j++) |
assign avf_axis[j].tready = 1; |
axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis[TILES](.*); |
|
|
// -------------------------------------------------------------------- |
// |
avf_agent #(BYTES_PER_PIXEL, AVF_OUTPUTS, AVF_TILES, AVF_WIDTH, AVF_HEIGHT, AVF_BITS_PER_PIXEL) |
avf_agent_i |
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 |
( |
.axis_out(avf_axis), |
.axis_in(avf_axis) |
.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) |
); |
|
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 |
// | | | | | | | | | | | | | | | | | |
90,8 → 120,8
|
// -------------------------------------------------------------------- |
// debug wires |
for(genvar j = 0; j < AVF_TILES; j++) |
axis_video_debug #(BYTES_PER_PIXEL, AVF_OUTPUTS) avf_debug(avf_axis[j]); |
for(genvar j = 0; j < TILES; j++) |
axis_video_debug #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE) avf_debug(avf_axis[j]); |
|
|
// -------------------------------------------------------------------- |
/trunk/axis_video_frame_bfm_class/sim/src/tb_1_tile_4_outputs.sv
0,0 → 1,149
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2015 Authors and OPENCORES.ORG //// |
//// //// |
//// This source file may be used and distributed without //// |
//// restriction provided that this copyright statement is not //// |
//// removed from the file and that any derivative work contains //// |
//// the original copyright notice and the associated disclaimer. //// |
//// //// |
//// This source file is free software; you can redistribute it //// |
//// and/or modify it under the terms of the GNU Lesser General //// |
//// Public License as published by the Free Software Foundation; //// |
//// either version 2.1 of the License, or (at your option) any //// |
//// later version. //// |
//// //// |
//// This source is distributed in the hope that it will be //// |
//// useful, but WITHOUT ANY WARRANTY; without even the implied //// |
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //// |
//// PURPOSE. See the GNU Lesser General Public License for more //// |
//// details. //// |
//// //// |
//// You should have received a copy of the GNU Lesser General //// |
//// Public License along with this source; if not, download it //// |
//// from http://www.opencores.org/lgpl.shtml //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
|
module tb_top(); |
|
// -------------------------------------------------------------------- |
// test bench clock & reset |
wire clk_200mhz; |
wire tb_clk = clk_200mhz; |
wire tb_rst; |
wire aclk = tb_clk; |
wire aresetn = ~tb_rst; |
|
tb_base #( .PERIOD(5_000) ) tb( clk_200mhz, tb_rst ); |
|
|
// -------------------------------------------------------------------- |
// |
localparam TILES = 1; |
localparam WIDTH = 32; // tile width |
localparam HEIGHT = 16; // tile height |
localparam OUTPUTS_PER_TILE = 4; // outputs per tile |
localparam BYTES_PER_PIXEL = 2; |
localparam BITS_PER_PIXEL = 16; |
localparam VERTICAL_BLANKING = 20; |
|
|
// -------------------------------------------------------------------- |
// |
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[TILES](.*); |
|
|
// -------------------------------------------------------------------- |
// |
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 |
( |
.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) |
); |
|
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 |
// | | | | | | | | | | | | | | | | | |
// \|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/ |
// ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' |
|
// -------------------------------------------------------------------- |
// |
|
|
// ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' |
// /|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\-/|\ |
// | | | | | | | | | | | | | | | | | |
// sim models |
// -------------------------------------------------------------------- |
|
|
// -------------------------------------------------------------------- |
// debug wires |
for(genvar j = 0; j < TILES; j++) |
axis_video_debug #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE) avf_debug(avf_axis[j]); |
|
|
// -------------------------------------------------------------------- |
// test |
the_test test( tb_clk, tb_rst ); |
|
initial |
begin |
|
test.run_the_test(); |
|
$display("^^^---------------------------------"); |
$display("^^^ %16.t | Testbench done.", $time); |
$display("^^^---------------------------------"); |
|
$display("^^^---------------------------------"); |
|
$stop(); |
|
end |
|
endmodule |
|
|
|
/trunk/axis_video_frame_bfm_class/sim/libs/sim_verilog/avf.f
1,11 → 1,9
# |
|
-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/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/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 |
|
trunk
Property changes :
Added: svn:ignore
## -0,0 +1 ##
+uvm_guide_for_beginners