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


Tutorials



PACKET GENERATOR




Use a class to build packet generator. Make an instance of this class. Packet generator generator generates packets and sends to driver using mailbox. Mailboxis is used to connect the packet generator and driver. Packet generator generates the packet and randomizes the packet. Then the packet is put into mailbox. Always check whether the randomization is sucessful and display a message.



CODE: gen.vr
class generator{
cfg_drvr cfg;
integer no_of_pkts;
packet cur_packet;

task new(cfg_drvr cfg){
this.cfg = cfg;
}

task gen_pkts(){
bit[7:0] l;
l = 0;
no_of_pkts = 5;
repeat (no_of_pkts)
{
l++;

printf("[GENERATOR] l = %d \n",l);
cur_packet = new(l,cfg);
//Always check whether randomization is sucessesful or not
if ( cur_packet.randomize() == 1 )
{
printf ("[GENERATOR] Randomization Sucessesfull.\n");
//Drive the packet if Randomization is Sucessesfull
mailbox_put(gen,cur_packet);
}
else
printf ("[GENERATOR] Randomization failed.\n");
}
}



}

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