User guide

Table Of Contents
Appendix A: Avalon-ST Video Verification IP Suite A–7
Types of Example Test Environment
January 2013 Altera Corporation Video and Image Processing Suite
User Guide
Figure A–3 shows the solution to the Avalon-ST BFM API function.
Types of Example Test Environment
There are two types of example test environment:
Video File Reader Test
Constrained Random Test
The video file reader test is useful for checking the video functionality of the DUT for
any video types. However, this test is not suitable to test the DUT with a variety of
differently-sized and formatted video fields. Altera recommends a constrained
random approach that is easily accomplished using the class library. For more
information, refer to “Constrained Random Test” on page A–18.
This section describes how you can run the test and the prerequisites before running
the test. You can run both tests in a similar way, unless specified otherwise.
Figure A–3. How the Class Library interfaces to the Avalon-ST BFM
`define BITS_PER_CHANNEL 8
`define CHANNELS_PER_PIXEL 3
// Instantiate "netlist" :
`define NETLIST netlist
tb `NETLIST (.reset_reset_n(resetn),.clk_clk(clk));
// This names MUST match the instance name of the source in tb.v :
`define SOURCE st_source_bfm_0
`define SOURCE_HIERARCHY_NAME `NETLIST.`SOURCE
`include "av_st_video_source_bfm_class.sv"
// Create an object of name `SOURCE of class av_st_video_source_bfm_`SOURCE :
`define CLASSNAME c_av_st_video_source_bfm_`SOURCE
`CLASSNAME `SOURCE;
`undef CLASSNAME
...
// The following must be defined before including this class :
// `BITS_PER_CHANNEL
// `CHANNELS_PER_PIXEL
// `SOURCE
// `SOURCE_HIERARCHY_NAME
`define CLASSNAME c_av_st_video_source_bfm_`SOURCE
class `CLASSNAME extends c_av_st_video_source_sink_base;
...
pixel_data = new();
// Pull a video item out of the mailbox :
this.m_video_items.get(item_data);
`SOURCE_HIERARCHY_NAME.set_transaction_sop(1'b1);
`SOURCE_HIERARCHY_NAME.set_transaction_eop(1'b0);
...
module tb (
input wire reset_reset_n,
input wire clk_clk
);
wire st_source_bfm_0_src_endofpacket;
wire st_source_bfm_0_src_valid;
wire st_source_bfm_0_src_startofpacket;
wire [7:0] st_source_bfm_0_src_data;
wire st_source_bfm_0_src_ready;
wire rst_controller_reset_out_reset;
altera_avalon_st_source_bfm #(
.USE_PACKET (1),
.USE_CHANNEL (0),
.USE_ERROR (0),
...
.ST_READY_LATENCY (1),
.ST_BEATSPERCYCLE (1),
.ST_MAX_CHANNELS (0)
) st_source_bfm_0 (
.clk (clk_clk),
.reset (rst_controller_reset_out_reset),
.src_data (st_source_bfm_0_src_data),
.src_valid (st_source_bfm_0_src_valid),
.src_ready (st_source_bfm_0_src_ready),
.src_startofpacket (st_source_bfm_0_src_startofpacket),
.src_endofpacket (st_source_bfm_0_src_endofpacket)
);
...
tb_test.sv
tb.v
av_st_video_source_bfm_class.sv
The test harness , creates the `defines , then `includes
av_st_video_source_bfm_class.sv prior to then creating an object of
that class.
The av_st_video_source_bfm_class. sv file declares a
class with a unique name which accesses the Avalon-ST
BFM API calls such as set_transaction _sop() via its
hierarchical path in the netlist .
.
S
T
_
M
A
X
_
C
H
A
)
s
t
_
s
o
u
r
c
e
_
b
f
m
_
0
(
.
c
l
k
_
v
i
d
e
o
_
i
t
e
m
s
.
g
e
t
(
i
t
e
m
_
d
a
t
a
)
;
`
S
O
U
R
C
E
_
H
I
E
R
A
R
R
R
C
H
Y
_
N
A
M
A
A
E
.
s
e
t
_
t
r
a
n
s
a
c
t
i
o
n
_
s
o
p
(
1
'
b
1
)
;
`
S
O
U
R
C
E
_
H
I
E
R
A
R
R
R
C
H
Y
_
N
A
M
A
A
E
.
s
e
t
_
t
r
a
n
s
a
c
t
i
o
n
_
e
op
(
1
'
b
0
)
;