URL
https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk
Subversion Repositories qaz_libs
Compare Revisions
- This comparison shows the changes necessary to convert path
/qaz_libs/trunk/BFM/sim/tests
- from Rev 44 to Rev 45
- ↔ Reverse comparison
Rev 44 → Rev 45
/tb_axis_video_frame/dut.sv
0,0 → 1,43
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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 |
dut |
#( |
N, // data bus width in bytes |
I = 1, // TID width |
D = 1, // TDEST width |
U = 1 // TUSER width |
) |
( |
axis_if axis_in |
); |
|
//--------------------------------------------------- |
endmodule |
|
/tb_axis_video_frame/init_test.do
0,0 → 1,30
# ------------------------------------ |
# |
# ------------------------------------ |
|
global env |
|
# setup environment |
do ../../../../scripts/sim_env.do |
set env(SIM_TARGET) fpga |
|
radix -hexadecimal |
|
make_lib work 1 |
|
sim_compile_lib $env(LIB_BASE_DIR) tb_packages |
sim_compile_lib $env(LIB_BASE_DIR) bfm_packages |
sim_compile_lib $env(LIB_BASE_DIR) axi4_lib |
sim_compile_lib $env(LIB_BASE_DIR) sim |
|
# compile simulation files |
vlog -f ./tb_pkg_files.f |
vlog -f ./tb_files.f |
|
# |
# vlog -f ./files.f |
|
# run the sim |
sim_run_test |
|
|
/tb_axis_video_frame/s_debug.svh
0,0 → 1,43
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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 //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
class s_debug extends s_avf_base; |
`uvm_object_utils(s_debug) |
|
// -------------------------------------------------------------------- |
task body(); |
avf_api_h.put_frame("counting"); |
avf_api_h.put_frame("constant", 16'habba); |
avf_api_h.put_frame("horizontal"); |
avf_api_h.put_frame("vertical"); |
avf_api_h.put_frame("random"); |
|
avf_api_h.send_frame_buffer(m_sequencer, this); |
endtask: body |
|
// -------------------------------------------------------------------- |
endclass : s_debug |
/tb_axis_video_frame/sim.do
0,0 → 1,10
# |
# |
|
quit -sim |
|
vsim -suppress 12110 -novopt work.tb_top |
# vsim -f ./sim.f work.tb_top |
|
# log all signals |
log /* -r |
/tb_axis_video_frame/t_debug.svh
0,0 → 1,68
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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 //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
class t_debug extends t_top_base; |
`uvm_component_utils(t_debug) |
|
// -------------------------------------------------------------------- |
function new(string name = "t_debug", uvm_component parent); |
super.new(name, parent); |
endfunction |
|
// -------------------------------------------------------------------- |
function void end_of_elaboration_phase(uvm_phase phase); |
uvm_phase run_phase = uvm_run_phase::get(); |
run_phase.phase_done.set_drain_time(this, 100ns); |
endfunction |
|
// -------------------------------------------------------------------- |
function void final_phase(uvm_phase phase); |
super.final_phase(phase); |
$display("^^^ %16.t | %m | Test Done!!!", $time); |
$stop; |
endfunction : final_phase |
|
// -------------------------------------------------------------------- |
virtual task run_phase(uvm_phase phase); |
s_debug seq = s_debug::type_id::create("seq"); |
s_avf_slave_base s_seq = s_avf_slave_base::type_id::create("s_seq"); |
s_seq.sequencer_h = env_h.s_agent_h.sequencer_h; |
fork |
s_seq.start(env_h.s_agent_h.sequencer_h); |
join_none |
seq.init( env_h.cfg_h.m_cfg_h.pixels_per_line |
, env_h.cfg_h.m_cfg_h.lines_per_frame |
, env_h.cfg_h.m_cfg_h.bits_per_pixel |
, env_h.cfg_h.m_cfg_h.pixels_per_clk |
); |
phase.raise_objection(this); |
seq.start(env_h.m_agent_h.sequencer_h); |
phase.drop_objection(this); |
endtask : run_phase |
|
// -------------------------------------------------------------------- |
endclass : t_debug |
/tb_axis_video_frame/t_top_base.svh
0,0 → 1,43
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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 //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
virtual class t_top_base extends uvm_test; |
`uvm_component_utils(t_top_base); |
tb_env env_h; |
|
// -------------------------------------------------------------------- |
function new (string name, uvm_component parent); |
super.new(name,parent); |
endfunction : new |
|
// -------------------------------------------------------------------- |
function void build_phase(uvm_phase phase); |
env_h = tb_env::type_id::create("env_h",this); |
endfunction : build_phase |
|
// -------------------------------------------------------------------- |
endclass : t_top_base |
/tb_axis_video_frame/tb_axis_video_frame_pkg.sv
0,0 → 1,49
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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_axis_video_frame_pkg; |
import uvm_pkg::*; |
`include "uvm_macros.svh" |
import avf_pkg::*; |
|
// -------------------------------------------------------------------- |
localparam AVF_B = 2; // BYTES_PER_PIXEL |
localparam AVF_T = 4; // pixels per clock |
localparam AVF_AW = 32; // active width |
localparam AVF_AH = 16; // active height |
localparam AVF_N = AVF_B * AVF_T; |
localparam AVF_U = 3; |
|
// -------------------------------------------------------------------- |
`include "tb_dut_config.svh" |
`include "tb_env.svh" |
`include "s_debug.svh" |
`include "t_top_base.svh" |
`include "t_debug.svh" |
|
// -------------------------------------------------------------------- |
endpackage : tb_axis_video_frame_pkg |
/tb_axis_video_frame/tb_dut_config.svh
0,0 → 1,58
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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 //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
class tb_dut_config #(N, U); |
|
avf_config #(N, U) m_cfg_h; // master |
avf_config #(N, U) s_cfg_h; // slave |
|
// -------------------------------------------------------------------- |
// |
function void init |
( int pixels_per_line |
, int lines_per_frame |
, int bits_per_pixel |
); |
m_cfg_h.init( pixels_per_line |
, lines_per_frame |
, bits_per_pixel |
); |
s_cfg_h.init( pixels_per_line |
, lines_per_frame |
, bits_per_pixel |
); |
endfunction: init |
|
|
// -------------------------------------------------------------------- |
function new(virtual axis_if #(.N(N), .U(U)) vif); |
m_cfg_h = new(vif, UVM_ACTIVE); |
s_cfg_h = new(vif, UVM_ACTIVE); |
endfunction : new |
|
// -------------------------------------------------------------------- |
endclass : tb_dut_config |
/tb_axis_video_frame/tb_env.svh
0,0 → 1,65
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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 //// |
//// //// |
////////////////////////////////////////////////////////////////////// |
|
class tb_env extends uvm_env; |
`uvm_component_utils(tb_env); |
|
// -------------------------------------------------------------------- |
tb_dut_config #(AVF_N, AVF_U) cfg_h; |
// coverage coverage_h; |
avf_scoreboard scoreboard_h; |
avf_master_agent #(AVF_N, AVF_U) m_agent_h; |
avf_slave_agent #(AVF_N, AVF_U) s_agent_h; |
|
// -------------------------------------------------------------------- |
function new (string name, uvm_component parent); |
super.new(name,parent); |
endfunction : new |
|
// -------------------------------------------------------------------- |
function void build_phase(uvm_phase phase); |
if (!uvm_config_db #(tb_dut_config #(AVF_N, AVF_U))::get(this, "", "tb_dut_config", cfg_h)) |
`uvm_fatal(get_name(), "Couldn't get config object!") |
|
m_agent_h = avf_master_agent #(AVF_N, AVF_U)::type_id::create("m_agent_h", this); |
m_agent_h.cfg_h = cfg_h.m_cfg_h; |
m_agent_h.is_active = cfg_h.m_cfg_h.get_is_active(); |
|
s_agent_h = avf_slave_agent #(AVF_N, AVF_U)::type_id::create("s_agent_h", this); |
s_agent_h.cfg_h = cfg_h.s_cfg_h; |
s_agent_h.is_active = cfg_h.s_cfg_h.get_is_active(); |
|
scoreboard_h = avf_scoreboard::type_id::create("scoreboard_h", this); |
endfunction : build_phase |
|
// -------------------------------------------------------------------- |
function void connect_phase(uvm_phase phase); |
s_agent_h.monitor_h.ap.connect(scoreboard_h.analysis_export); |
endfunction : connect_phase |
|
// -------------------------------------------------------------------- |
endclass : tb_env |
/tb_axis_video_frame/tb_files.f
0,0 → 1,6
# |
|
./tb_axis_video_frame_pkg.sv |
|
./dut.sv |
./tb_top.sv |
/tb_axis_video_frame/tb_pkg_files.f
0,0 → 1,4
# |
|
# +incdir+${LIB_BASE_DIR}/BFM/src/axis_video_frame |
${LIB_BASE_DIR}/BFM/src/axis_video_frame/avf_pkg.sv |
/tb_axis_video_frame/tb_top.sv
0,0 → 1,69
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2018 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; |
import uvm_pkg::*; |
import tb_axis_video_frame_pkg::*; |
`include "uvm_macros.svh" |
|
// -------------------------------------------------------------------- |
wire clk_100mhz; |
wire tb_clk = clk_100mhz; |
wire tb_rst; |
|
tb_base #(.PERIOD(10_000)) tb(clk_100mhz, tb_rst); |
|
// -------------------------------------------------------------------- |
wire clk = clk_100mhz; |
wire reset = tb_rst; |
wire aclk = clk; |
wire aresetn = ~reset; |
|
// -------------------------------------------------------------------- |
axis_if #(.N(AVF_N), .U(AVF_U)) dut_if(.*); |
|
// -------------------------------------------------------------------- |
dut #(.N(AVF_N), .U(AVF_U)) dut(dut_if); |
|
// -------------------------------------------------------------------- |
bind dut axis_checker #(.N(N), .U(U)) dut_b(.*); |
|
// -------------------------------------------------------------------- |
tb_dut_config #(AVF_N, AVF_U) cfg_h = new(dut_if); |
|
initial |
begin |
cfg_h.init( .pixels_per_line(AVF_AW) |
, .lines_per_frame(AVF_AH) |
, .bits_per_pixel(AVF_B * 8) |
); |
uvm_config_db #(tb_dut_config #(AVF_N, AVF_U))::set(null, "*", "tb_dut_config", cfg_h); |
run_test("t_debug"); |
end |
|
// -------------------------------------------------------------------- |
endmodule |
/tb_axis_video_frame/wip.do
0,0 → 1,6
# |
|
# compile test bench files |
vlog -f ./tb_files.f |
# vlog -f ./files.f |
|
/tb_video_frame_dpi/count.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/tb_video_frame_dpi/py_dpi.c
90,7 → 90,6
|
char pre_string[] = "exec(open('./"; |
char post_string[] = "').read())"; |
char v_filename[] = "try_it.py"; |
unsigned int size = (sizeof(pre_string) + sizeof(post_string)) * sizeof(char); |
size += strlen(filename); |
char *run_string = (char *)malloc(size); |
/tb_video_frame_dpi/view_raw.py
0,0 → 1,42
# |
|
import os |
import numpy as np |
import matplotlib.pyplot as plt |
|
fname = 'count.raw' |
number_of_frames = 4 |
width = 32 |
height = 32 |
# dtype='uint16' |
dtype=np.dtype('uint16') |
|
data = np.arange(number_of_frames*width*height, dtype=dtype) |
# data = np.ones((number_of_frames, width, height), dtype=dtype) |
# data = np.zeros((number_of_frames, width, height), dtype=dtype) |
# data *= 32 |
|
with open(fname, 'w+') as infile: |
data.tofile(infile, format=dtype.str) |
|
infile.close() |
|
statinfo = os.stat(fname) |
print(statinfo.st_size, ': file size') |
print(statinfo.st_size / (width * height * dtype.itemsize), ': frames') |
print(dtype.itemsize, ': itemsize') |
|
|
# with open(fname, 'r') as infile: |
# data = np.fromfile(infile, dtype=dtype).reshape(number_of_frames, width, height) |
|
data = np.memmap(fname, dtype=dtype, mode='r', shape=(number_of_frames, width, height)) |
|
for i in range(number_of_frames): |
print('Frame #', i) |
fig, ax = plt.subplots() |
im = ax.imshow(data[i], cmap='gray') |
ax.set(xticks=[], yticks=[]) |
fig.colorbar(im) |
plt.show() |
|