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
    /qaz_libs/trunk/BFM/src/tb
    from Rev 45 to Rev 50
    Reverse comparison

Rev 45 → Rev 50

/tb_bfm_pkg.sv File deleted
/bfm_pkg.sv File deleted
/tb_clk_pkg.sv File deleted
/q_pkg.sv File deleted
/tb_clk_class.sv File deleted
/logger_pkg.sv File deleted
/tb_clk.sv File deleted
/legacy/bfm_pkg.sv
0,0 → 1,106
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 bfm_pkg;
 
// --------------------------------------------------------------------
//
typedef enum
{
NONE,
REGULAR
// BURSTY
} traffic_type_e;
 
// --------------------------------------------------------------------
//
class delay_class;
 
rand int unsigned delay = 0;
 
// --------------------------------------------------------------------
//
virtual function void set_delay(traffic_type_e kind = REGULAR);
case(kind)
NONE: delay = 0;
REGULAR: assert(this.randomize() with{delay dist {0 := 60, [1:3] := 30, [4:7] := 10};});
default: delay = 0;
endcase
endfunction: set_delay
 
// --------------------------------------------------------------------
//
virtual function int next(traffic_type_e kind = REGULAR);
set_delay(kind);
return(delay);
endfunction: next
 
// --------------------------------------------------------------------
//
endclass: delay_class
 
// --------------------------------------------------------------------
//
virtual class transaction_class #(parameter type TR_T);
 
delay_class delay_h;
 
// --------------------------------------------------------------------
//
function void random;
assert(this.randomize());
endfunction: random
 
//--------------------------------------------------------------------
//
function new;
delay_h = new();
endfunction: new
 
// --------------------------------------------------------------------
//
pure virtual function void copy(TR_T from);
 
// --------------------------------------------------------------------
//
function automatic TR_T clone;
TR_T child;
clone = new();
$cast(child, this);
clone.copy(child);
return(clone);
endfunction: clone
 
// --------------------------------------------------------------------
//
endclass: transaction_class
 
//--------------------------------------------------------------------
//
endpackage: bfm_pkg
 
/legacy/logger_pkg.sv
0,0 → 1,136
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 logger_pkg;
 
// --------------------------------------------------------------------
//
typedef enum
{
FATAL,
ERROR,
WARNING,
INFO
} logger_severity_t;
 
 
// --------------------------------------------------------------------
//
class logger_class;
 
logger_severity_t verbosity = WARNING;
bit log_debug = 0;
string time_string;
int error_count = 0;
int max_error_display = 8;
bit stop_at_max_error = 1;
 
// --------------------------------------------------------------------
//
function void
set_verbosity(logger_severity_t level);
verbosity = level;
endfunction: set_verbosity
 
 
// --------------------------------------------------------------------
//
function void
debug_enable;
log_debug = 1;
endfunction: debug_enable
 
 
// --------------------------------------------------------------------
//
function void debug(string message);
time_string = $sformatf("??? %16.t | ", $time);
if(log_debug == 1)
$display({time_string, message});
endfunction: debug
 
 
// --------------------------------------------------------------------
//
function void display(string message);
time_string = $sformatf("--- %16.t | ", $time);
$display({time_string, message});
endfunction: display
 
 
// --------------------------------------------------------------------
//
function void info(string message);
time_string = $sformatf("^^^ %16.t | ", $time);
if(verbosity >= INFO)
$display({time_string, message});
endfunction: info
 
 
// --------------------------------------------------------------------
//
function void warning(string message);
time_string = $sformatf("*** %16.t | ", $time);
if(verbosity >= WARNING)
$display({time_string, message});
endfunction: warning
 
 
// --------------------------------------------------------------------
//
function void error(string message);
time_string = $sformatf("!!! %16.t | ", $time);
error_count++;
if(error_count > max_error_display)
if(stop_at_max_error)
$stop;
else
return;
if(verbosity >= ERROR)
$display({time_string, message});
endfunction: error
 
 
// --------------------------------------------------------------------
//
function void fatal(string message);
if(verbosity >= FATAL)
$fatal(1, message);
endfunction: fatal
 
 
//--------------------------------------------------------------------
//
endclass: logger_class
 
 
//--------------------------------------------------------------------
//
endpackage: logger_pkg
 
/legacy/q_pkg.sv
0,0 → 1,147
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 q_pkg;
 
// --------------------------------------------------------------------
//
virtual class q_base_class #(parameter type Q_T = logic);
 
Q_T tr_h;
mailbox #(Q_T) q;
 
// --------------------------------------------------------------------
//
pure virtual task run_q;
 
 
// --------------------------------------------------------------------
//
task put(ref Q_T tr_h);
q.put(tr_h);
endtask: put
 
 
// --------------------------------------------------------------------
//
task get(ref Q_T tr_h);
q.get(tr_h);
endtask: get
 
 
//--------------------------------------------------------------------
function new;
this.q = new();
fork
forever
run_q();
join_none
endfunction: new
 
 
// --------------------------------------------------------------------
//
endclass: q_base_class
 
 
// --------------------------------------------------------------------
//
virtual class nonblocking_transmission_q_class #(parameter type Q_T = logic)
extends q_base_class #(Q_T);
 
// --------------------------------------------------------------------
//
pure virtual task transmit(ref Q_T tr_h);
pure virtual task idle();
 
 
// --------------------------------------------------------------------
//
task automatic run_q;
if(q.try_get(tr_h) != 0)
transmit(tr_h);
else
idle();
endtask: run_q
 
 
// --------------------------------------------------------------------
//
endclass: nonblocking_transmission_q_class
 
 
// --------------------------------------------------------------------
//
virtual class blocking_transmission_q_class #(parameter type Q_T = logic)
extends q_base_class #(Q_T);
 
// --------------------------------------------------------------------
//
pure virtual task transmit(ref Q_T tr_h);
 
 
// --------------------------------------------------------------------
//
task run_q;
q.get(tr_h);
transmit(tr_h);
endtask: run_q
 
 
// --------------------------------------------------------------------
//
endclass: blocking_transmission_q_class
 
 
// --------------------------------------------------------------------
//
virtual class blocking_receiver_q_class #(parameter type Q_T = logic)
extends q_base_class #(Q_T);
 
// --------------------------------------------------------------------
//
pure virtual task receive(ref Q_T tr_h);
 
 
// --------------------------------------------------------------------
//
task run_q;
receive(tr_h);
q.put(tr_h);
endtask: run_q
 
 
//--------------------------------------------------------------------
//
endclass: blocking_receiver_q_class
 
 
//--------------------------------------------------------------------
//
endpackage: q_pkg
 
/legacy/tb_base.sv
0,0 → 1,106
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
 
import tb_clk_pkg::*;
 
 
module
tb_base
#(
parameter PERIOD = 0,
parameter ASSERT_TIME = 0
)
(
output clock,
output reg reset
);
 
// --------------------------------------------------------------------
//
task assert_reset
(
input time reset_assert
);
 
reset = 1;
$display( "-#- %16.t | %m | reset asserted!", $time );
 
#reset_assert;
 
reset = 0;
$display( "-#- %16.t | %m | reset deasserted!", $time );
 
endtask
 
 
// --------------------------------------------------------------------
//
task timeout_stop
(
input time timeout
);
 
$display("-#- %16.t | %m | timeout_stop at %t", $time, timeout);
 
fork
#(timeout) $stop;
join_none
 
endtask
 
 
// --------------------------------------------------------------------
//
tb_clk_class tb_clk_c;
tb_clk_if tb_clk_driver();
assign clock = tb_clk_driver.clk;
time reset_assert = (PERIOD * 5) + (PERIOD / 3);
logic init_done = 0;
 
initial
begin
 
reset = 1;
 
tb_clk_c = new( tb_clk_driver );
 
if( PERIOD != 0 )
tb_clk_c.init_basic_clock( PERIOD );
 
if( ASSERT_TIME != 0 )
assert_reset( ASSERT_TIME );
else if( reset_assert != 0 )
assert_reset( reset_assert );
 
init_done = 1;
 
end
endmodule
 
 
/legacy/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
 
/legacy/tb_clk.sv
0,0 → 1,55
//////////////////////////////////////////////////////////////////////
//// ////
//// 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 ////
//// ////
//////////////////////////////////////////////////////////////////////
 
import tb_clk_pkg::*;
 
module
tb_clk
#(
parameter PERIOD = 0
)
(
output clock
);
 
tb_clk_class tb_clk_c;
tb_clk_if tb_clk_driver();
assign clock = tb_clk_driver.clk;
 
initial
begin
 
tb_clk_c = new( tb_clk_driver );
 
if( PERIOD != 0 )
tb_clk_c.init_basic_clock( PERIOD );
 
end
 
endmodule
 
 
/legacy/tb_clk_class.sv
0,0 → 1,110
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
 
 
// --------------------------------------------------------------------
//
interface tb_clk_if;
logic clk = 0;
logic enable = 0;
time period;
event clk_rise;
event clk_fall;
modport tb_m
(
output clk
);
endinterface: tb_clk_if
 
 
// --------------------------------------------------------------------
//
class
tb_clk_class;
virtual tb_clk_if tb;
 
// --------------------------------------------------------------------
//
function
new
(
virtual tb_clk_if tb
);
this.tb = tb;
endfunction: new
 
// --------------------------------------------------------------------
//
task
init_basic_clock
(
time period
);
tb.period = period;
tb.enable = 1;
$display( "^^^ %16.t | %m | Starting clock with period %t.", $time, period );
fork
forever
if( tb.enable )
begin
#(period/2) tb.clk = 1;
-> tb.clk_rise;
#(period/2) tb.clk = 0;
-> tb.clk_fall;
end
join_none
endtask: init_basic_clock
// --------------------------------------------------------------------
//
task
enable_clock
(
logic enable
);
tb.enable = enable;
$display( "^^^ %16.t | %m | Clock Enable = %h.", $time, enable );
endtask: enable_clock
endclass: tb_clk_class
 
 
/legacy/tb_clk_pkg.sv
0,0 → 1,118
//////////////////////////////////////////////////////////////////////
//// ////
//// 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
 
 
// --------------------------------------------------------------------
//
interface tb_clk_if;
logic clk = 0;
logic enable = 0;
time period;
event clk_rise;
event clk_fall;
modport tb_m
(
output clk
);
endinterface: tb_clk_if
 
 
// --------------------------------------------------------------------
//
package tb_clk_pkg;
 
// --------------------------------------------------------------------
//
class
tb_clk_class;
virtual tb_clk_if tb;
 
// --------------------------------------------------------------------
//
function
new
(
virtual tb_clk_if tb
);
this.tb = tb;
endfunction: new
 
// --------------------------------------------------------------------
//
task
init_basic_clock
(
time period
);
tb.period = period;
tb.enable = 1;
$display( "^^^ %16.t | %m | Starting clock with period %t.", $time, period );
fork
forever
if( tb.enable )
begin
#(period/2) tb.clk = 1;
-> tb.clk_rise;
#(period/2) tb.clk = 0;
-> tb.clk_fall;
end
join_none
endtask: init_basic_clock
// --------------------------------------------------------------------
//
task
enable_clock
(
logic enable
);
tb.enable = enable;
$display( "^^^ %16.t | %m | Clock Enable = %h.", $time, enable );
endtask: enable_clock
// --------------------------------------------------------------------
//
endclass: tb_clk_class
//--------------------------------------------------------------------
//
endpackage: tb_clk_pkg
 
/tb_base.sv
1,6 → 1,6
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2015 Authors and OPENCORES.ORG ////
//// Copyright (C) 2019 Authors and OPENCORES.ORG ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
25,82 → 25,62
//// ////
//////////////////////////////////////////////////////////////////////
 
`timescale 1ps/1ps
 
import tb_clk_pkg::*;
 
 
module
tb_base
#(
parameter PERIOD = 0,
parameter ASSERT_TIME = 0
N = 1,
realtime PERIODS[N],
realtime ASSERT_TIME = (PERIODS[0] * 5) + (PERIODS[0] / 3)
)
(
output clock,
output reg reset
output bit tb_clk[N],
output bit tb_aresetn,
output bit tb_reset[N]
);
timeunit 1ns;
timeprecision 100ps;
 
// --------------------------------------------------------------------
//
task assert_reset
(
input time reset_assert
);
function void assert_reset(realtime reset_assert=ASSERT_TIME);
fork
begin
tb_aresetn = 0;
#reset_assert;
tb_aresetn = 1;
end
join_none
endfunction
 
reset = 1;
$display( "-#- %16.t | %m | reset asserted!", $time );
// --------------------------------------------------------------------
bit disable_clks[N];
 
#reset_assert;
generate
for(genvar j = 0; j < N; j++) begin
always
if(disable_clks[j])
tb_clk[j] = 0;
else
#(PERIODS[j]/2) tb_clk[j] = ~tb_clk[j];
end
endgenerate
 
reset = 0;
$display( "-#- %16.t | %m | reset deasserted!", $time );
 
endtask
 
 
// --------------------------------------------------------------------
//
task timeout_stop
(
input time timeout
);
generate
for(genvar j = 0; j < N; j++) begin
bit reset = 1;
assign tb_reset[j] = reset;
 
$display("-#- %16.t | %m | timeout_stop at %t", $time, timeout);
always @(posedge tb_clk[j] or negedge tb_aresetn)
if(~tb_aresetn)
reset = 1;
else
reset = 0;
end
endgenerate
 
fork
#(timeout) $stop;
join_none
 
endtask
 
 
// --------------------------------------------------------------------
//
tb_clk_class tb_clk_c;
tb_clk_if tb_clk_driver();
assign clock = tb_clk_driver.clk;
time reset_assert = (PERIOD * 5) + (PERIOD / 3);
logic init_done = 0;
 
initial
begin
assert_reset();
 
reset = 1;
 
tb_clk_c = new( tb_clk_driver );
 
if( PERIOD != 0 )
tb_clk_c.init_basic_clock( PERIOD );
 
if( ASSERT_TIME != 0 )
assert_reset( ASSERT_TIME );
else if( reset_assert != 0 )
assert_reset( reset_assert );
 
init_done = 1;
 
end
// --------------------------------------------------------------------
endmodule
 
 
/tb_pkg.sv
31,4 → 31,4
`include "random_delay.svh"
 
// --------------------------------------------------------------------
endpackage : tb_pkg
endpackage

powered by: WebSVN 2.1.0

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