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/PCIe/sim/src
- from Rev 39 to Rev 50
- ↔ Reverse comparison
Rev 39 → Rev 50
/RIFFA/riffa_agent.svh
0,0 → 1,65
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_agent #(N) extends uvm_agent; |
`uvm_component_param_utils(riffa_agent #(N)) |
|
// -------------------------------------------------------------------- |
virtual riffa_chnl_if #(N) vif; |
riffa_rp_tx_driver #(N) rp_tx_driver_h; |
riffa_rp_rx_driver #(N) rp_rx_driver_h; |
riffa_rp_tx_sequencer rp_tx_sequencer_h; |
riffa_rp_rx_sequencer rp_rx_sequencer_h; |
// fifo_monitor monitor_h; |
|
// -------------------------------------------------------------------- |
virtual function void build_phase(uvm_phase phase); |
super.build_phase(phase); |
rp_tx_driver_h = riffa_rp_tx_driver #(N)::type_id::create("rp_tx_driver_h", this); |
rp_rx_driver_h = riffa_rp_rx_driver #(N)::type_id::create("rp_rx_driver_h", this); |
rp_tx_sequencer_h = riffa_rp_tx_sequencer::type_id::create("rp_tx_sequencer_h", this); |
rp_rx_sequencer_h = riffa_rp_rx_sequencer::type_id::create("rp_rx_sequencer_h", this); |
// monitor_h = fifo_monitor ::type_id::create("monitor_h", this); |
endfunction |
|
// -------------------------------------------------------------------- |
virtual function void connect_phase(uvm_phase phase); |
super.connect_phase(phase); |
rp_tx_driver_h.vif = vif; |
rp_rx_driver_h.vif = vif; |
// monitor_h.vif = vif; |
rp_tx_driver_h.seq_item_port.connect(rp_tx_sequencer_h.seq_item_export); |
rp_rx_driver_h.seq_item_port.connect(rp_rx_sequencer_h.seq_item_export); |
endfunction |
|
// -------------------------------------------------------------------- |
function new(string name, uvm_component parent); |
super.new(name, parent); |
endfunction |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/riffa_config.svh
0,0 → 1,49
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_config #(N); |
|
virtual riffa_chnl_if #(N) vif; |
|
// -------------------------------------------------------------------- |
uvm_active_passive_enum is_active; |
|
function uvm_active_passive_enum get_is_active(); |
return is_active; |
endfunction : get_is_active |
|
// -------------------------------------------------------------------- |
function new |
( virtual riffa_chnl_if #(N) vif |
, uvm_active_passive_enum is_active = UVM_ACTIVE |
); |
this.vif = vif; |
this.is_active = is_active; |
endfunction : new |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/riffa_env.svh
0,0 → 1,54
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_env #(N) extends uvm_env; |
`uvm_component_param_utils(riffa_env #(N)); |
|
// -------------------------------------------------------------------- |
riffa_config #(N) cfg_h; |
// riffa_scoreboard scoreboard_h; |
riffa_agent #(N) agent_h; |
|
// -------------------------------------------------------------------- |
function new (string name, uvm_component parent); |
super.new(name,parent); |
endfunction : new |
|
// -------------------------------------------------------------------- |
function void build_phase(uvm_phase phase); |
agent_h = riffa_agent #(N)::type_id::create("agent_h", this); |
agent_h.vif = cfg_h.vif; |
// scoreboard_h = riffa_scoreboard::type_id::create("scoreboard_h", this); |
endfunction : build_phase |
|
// // -------------------------------------------------------------------- |
// function void connect_phase(uvm_phase phase); |
// agent_h.monitor_h.ap.connect(scoreboard_h.analysis_export); |
// endfunction : connect_phase |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/riffa_pkg.sv
0,0 → 1,50
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_pkg; |
import uvm_pkg::*; |
`include "uvm_macros.svh" |
|
// -------------------------------------------------------------------- |
typedef enum { RIFFA_TX_PAYLOAD // PCIe root RX from RIFFA |
, RIFFA_RX_PAYLOAD // PCIe root TX to RIFFA |
} riffa_transaction_t; |
|
// -------------------------------------------------------------------- |
`include "riffa_config.svh" |
`include "riffa_sequence_item.svh" |
typedef uvm_sequencer #(riffa_sequence_item) riffa_rp_tx_sequencer; |
typedef uvm_sequencer #(riffa_sequence_item) riffa_rp_rx_sequencer; |
`include "riffa_rp_tx_driver.svh" |
`include "riffa_rp_rx_driver.svh" |
`include "riffa_agent.svh" |
`include "riffa_env.svh" |
`include "s_riffa_rp_tx_api.svh" |
`include "s_riffa_rp_rx_api.svh" |
|
// -------------------------------------------------------------------- |
endpackage |
/RIFFA/riffa_rp_rx_driver.svh
0,0 → 1,86
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_rp_rx_driver #(N) extends uvm_driver #(riffa_sequence_item); |
`uvm_component_param_utils(riffa_rp_rx_driver #(N)) |
|
// -------------------------------------------------------------------- |
virtual riffa_chnl_if #(N) vif; |
|
//-------------------------------------------------------------------- |
function void set_default; |
vif.cb_rp_rx.tx_ack <= 0; |
vif.cb_rp_rx.tx_data_ren <= 0; |
endfunction: set_default |
|
//-------------------------------------------------------------------- |
virtual task run_phase(uvm_phase phase); |
riffa_sequence_item item; |
super.run_phase(phase); |
|
set_default(); |
|
forever |
begin |
wait(~vif.tx_reset); |
seq_item_port.get_next_item(item); |
|
@(vif.cb_rp_rx iff vif.cb_rp_rx.tx); |
|
item.init( N |
, vif.cb_rp_rx.tx_len |
, vif.cb_rp_rx.tx_off |
, vif.cb_rp_rx.tx_last); |
|
vif.cb_rp_rx.tx_ack <= 1; |
vif.cb_rp_rx.tx_data_ren <= 1; |
|
fork |
@(vif.cb_rp_rx) |
vif.cb_rp_rx.tx_ack <= 0; |
join_none |
|
for(int i = 0; i < item.beats; i++) |
begin |
@(vif.cb_rp_rx iff vif.cb_rp_rx.tx_data_valid) |
{<<byte{item.data[i*N +: N]}} = vif.cb_rp_rx.tx_data; |
|
// $display("^^^^^ %16.t | TX | %d | %h", $time, i, vif.cb_rp_rx.tx_data); |
end |
|
set_default(); |
seq_item_port.item_done(); |
end |
endtask : run_phase |
|
//-------------------------------------------------------------------- |
function new(string name, uvm_component parent); |
super.new(name, parent); |
endfunction |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/riffa_rp_tx_driver.svh
0,0 → 1,85
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_rp_tx_driver #(N) extends uvm_driver #(riffa_sequence_item); |
`uvm_component_param_utils(riffa_rp_tx_driver #(N)) |
|
// -------------------------------------------------------------------- |
virtual riffa_chnl_if #(N) vif; |
|
//-------------------------------------------------------------------- |
function void set_default; |
vif.cb_rp_tx.rx <= 0; |
vif.cb_rp_tx.rx_last <= 'bx; |
vif.cb_rp_tx.rx_len <= 'bx; |
vif.cb_rp_tx.rx_off <= 'bx; |
vif.cb_rp_tx.rx_data <= 'bx; |
vif.cb_rp_tx.rx_data_valid <= 0; |
endfunction: set_default |
|
//-------------------------------------------------------------------- |
virtual task run_phase(uvm_phase phase); |
riffa_sequence_item item; |
reg [(8*N)-1:0] rx_data; |
super.run_phase(phase); |
|
set_default(); |
|
forever |
begin |
wait(~vif.rx_reset); |
seq_item_port.get_next_item(item); |
|
@(vif.cb_rp_tx); |
vif.cb_rp_tx.rx_len <= item.len; // must be => 4 |
vif.cb_rp_tx.rx_off <= item.off; |
vif.cb_rp_tx.rx_last <= item.last; |
vif.cb_rp_tx.rx <= 1; |
|
@(vif.cb_rp_tx iff vif.cb_rp_tx.rx_ack); |
vif.cb_rp_tx.rx_data_valid <= 1; |
|
for(int i = 0; i < item.beats; i++) |
begin |
{<<byte{rx_data}} = item.data[i*N +: N]; |
vif.cb_rp_tx.rx_data <= rx_data; |
@(vif.cb_rp_tx iff vif.cb_rp_tx.rx_data_ren); |
// $display("^^^^^ %16.t | RX | %d | %h", $time, i, vif.cb_rp_tx.rx_data); |
end |
|
set_default(); |
seq_item_port.item_done(); |
end |
endtask : run_phase |
|
//-------------------------------------------------------------------- |
function new(string name, uvm_component parent); |
super.new(name, parent); |
endfunction |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/riffa_sequence_item.svh
0,0 → 1,118
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 riffa_sequence_item extends uvm_sequence_item; |
`uvm_object_utils(riffa_sequence_item) |
|
// -------------------------------------------------------------------- |
riffa_transaction_t tr; |
int dwidth; |
bit [31:0] len; // length in 4 byte words |
bit [30:0] off; |
bit last; |
byte data[]; |
int beats; |
|
// -------------------------------------------------------------------- |
int size; |
int index = 0; |
|
// -------------------------------------------------------------------- |
function void init(int dwidth, bit [31:0] len, bit [30:0] off, bit last); |
this.dwidth = dwidth; |
this.len = len; |
this.size = len * 4; |
this.data = new[size]; |
this.beats = ((size % dwidth) == 0) ? (size / dwidth) : (size / dwidth) + 1; |
endfunction : init |
|
// // -------------------------------------------------------------------- |
// function bit do_compare(uvm_object rhs, uvm_comparer comparer); |
// riffa_sequence_item tested; |
// bit same; |
|
// if (rhs==null) |
// `uvm_fatal(get_type_name(), "| %m | comparison to a null pointer"); |
|
// if (!$cast(tested,rhs)) |
// same = 0; |
// else |
// same = super.do_compare(rhs, comparer); |
|
// return same; |
// endfunction : do_compare |
|
// -------------------------------------------------------------------- |
function void do_copy(uvm_object rhs); |
riffa_sequence_item item; |
assert(rhs != null) else |
`uvm_fatal(get_type_name(), "| %m | copy null transaction"); |
super.do_copy(rhs); |
assert($cast(item,rhs)) else |
`uvm_fatal(get_type_name(), "| %m | failed cast"); |
|
tr = item.tr ; |
dwidth = item.dwidth; |
len = item.len ; |
off = item.off ; |
last = item.last ; |
data = item.data ; |
beats = item.beats ; |
size = item.size ; |
index = item.index ; |
endfunction : do_copy |
|
// // -------------------------------------------------------------------- |
// function string convert2string(); |
// string s0, s1, s2, s3; |
// s0 = $sformatf( "| %m | wr | rd | full | empty |\n"); |
// s1 = $sformatf( "| %m | %1h | %1h | %1h | %1h |\n" |
// , (command == FIFO_WR) || (command == FIFO_BOTH) |
// , (command == FIFO_RD) || (command == FIFO_BOTH) |
// , wr_full |
// , rd_empty |
// ); |
// s2 = $sformatf("| %m | wr_data: %h\n" , wr_data); |
// s3 = $sformatf("| %m | rd_data: %h\n" , rd_data); |
|
// if(command == FIFO_NULL) |
// return {s1, s0}; |
// else if(command == FIFO_BOTH) |
// return {s3, s2, s1, s0}; |
// else if(command == FIFO_WR) |
// return {s2, s1, s0}; |
// else if(command == FIFO_RD) |
// return {s3, s1, s0}; |
// endfunction : convert2string |
|
// -------------------------------------------------------------------- |
function new(string name = ""); |
super.new(name); |
endfunction : new |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/s_riffa_rp_rx_api.svh
0,0 → 1,50
// -------------------------------------------------------------------- |
class s_riffa_rp_rx_api extends uvm_sequence #(riffa_sequence_item); |
`uvm_object_utils(s_riffa_rp_rx_api) |
|
// -------------------------------------------------------------------- |
riffa_sequence_item item; |
int dwidth; |
// mailbox #(riffa_sequence_item) q; |
|
// -------------------------------------------------------------------- |
uvm_sequencer_base o_seqr; |
uvm_sequence_base o_parent; |
|
function void init(uvm_sequencer_base o_seqr, uvm_sequence_base o_parent, int dwidth); |
this.o_seqr = o_seqr; |
this.o_parent = o_parent; |
this.dwidth = dwidth; |
endfunction : init |
|
// -------------------------------------------------------------------- |
task display(bit [31:0] len, bit [30:0] off, bit last=1); |
item = riffa_sequence_item::type_id::create("riffa_sequence_item"); |
item.tr = RIFFA_TX_PAYLOAD; |
this.start(o_seqr, o_parent); |
|
foreach(item.data[i]) |
$display("##### %d | 0x%h", i, item.data[i]); |
endtask |
|
// -------------------------------------------------------------------- |
task get(bit [31:0] len, bit [30:0] off, bit last=1); |
item = riffa_sequence_item::type_id::create("riffa_sequence_item"); |
item.tr = RIFFA_TX_PAYLOAD; |
this.start(o_seqr, o_parent); |
endtask |
|
// -------------------------------------------------------------------- |
task body(); |
start_item(item); |
finish_item(item); |
endtask |
|
// -------------------------------------------------------------------- |
function new(string name = "s_riffa_rp_rx_api"); |
super.new(name); |
// q = new; |
endfunction |
|
// -------------------------------------------------------------------- |
endclass |
/RIFFA/s_riffa_rp_tx_api.svh
0,0 → 1,66
// -------------------------------------------------------------------- |
class s_riffa_rp_tx_api extends uvm_sequence #(riffa_sequence_item); |
`uvm_object_utils(s_riffa_rp_tx_api) |
|
// -------------------------------------------------------------------- |
riffa_sequence_item item; |
int dwidth; |
// mailbox #(riffa_sequence_item) q; |
|
// -------------------------------------------------------------------- |
uvm_sequencer_base o_seqr; |
uvm_sequence_base o_parent; |
|
function void init(uvm_sequencer_base o_seqr, uvm_sequence_base o_parent, int dwidth); |
this.o_seqr = o_seqr; |
this.o_parent = o_parent; |
this.dwidth = dwidth; |
endfunction : init |
|
// -------------------------------------------------------------------- |
task counting(bit [31:0] len, bit [30:0] off, bit last=1); |
item = riffa_sequence_item::type_id::create("riffa_sequence_item"); |
item.tr = RIFFA_RX_PAYLOAD; |
item.init(dwidth, len, off, last); |
|
foreach(item.data[i]) |
item.data[i] = i + 1; |
|
this.start(o_seqr, o_parent); |
endtask |
|
// -------------------------------------------------------------------- |
task binary_file |
( string file_name |
, bit [31:0] len |
, bit [30:0] off |
, bit last=1); |
|
integer fd; |
integer code; |
item = riffa_sequence_item::type_id::create("riffa_sequence_item"); |
item.tr = RIFFA_RX_PAYLOAD; |
item.init(dwidth, len, off, last); |
|
fd = $fopen(file_name, "rb"); |
code = $fread(item.data, fd); |
$display("##### code = %x #####", code); |
$fclose(fd); |
|
this.start(o_seqr, o_parent); |
endtask |
|
// -------------------------------------------------------------------- |
task body(); |
start_item(item); |
finish_item(item); |
endtask |
|
// -------------------------------------------------------------------- |
function new(string name = "s_riffa_rp_tx_api"); |
super.new(name); |
// q = new; |
endfunction |
|
// -------------------------------------------------------------------- |
endclass |
/tb_riffa_debug/t_debug.svh
0,0 → 1,59
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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); |
vs_debug vseq = vs_debug::type_id::create("vseq"); |
phase.raise_objection(this); |
vseq.init(env_h.riffa_env_h); |
vseq.start(null); |
phase.drop_objection(this); |
endtask : run_phase |
|
// -------------------------------------------------------------------- |
endclass |
/tb_riffa_debug/t_top_base.svh
0,0 → 1,43
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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 |
/tb_riffa_debug/tb_env.svh
0,0 → 1,50
////////////////////////////////////////////////////////////////////// |
//// //// |
//// Copyright (C) 2019 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); |
|
// -------------------------------------------------------------------- |
riffa_env #(N) riffa_env_h; |
riffa_config #(N) cfg_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#(riffa_config #(N))::get(this, "", "riffa_config", cfg_h)) |
`uvm_fatal(get_name(), "Couldn't get config object!") |
|
riffa_env_h = riffa_env #(N)::type_id::create("riffa_env_h", this); |
riffa_env_h.cfg_h = cfg_h; |
endfunction : build_phase |
|
// -------------------------------------------------------------------- |
endclass |
/tb_riffa_debug/vs_top_base.svh
0,0 → 1,26
// -------------------------------------------------------------------- |
class vs_top_base |
extends uvm_sequence #(uvm_sequence_item); |
`uvm_object_utils(vs_top_base) |
|
// -------------------------------------------------------------------- |
riffa_rp_tx_sequencer tx_h; |
riffa_rp_rx_sequencer rx_h; |
s_riffa_rp_rx_api rx_api_h; |
s_riffa_rp_tx_api tx_api_h; |
|
// -------------------------------------------------------------------- |
task init(riffa_env #(N) env_h); |
this.tx_h = env_h.agent_h.rp_tx_sequencer_h; |
this.rx_h = env_h.agent_h.rp_rx_sequencer_h; |
this.rx_api_h = s_riffa_rp_rx_api::type_id::create("rx_api_h"); |
this.tx_api_h = s_riffa_rp_tx_api::type_id::create("tx_api_h"); |
endtask: init |
|
// -------------------------------------------------------------------- |
function new(string name = "vs_top_base"); |
super.new(name); |
endfunction |
|
// -------------------------------------------------------------------- |
endclass |