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


Tutorials



DRIVER



Driver is a class.

Define a task which gets the packet from mailbox and calls the drive packet.

Drive_packet is a task which drives the packet on to interface. Call the coverage sample task.
Do packing of the packet generate ,so all the packets feilds which are at high level are converted in to lovel data.
Then drive the packet on to dut.
Add the sent packet to scoreboard expected packet queue.



CODE: driver.vr


//Define driver as class,so this block can be ext}ed if needed

class driver{

packet cur_packet;


task new (){
void = this.randomize();
printf("created driver object\n ");
}

//Define task to generate the packet and call the drive task
task gen_and_drive(){
integer l;
l = 0;
printf("[DRIVER] NUMBER PACKETS %d\n ",gen_rator.no_of_pkts);
repeat (gen_rator.no_of_pkts)
{
void = mailbox_get(WAIT, gen,cur_packet,CHECK);
@(posedge intf.clk);
drive_packet(cur_packet);
}
}



task drive_packet(packet pkt) {
bit [7:0] pkt_packed[*];
integer i;
printf("[DRIVER] Starting to drive packet to intf %0d len %0d \n",pkt.da,pkt.len);

//Do packing of generated packet
pkt_packed = new[pkt.len + 4];
pkt_packed[0] = pkt.da;
pkt_packed[1] = pkt.sa;
pkt_packed[2] = pkt.len;

foreach(pkt.data,i)
pkt_packed[i+3]=pkt.data[i];
pkt_packed[pkt.len+3]=pkt.parity;
@(posedge intf.clk);
foreach(pkt_packed,i)
printf("[PKT drvr] pkt %h at %d\n",pkt_packed[i],i);
// Byte by byte packed data on to DUV
for (i=0;i<pkt.len+3;i++)
{
@ (posedge intf.clk);
intf.data_status = 1 ;
intf.data_in[7:0] = pkt_packed[i];
printf("[PKT drved] pkt %h at %d\n",pkt_packed[i],i);
}
@ (posedge intf.clk);
intf.data_status = 0 ;
intf.data_in[7:0] = pkt.parity ;
//Add the sent packet to scoreboard expected packet queue
score_board.add_exp_packet(pkt);
@(posedge intf.clk);
}

}
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