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


Tutorials



ENV




Its a program block named tb.
Define the coverage group for the generated packet
creat abject of the coverage group
Use initial block to creat driver and recivers and scoreboards.
Call the tasks in these components.
Impliment a logic for error count.
Define final block. THis prints whether the test is passed or failed.


CODE:env.vr
program tb{
reg bad;
event err;
integer no_of_errors;
integer gen ;

cfg_drvr cfg ;
generator gen_rator ;
driver driver_obj ;
scoreboard score_board;
receiver receiver_obj_0 ;
receiver receiver_obj_1 ;
receiver receiver_obj_2 ;
receiver receiver_obj_3 ;

gen = alloc(MAILBOX,0,100);

cfg = new();
gen_rator= new(cfg);
driver_obj = new();
score_board = new();

receiver_obj_0 = new(cfg,rec_0);
receiver_obj_1 = new(cfg,rec_1);
receiver_obj_2 = new(cfg,rec_2);
receiver_obj_3 = new(cfg,rec_3);

no_of_errors = 0;
// Reset the dut
@(posedge intf.clk);
intf.reset = 1;
@(posedge intf.clk);
intf.reset =0;

delay(100);
//// Configure the dut.
cfg.drive_add();
delay(100);
//// Generate the packets
gen_rator.gen_pkts();

fork
// Forking error counter task
error_counter();
// Fork task to Drive the packets
driver_obj.gen_and_drive();
//// Fork task to collect packets
receiver_obj_0.collect_packets();
receiver_obj_1.collect_packets();
receiver_obj_2.collect_packets();
receiver_obj_3.collect_packets();

join none
delay(10000);
printf("\n ***** END OF SIMULATION **** \n");
}

//Check for the error count
task final(){

if(no_of_errors > 0)
printf("\n************TEST FAILED with %d ERRORS************\n",no_of_errors);
else
printf("\n************TEST PASSED************\n");
}
task error_counter(){
while(1){
sync(ALL,err);
@(posedge intf.clk);
no_of_errors++;
}
}




Index
Dut Specification
Rtl
Top
Interface
Packet
Packet Generator
Cfg Driver
Driver
Reciever
Scoreboard
Env

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