hello i need help in ahb bus environment,
i have a problem that all the signals are stack at the same value however i did generate transactions and looped them to be generated and cover all the possible cases.
thanks in advance,
`ifndef Transaction
`define Transaction
class Transaction;
bit HCLK;
bit HRESETn;
bit HSELx = $random() ;
logic [31:0] HADDR = $random() ;
bit [2:0] HSIZE = $random() ;
bit [2:0] HBURST = $random();
//rand bit [3:0] HPROT;
bit HWRITE = $random();
//rand bit HMASTLOCK;
bit [1:0] HTRANS = $random();
bit HREADY = $random();
logic [31:0] HWDATA = $random();
bit HREADYOUT;
bit HRESP;
logic [31:0] HRDATA;
static int trans_id;
function void display();
$display("%d", $time, , "%b",HADDR, , "%b",HWDATA , , "%b",HRDATA , ,);
endfunction
function new (string message);
$display("-------------------------------------------------");
$display("%s",message);
$display("\tTransaction ID: %d", trans_id);
$display("\tHADDR = %d\n\tHWDATA = %d\n\tHRDATA = %d", HADDR, HWDATA, HWDATA);
$display("-------------------------------------------------");
endfunction
endclass
`endif
`include "Transaction.sv"
class Generator;
rand Transaction Trans;
mailbox gen2driv;
//blueprint = new ();
function new (mailbox gen2driv );
this.gen2driv=gen2driv;
endfunction
//rand Transaction Trans;
int n;
task run();
//Transaction Trans;
//Trans = new ();
//blueprint = new();
repeat (n)
begin
Trans = new ();
Trans.HSELx= $random();
Trans.HADDR= $random();
assert (Trans.randomize);
//Trans = Trans.copy;
gen2driv.put(Trans);
end
endtask
task Wrapup();
endtask
endclass
`include "Transaction.sv"
class driver;
mailbox gen2driv;
Transaction blueprint;
virtual ahb_if ahb_vif;
function new(mailbox gen2driv,virtual ahb_if ahb_vif);
this.gen2driv = gen2driv;
this.ahb_vif=ahb_vif;
endfunction
task reset;
wait(ahb_vif.HRESETn);
$display("Reset started");
ahb_vif.HSELx<=0;
ahb_vif.HADDR<=0;
ahb_vif.HSIZE<=0;
ahb_vif.HBURST<=0;
ahb_vif.HPROT<=0;
ahb_vif.HWRITE<=0;
ahb_vif.HMASTLOCK<=0;
ahb_vif.HTRANS<=0;
ahb_vif.HREADY<=0;
ahb_vif.HWDATA<=0;
$display ("reset ended");
endtask
function build;
blueprint=new();
endfunction
int d;
task run();
Transaction trans;
trans = new();
repeat (d);
begin
trans = new();
gen2driv.get(trans);
@(posedge ahb_vif.HCLK);
ahb_vif.HSELx<=trans.HSELx;
ahb_vif.HADDR<=trans.HADDR;
ahb_vif.HSIZE<=trans.HSIZE;
ahb_vif.HBURST<=trans.HBURST;
//ahb_vif.HPROT<=trans.HPROT;
ahb_vif.HWRITE<=trans.HWRITE;
//ahb_vif.HMASTLOCK<=trans.HMASTLOCK;
ahb_vif.HTRANS<=trans.HTRANS;
ahb_vif.HREADY<=trans.HREADY;
ahb_vif.HWDATA<=trans.HWDATA;
end
endtask
endclass
`include "Transaction.sv"
`include "Generator.sv"
`include "driver.sv"
`include "MonitorINT.sv"
`include "MonitorOUT.sv"
`include "Check.sv"
`include "Coveragecollector.sv"
class Environment;
Transaction trans;
Generator gen;
driver driv;
MonitorINT moninp;
MonitorOUT monoup;
Check chq;
Coveragecollector cov;
mailbox gen2driv;
mailbox mon1scp;
mailbox mon2scp;
virtual ahb_if ahb_vif;
function new (virtual ahb_if ahb_vif);
this.ahb_vif=ahb_vif;
gen2driv = new;
mon1scp = new;
mon2scp = new;
gen = new(gen2driv);
driv = new(gen2driv,ahb_vif);
moninp = new (ahb_vif,mon1scp);
monoup = new (ahb_vif,mon2scp);
chq = new (mon1scp,mon2scp);
cov = new(mon1scp);
trans = new();
endfunction
//Transaction trans;
/*function Trans;
assert(trans.radomize);
endfunction*/
task reset();
driv.reset;
endtask
function build;
//gen.bulid;
driv.build;
moninp.build;
monoup.build;
chq.build;
cov.build;
endfunction
function void display;
trans.display;
endfunction
task run;
fork
gen.run;
driv.run;
moninp.run;
monoup.run;
chq.run;
cov.run;
join_none
endtask
//task Environment::wrapup;
//gen.wrapup;
//driv.wrapup;
//endtask
endclass