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 27 to Rev 28
    Reverse comparison

Rev 27 → Rev 28

/qaz_libs/trunk/FIFOs/sim/libs/sync_fifo_verilog/tiny_fifo.f
0,0 → 1,8
#
 
 
${ROOT_DIR}/qaz_libs/FIFOs/src/tiny_sync_fifo.sv
${ROOT_DIR}/qaz_libs/FIFOs/src/fifo_read_if.sv
${ROOT_DIR}/qaz_libs/FIFOs/src/fifo_write_if.sv
 
 
/qaz_libs/trunk/FIFOs/sim/tests/CummingsSNUG2002SJ_FIFO1/wave.do
0,0 → 1,40
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -divider {New Divider}
add wave -noupdate -divider {New Divider}
add wave -noupdate -group dut /tb_top/dut/rdata
add wave -noupdate -group dut /tb_top/dut/wfull
add wave -noupdate -group dut /tb_top/dut/rempty
add wave -noupdate -group dut /tb_top/dut/wdata
add wave -noupdate -group dut /tb_top/dut/winc
add wave -noupdate -group dut /tb_top/dut/wclk
add wave -noupdate -group dut /tb_top/dut/wrst_n
add wave -noupdate -group dut /tb_top/dut/rinc
add wave -noupdate -group dut /tb_top/dut/rclk
add wave -noupdate -group dut /tb_top/dut/rrst_n
add wave -noupdate -group dut /tb_top/dut/waddr
add wave -noupdate -group dut /tb_top/dut/raddr
add wave -noupdate -group dut /tb_top/dut/wptr
add wave -noupdate -group dut /tb_top/dut/rptr
add wave -noupdate -group dut /tb_top/dut/wq2_rptr
add wave -noupdate -group dut /tb_top/dut/rq2_wptr
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 241
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} {548625 ps}
/qaz_libs/trunk/FIFOs/sim/tests/tiny_async_fifo/wave.do
0,0 → 1,62
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -divider {New Divider}
add wave -noupdate -divider {New Divider}
add wave -noupdate -expand -group dut /tb_top/dut/writing
add wave -noupdate -expand -group dut /tb_top/dut/reading
add wave -noupdate -expand -group dut /tb_top/dut/grey_wr_ptr
add wave -noupdate -expand -group dut /tb_top/dut/grey_wr_ptr_r
add wave -noupdate -expand -group dut /tb_top/dut/grey_wr_ptr_s
add wave -noupdate -expand -group dut /tb_top/dut/grey_rd_ptr
add wave -noupdate -expand -group dut /tb_top/dut/grey_rd_ptr_r
add wave -noupdate -expand -group dut /tb_top/dut/grey_rd_ptr_s
add wave -noupdate -expand -group dut -expand /tb_top/dut/bin_rd_ptr
add wave -noupdate -expand -group dut /tb_top/dut/bin_rd_ptr_next
add wave -noupdate -expand -group dut /tb_top/dut/grey_rd_ptr_next
add wave -noupdate -expand -group dut /tb_top/dut/asf_empty_r
add wave -noupdate -expand -group dut /tb_top/dut/bin_wr_ptr
add wave -noupdate -expand -group dut /tb_top/dut/bin_wr_ptr_next
add wave -noupdate -expand -group dut /tb_top/dut/grey_wr_ptr_next
add wave -noupdate -expand -group dut /tb_top/dut/asf_full_r
add wave -noupdate -expand -group dut /tb_top/dut/data_0_r
add wave -noupdate -expand -group dut /tb_top/dut/data_1_r
add wave -noupdate -expand -group dut /tb_top/dut/wr_data_mux
add wave -noupdate -expand -group source /tb_top/dut/source/clk
add wave -noupdate -expand -group source /tb_top/dut/source/reset
add wave -noupdate -expand -group source /tb_top/dut/source/full
add wave -noupdate -expand -group source /tb_top/dut/source/wr_en
add wave -noupdate -expand -group source /tb_top/dut/source/wr_data
add wave -noupdate -expand -group sink /tb_top/dut/sink/clk
add wave -noupdate -expand -group sink /tb_top/dut/sink/reset
add wave -noupdate -expand -group sink /tb_top/dut/sink/empty
add wave -noupdate -expand -group sink /tb_top/dut/sink/rd_en
add wave -noupdate -expand -group sink /tb_top/dut/sink/rd_data
add wave -noupdate -divider {New Divider}
add wave -noupdate -divider {New Divider}
add wave -noupdate /tb_top/dut/data_0_r
add wave -noupdate /tb_top/dut/data_1_r
add wave -noupdate -divider {New Divider}
add wave -noupdate /tb_top/dut/source/wr_en
add wave -noupdate /tb_top/dut/sink/rd_en
add wave -noupdate -divider {New Divider}
add wave -noupdate /tb_top/dut/source/full
add wave -noupdate /tb_top/dut/sink/empty
add wave -noupdate -divider {New Divider}
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {177500 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 220
configure wave -valuecolwidth 40
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} {2753625 ps}
/qaz_libs/trunk/FIFOs/sim/tests/tiny_sync_fifo/init_test.do
15,7 → 15,7
 
make_lib work 1
 
sim_compile_all FPGA
sim_compile_all sync_fifo
sim_compile_all sim
 
# simulation $root
/qaz_libs/trunk/FIFOs/sim/tests/tiny_sync_fifo/wave.do
0,0 → 1,45
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -divider {New Divider}
add wave -noupdate -divider {New Divider}
add wave -noupdate -expand -group dut /tb_top/dut/empty_r
add wave -noupdate -expand -group dut /tb_top/dut/full_r
add wave -noupdate -expand -group dut /tb_top/dut/writing
add wave -noupdate -expand -group dut /tb_top/dut/reading
add wave -noupdate -expand -group dut /tb_top/dut/rd_ptr_r
add wave -noupdate -expand -group dut /tb_top/dut/next_rd_ptr_r
add wave -noupdate -expand -group dut /tb_top/dut/wr_ptr_r
add wave -noupdate -expand -group dut /tb_top/dut/next_wr_ptr_r
add wave -noupdate -expand -group dut /tb_top/dut/data_0_r
add wave -noupdate -expand -group dut /tb_top/dut/data_1_r
add wave -noupdate -expand -group dut /tb_top/dut/wr_data_mux
add wave -noupdate -expand -group sink /tb_top/dut/sink/clk
add wave -noupdate -expand -group sink /tb_top/dut/sink/reset
add wave -noupdate -expand -group sink /tb_top/dut/sink/empty
add wave -noupdate -expand -group sink /tb_top/dut/sink/rd_data
add wave -noupdate -expand -group sink /tb_top/dut/sink/rd_en
add wave -noupdate -expand -group source /tb_top/dut/source/clk
add wave -noupdate -expand -group source /tb_top/dut/source/reset
add wave -noupdate -expand -group source /tb_top/dut/source/full
add wave -noupdate -expand -group source /tb_top/dut/source/wr_data
add wave -noupdate -expand -group source /tb_top/dut/source/wr_en
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 220
configure wave -valuecolwidth 40
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} {254625 ps}
/qaz_libs/trunk/FIFOs/src/sync_fifo.v
1,6 → 1,29
// --------------------------------------------------------------------
//
// --------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
/qaz_libs/trunk/FIFOs/src/tiny_async_fifo.sv
1,5 → 1,29
// --------------------------------------------------------------------
//
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
/qaz_libs/trunk/FIFOs/src/tiny_sync_fifo.sv
1,9 → 1,36
// --------------------------------------------------------------------
//
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
tiny_sync_fifo
#(
parameter W = 8
)
(
fifo_write_if.fifo source,
fifo_read_if.fifo sink
11,11 → 38,10
 
// --------------------------------------------------------------------
//
localparam W = source.W;
reg empty_r;
reg full_r;
wire writing = source.wr_en && (sink.rd_en || ~full_r);
wire reading = sink.rd_en && ~empty_r;
wire writing = source.wr_en & (sink.rd_en | ~full_r);
wire reading = sink.rd_en & ~empty_r;
 
 
// --------------------------------------------------------------------
27,7 → 53,7
if(source.reset)
next_rd_ptr_r = 0;
else if(reading)
next_rd_ptr_r = ~next_rd_ptr_r;
next_rd_ptr_r = ~rd_ptr_r;
else
next_rd_ptr_r = rd_ptr_r;
 
43,8 → 69,8
always_comb
if (source.reset)
next_wr_ptr_r = 0;
else if (writing)
next_wr_ptr_r = ~next_wr_ptr_r;
else if(writing)
next_wr_ptr_r = ~wr_ptr_r;
else
next_wr_ptr_r = wr_ptr_r;
 
57,9 → 83,9
always_ff @(posedge source.clk)
if (source.reset)
empty_r <= 1;
else if (reading && next_wr_ptr_r == next_rd_ptr_r && ~full_r)
else if (reading & (next_wr_ptr_r == next_rd_ptr_r) & ~full_r)
empty_r <= 1;
else if (writing && ~reading)
else if (writing & ~reading)
empty_r <= 0;
else
empty_r <= empty_r;
70,9 → 96,9
always_ff @(posedge source.clk)
if (source.reset)
full_r <= 0;
else if (writing && next_wr_ptr_r == next_rd_ptr_r)
else if (writing & (next_wr_ptr_r == next_rd_ptr_r))
full_r <= 1;
else if (reading && ~writing)
else if (reading & ~writing)
full_r <= 0;
 
 
80,12 → 106,12
//
reg [W - 1:0] data_0_r;
reg [W - 1:0] data_1_r;
wire [W - 1:0] wr_data_mux = rd_ptr_r[0] ? data_1_r : data_0_r;
wire [W - 1:0] wr_data_mux = rd_ptr_r ? data_1_r : data_0_r;
assign sink.rd_data = wr_data_mux;
 
always_ff @(posedge source.clk)
if (writing)
if(wr_ptr_r[0])
if(wr_ptr_r)
data_1_r <= source.wr_data;
else
data_0_r <= source.wr_data;
/qaz_libs/trunk/axi4_stream_lib/sim/libs/axi4_stream_lib_verilog/axi4_stream_lib.f
0,0 → 1,13
#
 
 
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/axis_if.sv
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/axis_video_debug.sv
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/data_to_axis_fsm.sv
 
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/axis_to_vid_fsm.sv
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/camera_link_to_axis.sv
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/camera_link_to_axis_fsm.sv
 
${ROOT_DIR}/qaz_libs/axi4_stream_lib/src/axis_register_slice.sv
 
/qaz_libs/trunk/axi4_stream_lib/sim/libs/sim_verilog/avf.f
0,0 → 1,9
#
 
-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
 
 
/qaz_libs/trunk/axi4_stream_lib/sim/libs/sim_verilog/tb_lib.f
0,0 → 1,16
#
 
-mfcu
 
${ROOT_DIR}/qaz_libs/tb_class/src/tb_clk_class.sv
 
${ROOT_DIR}/qaz_libs/tb_class/src/tb_clk.sv
${ROOT_DIR}/qaz_libs/tb_class/src/tb_base.sv
 
 
 
 
 
 
 
 
/qaz_libs/trunk/axi4_stream_lib/sim/libs/sync_fifo_verilog/tiny_fifo.f
0,0 → 1,8
#
 
 
${ROOT_DIR}/qaz_libs/FIFOs/src/tiny_sync_fifo.sv
${ROOT_DIR}/qaz_libs/FIFOs/src/fifo_read_if.sv
${ROOT_DIR}/qaz_libs/FIFOs/src/fifo_write_if.sv
 
 
/qaz_libs/trunk/axi4_stream_lib/sim/src/tb_axis_register_slice.sv
0,0 → 1,159
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 = 1; // 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)) axis_in[TILES](.*);
axis_if #(.N(AVF_N), .U(AVF_U)) axis_out[TILES](.*);
 
 
// --------------------------------------------------------------------
//
axis_register_slice #(.N(AVF_N), .U(AVF_U))
dut
(
.axis_en(1'b1),
.axis_in(axis_in.slave[0]),
.axis_out(axis_out.master[0]),
.*
);
// --------------------------------------------------------------------
//
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_h = new
(
.avf_agent_config(avf_agent_config_h),
.avf_axis_in_if(axis_out),
.avf_axis_out_if(axis_in)
);
 
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(axis_out[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
 
 
 
/qaz_libs/trunk/axi4_stream_lib/sim/tests/tb_axis_register_slice/init_test.do
0,0 → 1,35
# ------------------------------------
#
# ------------------------------------
 
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
sim_compile_all sync_fifo
sim_compile_all axi4_stream_lib
 
# simulation $root
vlog $env(PROJECT_DIR)/sim/src/tb_axis_register_slice.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
 
 
 
/qaz_libs/trunk/axi4_stream_lib/sim/tests/tb_axis_register_slice/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
 
 
/qaz_libs/trunk/axi4_stream_lib/sim/tests/tb_axis_register_slice/the_test.sv
0,0 → 1,79
//////////////////////////////////////////////////////////////////////
//// ////
//// 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(4us);
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();
 
// --------------------------------------------------------------------
// insert test above
// --------------------------------------------------------------------
 
endtask
 
 
endmodule
 
/qaz_libs/trunk/axi4_stream_lib/sim/tests/tb_axis_register_slice/wip.do
0,0 → 1,12
#
 
 
vlog -f ../../libs/axi4_stream_lib_verilog/axi4_stream_lib.f
 
# simulation $root
vlog ../../src/tb_axis_register_slice.sv
 
# compile test last
vlog ./the_test.sv
 
/qaz_libs/trunk/axi4_stream_lib/src/axis_flow_control.sv
0,0 → 1,127
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
axis_flow_control
#(
N = 8, // data bus width in bytes
I = 0, // TID width
D = 0, // TDEST width
U = 1, // TUSER width
USE_TSTRB = 0, // set to 1 to enable, 0 to disable
USE_TKEEP = 0 // set to 1 to enable, 0 to disable
)
(
input axis_en,
input flow_enable, // enable / disable incoming tready & tvalid
input [1:0] tready_to_master_select, // 00:force 0, 01:force 1, 1X:from_slave
input [1:0] tvalid_to_master_select, // 00:force 0, 01:force 1, 1X:from_slave
output tready_from_slave, // from input of mux
output tvalid_from_slave, // from input of mux
axis_if.slave axis_in,
axis_if.master axis_out,
input aclk,
input aresetn
);
 
// --------------------------------------------------------------------
//
localparam W = (N * 8) + (N * USE_TSTRB) + (N * USE_TKEEP) + I + D + U + 1;
 
fifo_write_if #(.W(W)) fifo_sink(aclk, ~aresetn);
fifo_read_if #(.W(W)) fifo_source(aclk, ~aresetn);
 
tiny_sync_fifo #(.W(W))
tiny_sync_fifo_i(.source(fifo_sink.fifo), .sink(fifo_source.fifo));
 
 
// --------------------------------------------------------------------
//
wire data_to_axis_fsm_error;
 
data_to_axis_fsm
data_to_axis_fsm_i
(
.axis_tvalid(tvalid_from_slave), // axis_out.tvalid
.axis_tready(flow_enable & axis_out.tready),
.fifo_empty(fifo_source.empty),
.fifo_rd_en(fifo_source.rd_en),
.fifo_watermark(1'b1),
.*
);
 
 
// --------------------------------------------------------------------
//
reg axis_in_tready_r;
assign axis_in.tready = axis_in_tready_r;
always_comb
case(tready_to_master_select)
2'b00: axis_in_tready_r = 0;
2'b01: axis_in_tready_r = 1;
2'b10: axis_in_tready_r = tready_from_slave;
2'b11: axis_in_tready_r = tready_from_slave;
endcase
 
// --------------------------------------------------------------------
//
reg axis_out_tvalid_r;
assign axis_out.tvalid = axis_out_tvalid_r;
always_comb
case(tvalid_to_master_select)
2'b00: axis_out_tvalid_r = 0;
2'b01: axis_out_tvalid_r = 1;
2'b10: axis_out_tvalid_r = tvalid_from_slave;
2'b11: axis_out_tvalid_r = tvalid_from_slave;
endcase
 
 
// --------------------------------------------------------------------
//
assign tready_from_slave = ~fifo_sink.full; // axis_in.tready
 
assign fifo_sink.wr_en = flow_enable & axis_in.tvalid & ~fifo_sink.full;
assign fifo_sink.wr_data =
{
axis_in.tdata,
axis_in.tlast,
axis_in.tuser
};
 
assign
{
axis_out.tdata,
axis_out.tlast,
axis_out.tuser
} = fifo_source.rd_data;
 
 
endmodule
 
/qaz_libs/trunk/axi4_stream_lib/src/axis_mux.sv
0,0 → 1,91
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
axis_mux
#(
N = 8, // data bus width in bytes
I = 1, // TID width
D = 1, // TDEST width
U = 1, // TUSER width
USE_TSTRB = 0, // set to 1 to enable, 0 to disable
USE_TKEEP = 0 // set to 1 to enable, 0 to disable
)
(
input mux_select,
axis_if.slave axis_0_in,
axis_if.slave axis_1_in,
axis_if.master axis_out,
input axis_en,
input aclk,
input aresetn
);
 
// --------------------------------------------------------------------
//
axis_if #(.N(N), .I(I), .D(D), .U(U))
axis_mux_out(.*);
 
assign axis_0_in.tready = mux_select ? 0 : axis_mux_out.tready;
assign axis_1_in.tready = mux_select ? axis_mux_out.tready : 0;
 
assign axis_mux_out.tvalid = mux_select ? axis_1_in.tvalid : axis_0_in.tvalid;
assign axis_mux_out.tdata = mux_select ? axis_1_in.tdata : axis_0_in.tdata;
assign axis_mux_out.tstrb = mux_select ? axis_1_in.tstrb : axis_0_in.tstrb;
assign axis_mux_out.tkeep = mux_select ? axis_1_in.tkeep : axis_0_in.tkeep;
assign axis_mux_out.tlast = mux_select ? axis_1_in.tlast : axis_0_in.tlast;
assign axis_mux_out.tid = mux_select ? axis_1_in.tid : axis_0_in.tid;
assign axis_mux_out.tdest = mux_select ? axis_1_in.tdest : axis_0_in.tdest;
assign axis_mux_out.tuser = mux_select ? axis_1_in.tuser : axis_0_in.tuser;
 
 
// --------------------------------------------------------------------
//
axis_register_slice
#(
.N(N),
.I(I),
.D(D),
.U(U),
.USE_TSTRB(USE_TSTRB),
.USE_TKEEP(USE_TKEEP)
)
axis_register_slice_i
(
.axis_in(axis_mux_out), // .slave
.axis_out(axis_out), // .master
.*
);
 
 
// --------------------------------------------------------------------
//
 
 
endmodule
 
 
/qaz_libs/trunk/axi4_stream_lib/src/axis_register_slice.sv
0,0 → 1,159
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
axis_register_slice
#(
N = 8, // data bus width in bytes
I = 0, // TID width
D = 0, // TDEST width
U = 1, // TUSER width
USE_TSTRB = 0, // set to 1 to enable, 0 to disable
USE_TKEEP = 0 // set to 1 to enable, 0 to disable
)
(
input axis_en,
axis_if.slave axis_in,
axis_if.master axis_out,
input aclk,
input aresetn
);
 
// --------------------------------------------------------------------
//
localparam W = (N * 8) + (N * USE_TSTRB) + (N * USE_TKEEP) + I + D + U + 1;
 
fifo_write_if #(.W(W)) fifo_sink(aclk, ~aresetn);
fifo_read_if #(.W(W)) fifo_source(aclk, ~aresetn);
 
tiny_sync_fifo #(.W(W))
tiny_sync_fifo_i(.source(fifo_sink.fifo), .sink(fifo_source.fifo));
 
 
// --------------------------------------------------------------------
//
wire data_to_axis_fsm_error;
 
data_to_axis_fsm
data_to_axis_fsm_i
(
.axis_tvalid(axis_out.tvalid),
.axis_tready(axis_out.tready),
.fifo_empty(fifo_source.empty),
.fifo_rd_en(fifo_source.rd_en),
.fifo_watermark(1'b1),
.*
);
 
 
// --------------------------------------------------------------------
//
generate
begin: assign_gen
 
if(USE_TSTRB & USE_TKEEP)
begin
assign fifo_sink.wr_data =
{
axis_in.tdata,
axis_in.tlast,
axis_in.tuser,
axis_in.tstrb,
axis_in.tkeep
};
assign
{
axis_out.tdata,
axis_out.tlast,
axis_out.tuser,
axis_out.tstrb,
axis_out.tkeep
} = fifo_source.rd_data;
end
else if(USE_TSTRB)
begin
assign fifo_sink.wr_data =
{
axis_in.tdata,
axis_in.tlast,
axis_in.tuser,
axis_in.tstrb
};
assign
{
axis_out.tdata,
axis_out.tlast,
axis_out.tuser,
axis_out.tstrb
} = fifo_source.rd_data;
end
else if(USE_TKEEP)
begin
assign fifo_sink.wr_data =
{
axis_in.tdata,
axis_in.tlast,
axis_in.tuser,
axis_in.tkeep
};
assign
{
axis_out.tdata,
axis_out.tlast,
axis_out.tuser,
axis_out.tkeep
} = fifo_source.rd_data;
end
else
begin
assign fifo_sink.wr_data =
{
axis_in.tdata,
axis_in.tlast,
axis_in.tuser
};
assign
{
axis_out.tdata,
axis_out.tlast,
axis_out.tuser
} = fifo_source.rd_data;
end
 
end
endgenerate
 
 
// --------------------------------------------------------------------
//
assign axis_in.tready = ~fifo_sink.full;
assign fifo_sink.wr_en = axis_in.tvalid & ~fifo_sink.full;
 
 
 
endmodule
 
/qaz_libs/trunk/axi4_stream_lib/src/axis_to_vid_fsm.sv
0,0 → 1,136
// --------------------------------------------------------------------
//
// --------------------------------------------------------------------
 
 
module
axis_to_vid_fsm
(
input axis_to_vid_fsm_en,
input [31:0] reg_active_size,
input [15:0] reg_hblanking,
input [15:0] reg_vblanking,
 
input vid_sof,
input vid_eol,
input vid_stall_at_vblank,
 
output fifo_rd_en,
 
output vid_timing_fsm_idle,
output vid_active_video,
output vid_hblank,
output vid_vblank,
output vid_timing_fsm_error,
input vid_clk,
input vid_clk_en,
input vid_reset
);
 
// --------------------------------------------------------------------
//
reg [15:0] pixel_counter;
reg [15:0] line_counter;
wire [15:0] active_hsize = reg_active_size[15:0];
wire [15:0] active_vsize = reg_active_size[31:16];
 
 
//---------------------------------------------------
// state machine binary definitions
enum reg [4:0] {
IDLE_STATE = 5'b0_0001,
PIXEL_DATA = 5'b0_0010,
HORIZONTAL_BLANKING = 5'b0_0100,
VERTICAL_BLANKING = 5'b0_1000,
ERROR_STATE = 5'b1_0000
} state, next_state;
 
 
//---------------------------------------------------
// state machine flop
always_ff @(posedge vid_clk)
if(vid_reset)
state <= IDLE_STATE;
else if(vid_clk_en)
state <= next_state;
 
 
//---------------------------------------------------
// state machine
always_comb
case(state)
IDLE_STATE: if(axis_to_vid_fsm_en)
if(vid_stall_at_vblank)
next_state <= VERTICAL_BLANKING;
else
next_state <= PIXEL_DATA;
else
next_state <= IDLE_STATE;
 
PIXEL_DATA: if(vid_eol)
next_state <= HORIZONTAL_BLANKING;
else
next_state <= PIXEL_DATA;
 
HORIZONTAL_BLANKING: if(pixel_counter < reg_hblanking)
next_state <= HORIZONTAL_BLANKING;
else if(line_counter < active_vsize)
next_state <= PIXEL_DATA;
else
next_state <= VERTICAL_BLANKING;
 
VERTICAL_BLANKING: if(pixel_counter < reg_vblanking)
next_state <= VERTICAL_BLANKING;
else if(axis_to_vid_fsm_en)
if(vid_stall_at_vblank)
next_state <= VERTICAL_BLANKING;
else
next_state <= PIXEL_DATA;
else
next_state <= IDLE_STATE;
ERROR_STATE: next_state <= IDLE_STATE;
 
default: next_state <= ERROR_STATE;
 
endcase
 
 
// --------------------------------------------------------------------
//
wire pixel_counter_reset = vid_reset | (state == IDLE_STATE) | (state != next_state);
 
always_ff @(posedge vid_clk)
if(pixel_counter_reset)
pixel_counter <= 1;
else if(vid_clk_en)
pixel_counter <= pixel_counter + 1;
// --------------------------------------------------------------------
//
wire line_counter_reset = vid_reset |
(state == IDLE_STATE) |
(vid_sof & (state != next_state));
 
always_ff @(posedge vid_clk)
if(line_counter_reset)
line_counter <= 0;
else if(vid_clk_en & (state == PIXEL_DATA) & vid_eol)
line_counter <= line_counter + 1;
//---------------------------------------------------
// output
assign vid_timing_fsm_error = (state == ERROR_STATE);
assign vid_timing_fsm_idle = (state == IDLE_STATE);
assign vid_active_video = (state == PIXEL_DATA);
assign vid_hblank = (state == HORIZONTAL_BLANKING);
assign vid_vblank = (state == VERTICAL_BLANKING);
assign fifo_rd_en = vid_active_video;
 
endmodule
 
 
 
/qaz_libs/trunk/axi4_stream_lib/src/camera_link_to_axis.sv
0,0 → 1,59
// --------------------------------------------------------------------
//
// --------------------------------------------------------------------
 
 
module
camera_link_to_axis
#(
DATA_IN_WIDTH = 64 // same as axis_out_bus.TDATA_WIDTH
)
(
axis_if.master axis_out_bus,
input [DATA_IN_WIDTH-1:0] cl_data_in,
input cl_frame_valid,
input cl_line_valid,
input cl_data_valid,
input cl_reset, // same as axis_out_bus.aresetn
input cl_clk // same as axis_out_bus.aclk
);
 
// --------------------------------------------------------------------
//
reg [DATA_IN_WIDTH-1:0] cl_data_in_r0;
reg cl_frame_valid_r0;
reg cl_line_valid_r0;
reg cl_data_valid_r0;
always @(posedge cl_clk)
begin
cl_data_in_r0 <= cl_data_in;
cl_frame_valid_r0 <= cl_frame_valid;
cl_line_valid_r0 <= cl_line_valid;
cl_data_valid_r0 <= cl_data_valid;
end
 
 
// --------------------------------------------------------------------
//
reg [DATA_IN_WIDTH-1:0] cl_data_in_r1;
reg cl_frame_valid_r1;
reg cl_line_valid_r1;
reg cl_data_valid_r1;
always @(posedge cl_clk)
begin
cl_data_in_r1 <= cl_data_in_r0;
cl_frame_valid_r1 <= cl_frame_valid_r0;
cl_line_valid_r1 <= cl_line_valid_r0;
cl_data_valid_r1 <= cl_data_valid_r0;
end
 
// --------------------------------------------------------------------
//
 
endmodule
 
 
/qaz_libs/trunk/axi4_stream_lib/src/camera_link_to_axis_fsm.sv
0,0 → 1,83
// --------------------------------------------------------------------
//
// --------------------------------------------------------------------
 
 
module
camera_link_to_axis_fsm
(
input axis_en,
output axis_tvalid,
input axis_tready,
input fifo_almost_full,
input fifo_empty,
output fifo_rd_en,
output data_to_axis_fsm_error,
 
input aclk,
input aresetn
);
 
//---------------------------------------------------
// state machine binary definitions
enum reg [3:0] {
IDLE_STATE = 4'b0001,
TVALID = 4'b0010,
TREADY = 4'b0100,
ERROR_STATE = 4'b1000
} state, next_state;
 
 
//---------------------------------------------------
// state machine flop
always_ff @(posedge aclk)
if(~aresetn)
state <= IDLE_STATE;
else
state <= next_state;
 
 
//---------------------------------------------------
// state machine
always_comb
case(state)
IDLE_STATE: if(axis_en & fifo_almost_full)
if(axis_tready)
next_state <= TREADY;
else
next_state <= TVALID;
else
next_state <= IDLE_STATE;
 
TVALID: if(axis_tready) // wait for slave to be ready
next_state <= TREADY;
else
next_state <= TVALID;
 
TREADY: if(fifo_empty) // slave can accept data
next_state <= IDLE_STATE;
else if(axis_tready)
next_state <= TREADY;
else
next_state <= TVALID;
 
ERROR_STATE: next_state <= IDLE_STATE;
 
default: next_state <= ERROR_STATE;
 
endcase
 
 
//---------------------------------------------------
// outputs
assign axis_tvalid = (next_state == TVALID) | (next_state == TREADY);
assign fifo_rd_en = axis_tvalid & axis_tready;
assign data_to_axis_fsm_error = (state == ERROR_STATE);
 
endmodule
 
 
 
/qaz_libs/trunk/axi4_stream_lib/src/data_to_axis_fsm.sv
66,7 → 66,7
// state machine
always_comb
case(state)
IDLE_STATE: if(axis_en & fifo_watermark)
IDLE_STATE: if(axis_en & fifo_watermark & ~fifo_empty)
if(axis_tready)
next_state <= TREADY;
else
/qaz_libs/trunk/axi4_stream_lib/syn/src/axis_if.sv
0,0 → 1,92
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 ////
//// ////
//////////////////////////////////////////////////////////////////////
 
 
interface
axis_if
#(
N = 8, // data bus width in bytes
I = 1, // TID width
D = 1, // TDEST width
U = 1 // TUSER width
)
(
input aclk,
input aresetn
);
wire tvalid;
wire tready;
wire [(8*N)-1:0] tdata;
wire [N-1:0] tstrb;
wire [N-1:0] tkeep;
wire tlast;
wire [I-1:0] tid;
wire [D-1:0] tdest;
wire [U-1:0] tuser;
 
 
// --------------------------------------------------------------------
//
modport
master
(
input aresetn,
input aclk,
output tvalid,
input tready,
output tdata,
output tstrb,
output tkeep,
output tlast,
output tid,
output tdest,
output tuser
);
 
 
// --------------------------------------------------------------------
//
modport
slave
(
input aresetn,
input aclk,
input tvalid,
output tready,
input tdata,
input tstrb,
input tkeep,
input tlast,
input tid,
input tdest,
input tuser
);
 
 
endinterface: axis_if
 
 
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/src/avf_1_tile_4_outputs_class_pkg.sv
0,0 → 1,122
//////////////////////////////////////////////////////////////////////
//// ////
//// 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_1_tile_4_outputs_class_pkg;
 
// --------------------------------------------------------------------
//
import video_frame_pkg::*;
import axis_video_frame_bfm_pkg::*;
import avf_agent_class_pkg::*;
 
// --------------------------------------------------------------------
//
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
localparam AVF_B = BYTES_PER_PIXEL * 8; // bits per pixel on TDATA
 
// --------------------------------------------------------------------
//
class avf_1_tile_4_outputs_class extends avf_agent_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE);
 
avf_config_t avf_config;
avf_tile_config_t tile_config[TILES];
 
//--------------------------------------------------------------------
//
function new
(
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_in_if[TILES],
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if[TILES]
);
 
super.new
(
.avf_axis_in_if(avf_axis_in_if),
.avf_axis_out_if(avf_axis_out_if)
);
endfunction: new
 
 
// --------------------------------------------------------------------
//
task automatic init;
 
this.avf_config.width = WIDTH;
this.avf_config.height = HEIGHT;
this.avf_config.bytes_per_pixel = BYTES_PER_PIXEL;
this.avf_config.bits_per_pixel = BITS_PER_PIXEL;
this.avf_config.name = "AVF_";
this.avf_config.vertical_blanking = VERTICAL_BLANKING;
this.tile_config[0].direction = RIGHT_DOWN;
foreach(this.avf_axis_in_if[i])
this.init_rx
(
.index(i),
.avf_config(this.avf_config),
.tile_config(this.tile_config[i])
);
foreach(this.avf_axis_out_if[i])
this.init_tx
(
.index(i),
.avf_config(this.avf_config),
.tile_config(this.tile_config[i])
);
super.init();
endtask: init
 
 
// --------------------------------------------------------------------
//
 
endclass: avf_1_tile_4_outputs_class
 
endpackage: avf_1_tile_4_outputs_class_pkg
 
 
 
 
 
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/src/avf_4_tile_1_outputs_class_pkg.sv
0,0 → 1,125
//////////////////////////////////////////////////////////////////////
//// ////
//// 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_4_tile_1_outputs_class_pkg;
 
// --------------------------------------------------------------------
//
import video_frame_pkg::*;
import axis_video_frame_bfm_pkg::*;
import avf_agent_class_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 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
localparam AVF_B = BYTES_PER_PIXEL * 8; // bits per pixel on TDATA
 
// --------------------------------------------------------------------
//
class avf_4_tile_1_outputs_class extends avf_agent_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE);
 
avf_config_t avf_config;
avf_tile_config_t tile_config[TILES];
 
//--------------------------------------------------------------------
//
function new
(
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_in_if[TILES],
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if[TILES]
);
 
super.new
(
.avf_axis_in_if(avf_axis_in_if),
.avf_axis_out_if(avf_axis_out_if)
);
endfunction: new
 
 
// --------------------------------------------------------------------
//
task automatic init;
 
this.avf_config.width = WIDTH;
this.avf_config.height = HEIGHT;
this.avf_config.bytes_per_pixel = BYTES_PER_PIXEL;
this.avf_config.bits_per_pixel = BITS_PER_PIXEL;
this.avf_config.name = "AVF_";
this.avf_config.vertical_blanking = VERTICAL_BLANKING;
this.tile_config[0].direction = RIGHT_DOWN;
this.tile_config[1].direction = RIGHT_UP;
this.tile_config[2].direction = LEFT_DOWN;
this.tile_config[3].direction = LEFT_UP;
foreach(this.avf_axis_in_if[i])
this.init_rx
(
.index(i),
.avf_config(this.avf_config),
.tile_config(this.tile_config[i])
);
foreach(this.avf_axis_out_if[i])
this.init_tx
(
.index(i),
.avf_config(this.avf_config),
.tile_config(this.tile_config[i])
);
super.init();
endtask: init
 
 
// --------------------------------------------------------------------
//
 
endclass: avf_4_tile_1_outputs_class
 
endpackage: avf_4_tile_1_outputs_class_pkg
 
 
 
 
 
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/src/tb_1_tile_4_outputs.sv
41,63 → 41,15
 
// --------------------------------------------------------------------
//
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
 
import avf_1_tile_4_outputs_class_pkg::*;
avf_1_tile_4_outputs_class a_h;
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
a_h = new(.avf_axis_in_if(avf_axis), .avf_axis_out_if(avf_axis));
 
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_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
// | | | | | | | | | | | | | | | | |
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/src/tb_4_tile_1_outputs.sv
41,66 → 41,15
 
// --------------------------------------------------------------------
//
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 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
 
import avf_4_tile_1_outputs_class_pkg::*;
avf_4_tile_1_outputs_class a_h;
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
a_h = new(.avf_axis_in_if(avf_axis), .avf_axis_out_if(avf_axis));
 
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
// | | | | | | | | | | | | | | | | |
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/init_test.do
19,6 → 19,7
sim_compile_all sim
 
# simulation $root
vlog $env(PROJECT_DIR)/sim/src/avf_1_tile_4_outputs_class_pkg.sv
vlog $env(PROJECT_DIR)/sim/src/tb_1_tile_4_outputs.sv
 
# compile test last
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/tests/tb_1_tile_4_outputs/the_test.sv
51,11 → 51,13
$display("^^^---------------------------------");
// --------------------------------------------------------------------
 
tb_top.a_h.init();
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);
#(11us) tb_top.a_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
end
join_none
 
66,30 → 68,30
 
// --------------------------------------------------------------------
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.a_h.make_frame("counting");
tb_top.a_h.get_frame();
tb_top.a_h.put_frame();
 
wait(~tb_top.avf_agent_h.put_frame_active);
wait(~tb_top.avf_agent_h.get_frame_active);
wait(~tb_top.a_h.put_frame_active);
wait(~tb_top.a_h.get_frame_active);
 
mismatch_count = tb_top.avf_agent_h.compare_frame();
mismatch_count = tb_top.a_h.compare_frame();
 
tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
tb_top.a_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
 
mismatch_count = tb_top.avf_agent_h.compare_frame();
mismatch_count = tb_top.a_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.a_h.make_frame("constant", 16'habba);
tb_top.a_h.queue_frame();
 
tb_top.avf_agent_h.queue_frame("random");
tb_top.avf_agent_h.queue_frame("counting");
tb_top.a_h.queue_frame("random");
tb_top.a_h.queue_frame("counting");
 
tb_top.avf_agent_h.wait_for_tx_frames(3);
tb_top.a_h.wait_for_tx_frames(3);
 
repeat(100) @(posedge tb_clk);
 
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/tests/tb_4_tile_1_outputs/init_test.do
19,6 → 19,7
sim_compile_all sim
 
# simulation $root
vlog $env(PROJECT_DIR)/sim/src/avf_4_tile_1_outputs_class_pkg.sv
vlog $env(PROJECT_DIR)/sim/src/tb_4_tile_1_outputs.sv
 
# compile test last
/qaz_libs/trunk/axis_video_frame_bfm_class/sim/tests/tb_4_tile_1_outputs/the_test.sv
51,11 → 51,13
$display("^^^---------------------------------");
// --------------------------------------------------------------------
 
tb_top.a_h.init();
tb_top.tb.timeout_stop(20us);
 
inject_error : fork
begin
#(11us) tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
#(11us) tb_top.a_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
end
join_none
 
66,30 → 68,30
 
// --------------------------------------------------------------------
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.a_h.make_frame("counting");
tb_top.a_h.get_frame();
tb_top.a_h.put_frame();
 
wait(~tb_top.avf_agent_h.put_frame_active);
wait(~tb_top.avf_agent_h.get_frame_active);
wait(~tb_top.a_h.put_frame_active);
wait(~tb_top.a_h.get_frame_active);
 
mismatch_count = tb_top.avf_agent_h.compare_frame();
mismatch_count = tb_top.a_h.compare_frame();
 
tb_top.avf_agent_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
tb_top.a_h.rx_bfm_h[0].f_h.write_pixel('{1,1}, 0);
 
mismatch_count = tb_top.avf_agent_h.compare_frame();
mismatch_count = tb_top.a_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.a_h.make_frame("constant", 16'habba);
tb_top.a_h.queue_frame();
 
tb_top.avf_agent_h.queue_frame("random");
tb_top.avf_agent_h.queue_frame("counting");
tb_top.a_h.queue_frame("random");
tb_top.a_h.queue_frame("counting");
 
tb_top.avf_agent_h.wait_for_tx_frames(3);
tb_top.a_h.wait_for_tx_frames(3);
 
repeat(100) @(posedge tb_clk);
 
/qaz_libs/trunk/axis_video_frame_bfm_class/src/avf_agent_class_pkg.sv
36,48 → 36,14
 
// --------------------------------------------------------------------
//
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
int number_of_rx_tiles;
int number_of_tx_tiles;
 
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[];
85,7 → 51,6
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;
 
 
93,54 → 58,31
//
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.number_of_rx_tiles = $size(avf_axis_in_if);
this.avf_axis_in_if = avf_axis_in_if;
this.rx_bfm_h = new[number_of_rx_tiles];
foreach(this.rx_bfm_h[i])
this.rx_bfm_h[i] = new(avf_axis_in_if[i]);
 
this.avf_axis_out_if = new[avf_agent_config.avf.tiles];
this.number_of_tx_tiles = $size(avf_axis_out_if);
this.avf_axis_out_if = avf_axis_out_if;
 
this.tx_bfm_h = new[avf_agent_config.avf.tiles];
this.tx_bfm_h = new[number_of_tx_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;
virtual 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();
 
148,11 → 90,51
rx_bfm_h[i].run_rx_q();
 
endtask: init
 
// --------------------------------------------------------------------
//
virtual task automatic init_rx
(
int index,
input avf_config_t avf_config,
input avf_tile_config_t tile_config
);
 
this.rx_bfm_h[index].init
(
.avf_config(avf_config),
.tile_config(tile_config),
.avf_name($psprintf("%s%0d", avf_config.name, index)),
.avf_type("RX")
);
 
endtask: init_rx
 
// --------------------------------------------------------------------
//
task automatic
virtual task automatic init_tx
(
int index,
input avf_config_t avf_config,
input avf_tile_config_t tile_config
);
 
this.tx_bfm_h[index].init
(
.avf_config(avf_config),
.tile_config(tile_config),
.avf_name($psprintf("%s%0d", avf_config.name, index)),
.avf_type("TX")
);
 
endtask: init_tx
 
 
// --------------------------------------------------------------------
//
virtual task automatic
make_frame
(
string pattern,
173,7 → 155,7
 
// --------------------------------------------------------------------
//
task automatic
virtual task automatic
queue_frame
(
string pattern = ""
196,7 → 178,7
 
// --------------------------------------------------------------------
//
task
virtual task
wait_for_tx_frames
(
input int unsigned count
213,7 → 195,7
logic put_frame_active = 0;
semaphore put_frame_semaphore = new(1);
 
task automatic
virtual task automatic
put_frame;
 
if(put_frame_semaphore.try_get() == 0)
244,7 → 226,7
 
// --------------------------------------------------------------------
//
task
virtual task
wait_for_rx_frames
(
input int unsigned count
261,7 → 243,7
semaphore get_frame_semaphore = new(1);
logic get_frame_active = 0;
 
task automatic
virtual task automatic
get_frame;
 
if(get_frame_semaphore.try_get() == 0)
293,11 → 275,11
 
// --------------------------------------------------------------------
//
function automatic
virtual function automatic
int compare_frame;
 
int mismatch_count[];
mismatch_count = new[avf_agent_config.avf.tiles];
mismatch_count = new[number_of_rx_tiles];
 
$display("^^^ %16.t | %m", $time);
 
/qaz_libs/trunk/axis_video_frame_bfm_class/src/axis_video_frame_bfm_pkg.sv
34,8 → 34,6
int height;
int bytes_per_pixel;
int bits_per_pixel;
int tiles;
int outputs_per_tile;
string name;
int vertical_blanking;
} avf_config_t;
58,11 → 56,11
//
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, PIXELS_PER_CLK = 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 * PIXELS_PER_CLK; // data bus width in bytes
localparam AVF_U = 1; // TUSER width
localparam AVF_B = BYTES_PER_PIXEL * 8; // bits per pixel on TDATA
 
string avf_name = "";
string avf_type = "";
76,7 → 74,8
 
 
//--------------------------------------------------------------------
function new
function
new
(
virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_if
);
89,7 → 88,8
 
// --------------------------------------------------------------------
//
function void init
function void
init
(
input avf_config_t avf_config,
input avf_tile_config_t tile_config,
190,7 → 190,7
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 *= PIXELS_PER_CLK; // increment stride by number of outputs
x_eol = x_end - inc.x;
 
endtask: avf_calculate
230,7 → 230,7
 
wait(avf_axis_if.cb_s.tvalid);
 
for(int i = 0; i < avf.outputs_per_tile; i++)
for(int i = 0; i < PIXELS_PER_CLK; i++)
f_h.lines[l].pixel[p + i] = avf_axis_if.cb_s.tdata[i*AVF_B +: AVF_B];
 
if(p == x_eol)
271,7 → 271,7
input int p
);
 
for(int i = 0; i < avf.outputs_per_tile; i++)
for(int i = 0; i < PIXELS_PER_CLK; i++)
avf_axis_if.cb_m.tdata[i*AVF_B +: AVF_B] <= f_h.lines[l].pixel[p + i];
 
endtask: output_pixels
396,8 → 396,8
 
wait fork;
 
repeat(avf.vertical_blanking) @(avf_axis_if.cb_m);
->tx_frame_done;
repeat(avf.vertical_blanking) @(avf_axis_if.cb_m);
end
join_none
 
/qaz_libs/trunk/camera_link/sim/src/camera_link_agent_pkg.sv
0,0 → 1,102
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 camera_link_agent_pkg;
 
// --------------------------------------------------------------------
//
import fifo_bfm_pkg::*;
 
class fifo_agent_class #(W = 8);
 
fifo_bfm_class source_fifo;
fifo_bfm_class sink_fifo;
fifo_transaction_class tr_h;
fifo_transaction_class clone_h;
 
//--------------------------------------------------------------------
function
new
(
virtual fifo_write_if #(.W(W)) source,
virtual fifo_read_if #(.W(W)) sink
);
 
this.source_fifo = new(.source(source));
this.sink_fifo = new(.sink(sink));
this.tr_h = new();
 
endfunction: new
 
 
// --------------------------------------------------------------------
//
function void init;
 
source_fifo.init("source", SOURCE);
sink_fifo.init("sink", SINK);
 
endfunction: init
 
 
// --------------------------------------------------------------------
//
task automatic
start_q;
 
source_fifo.fifo_write_q();
sink_fifo.fifo_read_q();
 
endtask: start_q
 
 
// --------------------------------------------------------------------
//
task automatic
queue_random;
 
if (!tr_h.randomize())
begin
$display("^^^ %16.t | %m | ERROR! randomize error", $time);
$stop;
end
 
clone_h = tr_h.clone();
source_fifo.fifo_tr_q.put(clone_h);
sink_fifo.fifo_tr_q.put(clone_h);
 
endtask: queue_random
 
 
// --------------------------------------------------------------------
//
 
endclass: fifo_agent_class
 
endpackage: camera_link_agent_pkg
 
/qaz_libs/trunk/camera_link/sim/src/camera_link_bfm_pkg.sv
0,0 → 1,304
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 camera_link_bfm_pkg;
 
// --------------------------------------------------------------------
//
class camera_link_bfm_class #(W = 8);
 
string fifo_name;
fifo_type_t fifo_type;
 
virtual fifo_write_if #(.W(W)) source = null;
virtual fifo_read_if #(.W(W)) sink = null;
fifo_transaction_class fifo_tr = new();
 
 
//--------------------------------------------------------------------
function new
(
virtual fifo_write_if #(.W(W)) source = null,
virtual fifo_read_if #(.W(W)) sink = null
);
 
if(source != null)
this.source = source;
 
if(sink != null)
this.sink = sink;
 
endfunction: new
 
 
// --------------------------------------------------------------------
//
function void
init
(
input string fifo_name,
input fifo_type_t fifo_type
);
 
this.fifo_name = fifo_name;
this.fifo_type = fifo_type;
 
if(fifo_type == SOURCE)
source.cb_s.wr_en <= 0;
else if(fifo_type == SINK)
sink.cb_s.rd_en <= 0;
else if(fifo_type == BOTH)
if((this.source == null) | (this.sink == null))
begin
$display("^^^ %16.t | %m | ERROR! %s fifo_type == BOTH with null class", $time, fifo_type.name);
$stop;
end
else
begin
source.cb_s.wr_en <= 0;
sink.cb_s.rd_en <= 0;
end
else
begin
$display("^^^ %16.t | %m | ERROR! fifo_type %s is invalid", $time, fifo_type.name);
$stop;
end
 
$display("^^^ %16.t | %m | initialization of %s for %s", $time, fifo_name, fifo_type.name);
 
endfunction: init
 
 
// --------------------------------------------------------------------
//
task
write
(
input [W-1:0] wr_data,
input int write_delay = 0
);
 
source.cb_s.wr_data <= wr_data;
source.cb_s.wr_en <= 0;
 
source.zero_cycle_delay();
 
if(write_delay != 0)
repeat(write_delay) @(source.cb_s);
 
@(source.cb_s iff (source.cb_s.full == 0));
// @(source.cb_s iff (~source.cb_s.full));
source.cb_s.wr_en <= 1;
 
@(posedge source.clk);
source.cb_s.wr_en <= 0;
 
endtask: write
 
 
// --------------------------------------------------------------------
//
task
fork_write
(
input [W-1:0] wr_data,
input int write_delay = 0
);
 
fork
write(wr_data, write_delay);
join_none
 
#0;
 
endtask: fork_write
 
 
// --------------------------------------------------------------------
//
mailbox #(int) rd_data_q = new();
 
task
read
(
input int read_delay = 0
);
 
sink.cb_s.rd_en <= 0;
 
sink.zero_cycle_delay();
 
if(read_delay != 0)
repeat(read_delay) @(sink.cb_s);
 
@(sink.cb_s iff (sink.cb_s.empty == 0));
// @(sink.cb_s iff (~sink.cb_s.empty));
sink.cb_s.rd_en <= 1;
 
@(posedge sink.clk);
 
sink.cb_s.rd_en <= 0;
 
rd_data_q.put(sink.cb_s.rd_data);
 
endtask: read
 
 
// --------------------------------------------------------------------
//
task automatic
fork_read
(
input int read_delay = 0
);
 
fork
read(read_delay);
join_none
 
#0;
 
endtask: fork_read
 
 
// --------------------------------------------------------------------
//
mailbox #(fifo_transaction_class) fifo_tr_q;
semaphore fifo_tr_q_semaphore = new(1);
 
 
// --------------------------------------------------------------------
//
event fifo_write_done;
 
task automatic
fifo_write_q;
 
if((fifo_type != SOURCE) & (fifo_type == BOTH))
begin
$display("^^^ %16.t | %m | ERROR! wrong fifo_type |", $time);
return;
end
 
if(fifo_tr_q_semaphore.try_get() == 0)
begin
$display("^^^ %16.t | %m | ERROR! fifo_tr_q_semaphore.try_get() == 0 |", $time);
return;
end
 
$display("^^^ %16.t | %m is active |", $time);
 
this.fifo_tr_q = new();
 
fifo_write_fork : fork
forever
begin
 
fifo_tr_q.get(fifo_tr);
fork_write(fifo_tr.data, fifo_tr.write_delay);
 
wait fork;
 
->fifo_write_done;
end
join_none
 
#0;
 
endtask: fifo_write_q
 
 
// --------------------------------------------------------------------
//
fifo_transaction_class fifo_tr_clone;
event fifo_read_done;
logic [W - 1:0] rd_data;
logic [W - 1:0] rd_result;
int compare_result;
int compare_errors = 0;
 
task automatic
fifo_read_q;
 
if((fifo_type != SINK) & (fifo_type == BOTH))
begin
$display("^^^ %16.t | %m | ERROR! wrong fifo_type |", $time);
return;
end
 
 
if(fifo_tr_q_semaphore.try_get() == 0)
begin
$display("^^^ %16.t | %m | ERROR! fifo_tr_q_semaphore.try_get() == 0 |", $time);
return;
end
 
$display("^^^ %16.t | %m is active |", $time);
 
this.fifo_tr_q = new();
fifo_tr_clone = fifo_tr.clone();
 
fifo_read_q_fork : fork
forever
begin
 
fifo_tr_q.get(fifo_tr);
fork_read(fifo_tr.read_delay);
 
wait fork;
 
->fifo_read_done;
 
rd_data_q.get(rd_result);
rd_data = fifo_tr.data;
 
if(rd_result != rd_data)
begin
$display("^^^ %16.t | %m | ERROR! rd_result != fifo_tr.data |", $time);
$display("^^^ %16.t | %m | rd_result = %h |", $time, rd_result);
$display("^^^ %16.t | %m | fifo_tr.data = %h |", $time, fifo_tr.data);
end
 
// compare_result = avf_in_frame.compare(8, f_h);
// compare_errors += compare_result;
 
end
join_none
 
#0;
 
endtask: fifo_read_q
 
 
// --------------------------------------------------------------------
//
 
endclass: fifo_bfm_class
 
endpackage: camera_link_bfm_pkg
 
/qaz_libs/trunk/camera_link/sim/src/tb_channel_link_rx_if.sv
1,6 → 1,29
// --------------------------------------------------------------------
//
// --------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 ////
//// ////
//////////////////////////////////////////////////////////////////////
 
 
interface
/qaz_libs/trunk/cli/cli/sys_cli.c
36,22 → 36,29
 
 
/*-----------------------------------------------------------*/
void clear_screen(void)
{
PRINTF_MACRO("\033[H\033[J");
}
 
 
/*-----------------------------------------------------------*/
#ifdef ANSI_ESCAPE_CODE
#define ASCII_ESC '\x1b'
 
static void send_csi( char c )
static void send_csi(char c)
{
putchar( ASCII_ESC );
putchar( '[' );
putchar( c );
putchar(ASCII_ESC);
putchar('[');
putchar(c);
}
#else
static void send_csi( char c ) {};
static void send_csi(char c) {};
#endif
 
 
/*-----------------------------------------------------------*/
static char *cli_edit_buffer( char *in_buffer, char *out_buffer, unsigned int line_length )
static char *cli_edit_buffer(char *in_buffer, char *out_buffer, unsigned int line_length)
{
static char *out_ptr;
static char *begin_ptr;
64,7 → 71,7
 
unsigned int i;
 
if( out_buffer != NULL )
if(out_buffer != NULL)
{
out_ptr = out_buffer;
begin_ptr = out_buffer;
76,43 → 83,43
#endif
}
 
for( i = 0 ; i < line_length ; i++ )
for(i = 0 ; i < line_length ; i++)
{
 
if( out_ptr >= end_ptr )
if(out_ptr >= end_ptr)
{
*end_ptr = '\0';
return( NULL );
return(NULL);
}
 
if( out_ptr < begin_ptr )
sys_error_fatal( FATAL_ERROR_CLI );
if(out_ptr < begin_ptr)
sys_error_fatal(FATAL_ERROR_CLI);
 
switch( in_buffer[i] )
switch(in_buffer[i])
{
case '\0':
return( NULL );
return(NULL);
break;
 
case '\n':
*out_ptr = '\0';
return( NULL );
return(NULL);
break;
 
case '\r':
*out_ptr = '\0';
return( NULL );
return(NULL);
break;
 
case '\b':
if( out_ptr != begin_ptr )
if(out_ptr != begin_ptr)
{
send_csi( 'P' );
send_csi('P');
out_ptr--;
} else
{
putchar( ' ' );
send_csi( '\a' );
putchar(' ');
send_csi('\a');
}
break;
 
121,7 → 128,7
break;
 
case '[':
if( prev_char == ASCII_ESC )
if(prev_char == ASCII_ESC)
{
csi = 1;
} else
132,10 → 139,10
break;
 
case 'A':
if( csi )
if(csi)
{
send_csi( 'B' );
send_csi( '\a' );
send_csi('B');
send_csi('\a');
 
csi = 0;
} else
146,7 → 153,7
break;
 
case 'B':
if( csi == 0 )
if(csi == 0)
{
*out_ptr = in_buffer[i];
out_ptr++;
154,10 → 161,10
break;
 
case 'C':
if( csi )
if(csi)
{
send_csi( 'D' );
send_csi( '\a' );
send_csi('D');
send_csi('\a');
 
csi = 0;
} else
168,10 → 175,10
break;
 
case 'D':
if( csi )
if(csi)
{
send_csi( 'C' );
send_csi( '\a' );
send_csi('C');
send_csi('\a');
 
csi = 0;
} else
193,12 → 200,12
#endif
}
 
return( out_ptr );
return(out_ptr);
}
 
 
/*-----------------------------------------------------------*/
void sys_cli_task( void )
void sys_cli_task(void)
{
char last_return_value = EXIT_SUCCESS;
char in_buffer[INPUT_LINE_LENGTH + 1];
212,62 → 219,59
 
cli_init();
 
PRINTF_MACRO( "\r\n" );
PRINTF_MACRO("\r\n");
 
for( ;; )
for(;;)
{
PRINTF_MACRO( "%d > ", last_return_value );
PRINTF_MACRO("%d > ", last_return_value);
 
cli_argc = 0;
last_return_value = EXIT_SUCCESS;
 
bytes_read = (unsigned int)read( STDIN_FILENO, (void *)in_buffer, sizeof(in_buffer) );
cli_ptr = cli_edit_buffer( in_buffer, out_buffer, bytes_read );
bytes_read = (unsigned int)read(STDIN_FILENO, (void *)in_buffer, sizeof(in_buffer));
cli_ptr = cli_edit_buffer(in_buffer, out_buffer, bytes_read);
 
while( cli_ptr != NULL )
while(cli_ptr != NULL)
{
bytes_read = (unsigned int)read( STDIN_FILENO, (void *)in_buffer, sizeof(in_buffer) );
cli_ptr = cli_edit_buffer( in_buffer, NULL, bytes_read );
bytes_read = (unsigned int)read(STDIN_FILENO, (void *)in_buffer, sizeof(in_buffer));
cli_ptr = cli_edit_buffer(in_buffer, NULL, bytes_read);
}
 
if( out_buffer[0] == '\0' )
{
PRINTF_MACRO( " NULL String! Command ignored\r\n" );
if(out_buffer[0] == '\0')
last_return_value = EXIT_FAILURE;
}
 
while( last_return_value != EXIT_FAILURE )
while(last_return_value != EXIT_FAILURE)
{
cli_ptr = strtok( out_buffer, " \t" );
cli_ptr = strtok(out_buffer, " \t");
 
strncpy( cmd_to_check.cmd, out_buffer, MAX_CMD_LENGTH );
cli_cmd = cli_find_command( &cmd_to_check );
strncpy(cmd_to_check.cmd, out_buffer, MAX_CMD_LENGTH);
cli_cmd = cli_find_command(&cmd_to_check);
 
if ( cli_cmd == NULL )
if (cli_cmd == NULL)
{
PRINTF_MACRO( "\r\n Command not found!\r\n" );
PRINTF_MACRO("\r\n Command not found!\r\n");
last_return_value = EXIT_FAILURE;
break;
}
 
if( cli_ptr == NULL )
if(cli_ptr == NULL)
{
cli_argv[cli_argc] = out_buffer;
cli_argc++;
} else
{
while( cli_ptr != NULL )
while(cli_ptr != NULL)
{
cli_argv[cli_argc] = cli_ptr;
cli_argc++;
 
cli_ptr = strtok( NULL, " \t" );
cli_ptr = strtok(NULL, " \t");
}
}
 
PRINTF_MACRO( "\r\n" );
PRINTF_MACRO("\r\n");
 
last_return_value = cli_cmd->func( cli_argc, (const char **)cli_argv );
last_return_value = cli_cmd->func(cli_argc, (const char **)cli_argv);
break;
}
 
/qaz_libs/trunk/cli/cli/sys_cmd.c
37,9 → 37,9
void cli_init( void )
{
int i;
 
for(i = 0; cli_commands[i].func != NULL; i++);
 
cli_no_of_commands = i;
}
 
58,7 → 58,7
cli_cmd_tab_t *cli_find_command( cli_cmd_tab_t *cmd_to_check )
{
struct cli_cmd_tab_t *cli_cmd;
 
cli_cmd = (struct cli_cmd_tab_t *) bsearch( cmd_to_check, cli_commands, cli_no_of_commands, sizeof(struct cli_cmd_tab_t), cmd_cmp );
 
return(cli_cmd);
82,6 → 82,14
 
 
/*-----------------------------------------------------------*/
static char func_comment( const unsigned char argc, const char *argv[] )
{
PRINTF_MACRO( "# > ");
return EXIT_SUCCESS;
}
 
 
/*-----------------------------------------------------------*/
static char func_peek( const unsigned char argc, const char *argv[] )
{
volatile unsigned int *address = (volatile unsigned int *)( strtoul( argv[1], (char **)NULL, 16 ) );
/qaz_libs/trunk/cli/cli/sys_cmd_table.h
39,13 → 39,13
struct cli_cmd_tab_t cli_commands[] =
{
{ "help", func_help, " help ~ print help message\r" },
{ "md", func_md, " md [.b, .w, .l] address [# of objects] ~ memory display\r" },
{ "md.b", func_md, " md.w [.b, .w, .l] address [# of objects] ~ memory display\r" },
{ "md.w", func_md, " md.w [.b, .w, .l] address [# of objects] ~ memory display\r" },
{ "md", func_md, " md address [# of objects] ~ memory display\r" },
{ "md.b", func_md, " md.b address [# of objects] ~ memory display\r" },
{ "md.w", func_md, " md.w address [# of objects] ~ memory display\r" },
{ "memtest", func_memtest, " memtest base_address size\r" },
{ "mw", func_mw, " mw [.b, .w, .l] address value [count] ~ memory write (fill)\r" },
{ "mw.b", func_mw, " mw.w [.b, .w, .l] address value [count] ~ memory write (fill)\r" },
{ "mw.w", func_mw, " mw.w [.b, .w, .l] address value [count] ~ memory write (fill)\r" },
{ "mw", func_mw, " mw address value [count] ~ memory write (fill)\r" },
{ "mw.b", func_mw, " mw.b address value [count] ~ memory write (fill)\r" },
{ "mw.w", func_mw, " mw.w address value [count] ~ memory write (fill)\r" },
{ "peek", func_peek, " peek address\r" },
{ "poke", func_poke, " poke address value\r" },
{ "~", NULL, NULL }
/qaz_libs/trunk/misc/src/pulse_stretcher.v
34,8 → 34,6
(
input in,
output out,
input reset,
input clock
);
/qaz_libs/trunk/synchronize/src/sync_reset.v
25,35 → 25,29
//// ////
//////////////////////////////////////////////////////////////////////
 
 
module
sync_reset
#(
parameter STAGES = 8
)
parameter ASSERT_LENGTH = 8
)
(
input async_reset, // active high reset
output synced_reset,
input clock
input clk_in,
input async_reset_in,
output sync_reset_out
);
 
 
// --------------------------------------------------------------------
//
reg [STAGES-1:0] reset_r;
always @(posedge clock)
if(async_reset)
reset_r <= {STAGES{1'b1}};
reg [(ASSERT_LENGTH-1):0] sync_reset_out_r;
assign sync_reset_out = sync_reset_out_r[ASSERT_LENGTH-1];
 
always @(posedge clk_in)
if(async_reset_in)
sync_reset_out_r <= {ASSERT_LENGTH{1'b1}};
else
reset_r <= {1'b0, reset_r[STAGES-1:1]};
sync_reset_out_r <= {sync_reset_out_r[(ASSERT_LENGTH-2):0], 1'b0};
 
 
// --------------------------------------------------------------------
//
assign synced_reset = reset_r[0];
endmodule
 
 
/qaz_libs/trunk/tb_class/sim/libs/packages_verilog/tb_lib.f
0,0 → 1,7
#
 
${ROOT_DIR}/qaz_libs/tb_class/src/tb_bfm_pkg.sv
 
 
 
 
/qaz_libs/trunk/tb_class/sim/libs/sim_verilog/tb_lib.f
0,0 → 1,16
#
 
-mfcu
 
${ROOT_DIR}/qaz_libs/tb_class/src/tb_clk_class.sv
 
${ROOT_DIR}/qaz_libs/tb_class/src/tb_clk.sv
${ROOT_DIR}/qaz_libs/tb_class/src/tb_base.sv
 
 
 
 
 
 
 
 
/qaz_libs/trunk/tb_class/src/tb_bfm_pkg.sv
0,0 → 1,230
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 tb_bfm_pkg;
 
// --------------------------------------------------------------------
//
class tb_nonblocking_transaction_q_class #(parameter type T = logic);
 
T tr_h;
mailbox #(T) q;
semaphore q_semaphore;
 
//--------------------------------------------------------------------
function new;
 
this.q = new();
this.q_semaphore = new(1);
 
endfunction: new
 
 
// --------------------------------------------------------------------
//
event start;
event done;
 
virtual task automatic
transaction
(
ref T tr_h
);
 
->start;
 
$display("^^^ %16.t | %m | ERROR! Task not defined |", $time);
 
->done;
 
endtask: transaction
 
 
// --------------------------------------------------------------------
//
virtual task automatic
idle;
 
$display("^^^ %16.t | %m | ERROR! Task not defined |", $time);
 
endtask: idle
 
 
// --------------------------------------------------------------------
//
task
put
(
ref T tr_h
);
 
$display("^^^ %16.t | %m | ", $time);
 
q.put(tr_h);
 
endtask: put
 
 
// --------------------------------------------------------------------
//
task automatic
run_q;
 
if(q_semaphore.try_get() == 0)
begin
$display("^^^ %16.t | %m | ERROR! Aready active |", $time);
return;
end
 
$display("^^^ %16.t | %m is active |", $time);
 
run_q_fork : fork
forever
if(q.try_get(tr_h) != 0)
transaction(tr_h);
else
idle();
join_none
 
#0;
 
endtask: run_q
 
 
// --------------------------------------------------------------------
//
function void
init;
 
fork
run_q();
join_none
 
$display("^^^ %16.t | %m | initialization", $time);
 
endfunction: init
 
endclass: tb_nonblocking_transaction_q_class
 
 
// --------------------------------------------------------------------
//
class tb_blocking_transaction_q_class #(parameter type T = logic);
 
T tr_h;
mailbox #(T) q;
semaphore q_semaphore;
 
//--------------------------------------------------------------------
function new;
 
this.q = new();
this.q_semaphore = new(1);
 
endfunction: new
 
 
// --------------------------------------------------------------------
//
event start;
event done;
 
virtual task automatic
transaction
(
ref T tr_h
);
 
->start;
 
$display("^^^ %16.t | %m | ERROR! Task not defined |", $time);
 
->done;
 
endtask: transaction
 
 
// --------------------------------------------------------------------
//
task
put
(
ref T tr_h
);
 
q.put(tr_h);
 
endtask: put
 
 
// --------------------------------------------------------------------
//
task automatic
run_q;
 
if(q_semaphore.try_get() == 0)
begin
$display("^^^ %16.t | %m | ERROR! Aready active |", $time);
return;
end
 
$display("^^^ %16.t | %m is active |", $time);
 
this.q = new();
 
run_q_fork : fork
forever
begin
q.get(tr_h);
transaction(tr_h);
end
join_none
 
#0;
 
endtask: run_q
 
 
// --------------------------------------------------------------------
//
function void
init;
 
fork
run_q();
join_none
 
$display("^^^ %16.t | %m | initialization", $time);
 
endfunction: init
 
endclass: tb_blocking_transaction_q_class
 
 
endpackage: tb_bfm_pkg
 
/qaz_libs/trunk/video_frame_class/src/video_frame_pkg.sv
135,14 → 135,26
(
input int max_mismatches,
ref video_frame_class to
);
);
 
extern virtual function video_frame_class catenate_horizontally
(
ref video_frame_class tail
);
 
extern virtual function int compare_line
(
input int line,
input int max_mismatches,
ref video_frame_class to
);
 
extern virtual function void print_line
(
input int line,
input int pixel,
input int count
);
);
 
extern virtual function void print_config();
 
168,7 → 180,7
function int video_frame_class::read_pixel
(
input frame_coordinate_t coordinate
);
);
 
read_pixel = this.lines[coordinate.y].pixel[coordinate.x];
 
180,7 → 192,7
function void video_frame_class::make_constant
(
input int pixel
);
);
 
$display("^^^ %16.t | %m", $time);
 
310,11 → 322,11
this.lines_per_frame = from.lines_per_frame;
this.bits_per_pixel = from.bits_per_pixel;
this.name = from.name;
this.lines = new[lines_per_frame];
this.lines = new[this.lines_per_frame];
 
foreach(this.lines[l])
begin
this.lines[l].pixel = new[pixels_per_line];
this.lines[l].pixel = new[this.pixels_per_line];
 
foreach(this.lines[l].pixel[p])
this.lines[l].pixel[p] = from.lines[l].pixel[p];
336,6 → 348,81
 
// --------------------------------------------------------------------
//
function video_frame_class video_frame_class::catenate_horizontally
(
ref video_frame_class tail
);
 
$display("^^^ %16.t | %m", $time);
 
if(this.lines_per_frame != tail.lines_per_frame)
return(null);
 
if(this.bits_per_pixel != tail.bits_per_pixel)
return(null);
 
catenate_horizontally = new();
 
catenate_horizontally.pixels_per_line = this.pixels_per_line + tail.pixels_per_line;
catenate_horizontally.lines_per_frame = this.lines_per_frame;
catenate_horizontally.bits_per_pixel = this.bits_per_pixel;
catenate_horizontally.name = this.name;
catenate_horizontally.lines = new[catenate_horizontally.lines_per_frame];
 
foreach(catenate_horizontally.lines[l])
begin
catenate_horizontally.lines[l].pixel = new[catenate_horizontally.pixels_per_line];
 
foreach(this.lines[l].pixel[p])
catenate_horizontally.lines[l].pixel[p] = this.lines[l].pixel[p];
 
foreach(tail.lines[l].pixel[p])
catenate_horizontally.lines[l].pixel[p + this.pixels_per_line] = tail.lines[l].pixel[p];
 
end
 
endfunction: catenate_horizontally
 
 
// --------------------------------------------------------------------
//
function int video_frame_class::compare_line
(
input int line,
input int max_mismatches,
ref video_frame_class to
);
 
int mismatch_count = 0;
 
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);
end
 
foreach(this.lines[line].pixel[p])
if(to.lines[line].pixel[p] != this.lines[line].pixel[p])
begin
 
if(max_mismatches > 0)
mismatch_count++;
 
$display("^^^ %16.t | ERROR! mismatch @ frame[%4h][%4h] | to == %4h | this == %4h | %s",
$time, line, p, to.lines[line].pixel[p], this.lines[line].pixel[p], name);
 
if(mismatch_count > max_mismatches)
return(mismatch_count);
 
end
 
return(mismatch_count);
 
endfunction: compare_line
 
 
// --------------------------------------------------------------------
//
function int video_frame_class::compare
(
input int max_mismatches,
qaz_libs/trunk Property changes : Modified: svn:global-ignores ## -1 +1,2 ## __tmp +IMC Modified: svn:ignore ## -1 +1,2 ## uvm_guide_for_beginners +.hgignore

powered by: WebSVN 2.1.0

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