|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |


Tutorials



ENVIRONMENT




Environment is extended class of avm_env. Environment holds all the instancess of avm_verification_component and fifos for connections.



CODE:env.sv
import avm_pkg::*;


`include "Configuration.sv"
`include "packet.sv"
`include "mem_driver.sv"
`include "reciever.sv"
`include "score_board.sv"

class sw_env extends avm_env;

// channels and interface
local virtual switch_if intf;
tlm_fifo#(packet) gen2drv;
tlm_fifo#(packet) drv2sb;
tlm_fifo#(packet) rcv2sb;

// specific components
local Configuration cfg;
local driver drvr;
local reciever rcvr_0;
local reciever rcvr_1;
local reciever rcvr_2;
local reciever rcvr_3;
local scoreboard sb;
local generator gen;
local packet pkt;

string msg;

function new( virtual switch_if intf );

this.intf = intf;
cfg = new("cfg",intf);
pkt = new();
drvr = new("driver",cfg);
rcvr_0 = new("reciever_0",0);
rcvr_1 = new("reciever_1",1);
rcvr_2 = new("reciever_2",2);
rcvr_3 = new("reciever_3",3);
sb = new();
gen = new();
gen2drv = new();
drv2sb = new();
rcv2sb = new();

endfunction

function void connect();

avm_report_message("gen_cfg"," Starting... Gen_cfg \n");
if (!cfg.randomize())
avm_report_error("gen_cfg","Configuration Randomization Failed!\n");
cfg.display();
avm_report_message("gen_cfg"," Ending.... Gen_cfg \n");

pkt.do_cfg(cfg);
// connect all the virtual interfacess.
drvr.intf = intf;
rcvr_0.intf = intf;
rcvr_1.intf = intf;
rcvr_2.intf = intf;
rcvr_3.intf = intf;

// connect all the TLM interfacess
gen.put_port = gen2drv.blocking_put_export;
drvr.get_port = gen2drv.blocking_get_export;
drvr.put_sb = drv2sb.blocking_put_export;
rcvr_0.put_sb = rcv2sb.blocking_put_export;
sb.drv_port = drv2sb.blocking_get_export;
sb.rcv_port = rcv2sb.blocking_get_export;

endfunction





task execute;

wait(sb.no_rcv_pkt == 10 );
terminate;


endtask

task terminate;
$swrite(msg,"\n\n Total number of packets sent %d, Total no of packet recieved %d\n\n",sb.no_drv_pkt,sb.no_rcv_pkt);
avm_report_message("env",msg);
endtask

endclass

Index
Avm Introduction
Dut Specification
Rtl
Top
Interface
Environment
Packet
Packet Generator
Configuration
Driver
Reciever
Scoreboard

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!





<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyright 2007-2017 :: all rights reserved www.testbench.in::Disclaimer