Hi All,
My objective is to use two thread inside fork join_none; one thread will drive reset related stimulus and other when there is no reset.
could any one point one where i am doing mistake and what is the solution?
`timescale 1ns/1ps
interface fjn_intf(input bit clk,rst);
logic [7:0] data;
logic [3:0] addr;
endinterface
class my_driver;
// virtual inteface handle
virtual fjn_intf vif;
//new constructor
function new (input virtual fjn_intf vif);
this.vif = vif;
endfunction
// run_t method
task run_t();
forever
begin
fork
begin: RESET_THREAD
@(negedge vif.rst);
vif.data <= 'b1;
vif.addr <= 'b0;
end
begin: NORMAL_OP
wait(vif.rst == 1'b1);
@(posedge vif.clk);
vif.data <= $urandom_range(39,51);
vif.addr <= $urandom;
end
join_none
end
endtask:run_t
endclass
module fork_joinnone_forever;
//local declared clock and reset
logic clk,rst;
//instantiate interface and pass the clk,rst
fjn_intf intf(clk,rst);
// driver class handle;
my_driver drvh;
initial
begin
drvh = new(intf);
drvh.run_t;
end
initial
begin
clk <= 1'b0;
$dumpvars;
$dumpfile("fork_joinnone.vcd");
#30 $finish;
end
initial
begin
repeat(50)
begin
#0.25ns clk = ~clk;
end
end
initial
begin
rst <= 1'b1;
repeat(3) @(negedge clk)
rst <= 1'b0;
repeat(2) @(posedge clk)
rst <= 1'b1;
end
endmodule