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


Tutorials



RECIEVER




Reciever is a tranctor. Start the collection of packet from dut in the main() task and send them to score_board through rcv2sb_chan channel.


CODE:reciever.vr
#include "ports.vr"
#ifndef RCVR_CLASS
#define RCVR_CLASS

class rcvr_xtor extends rvm_xactor{
packet_channel rcv2sb_chan;
packet pkt,rcv_pkt;
rec_ports port_;
string msg;
static bit [7:0] mem[4];
task new(string inst = "class",integer stream_id = -1,rec_ports port_,
packet_channel rcv2sb_chan = null);
virtual task main_t();

}


task rcvr_xtor::new(string inst ,integer stream_id ,rec_ports port_,packet_channel rcv2sb_chan ){
super.new("reciver",inst,stream_id);
this.port_ = port_;
if(rcv2sb_chan == null)
this.rcv2sb_chan = new("rcv2sb_channel","channel",10);
else
this.rcv2sb_chan = rcv2sb_chan;
rvm_note(this.log,"Receiver created \n");
pkt = new();
}


task rcvr_xtor::main_t(){
bit [7:0] received_bytes[*] ;
super.main_t();
rvm_note(this.log," STARTED main task ");
while(1){
@(posedge port_.$ready);
while (port_.$ready) {
port_.$read <= 1;
@(posedge intf.clk);
received_bytes = new[received_bytes.size() + 1] (received_bytes);
received_bytes[received_bytes.size()-1] = port_.$data_out;
}
port_.$read <= 0;

void = pkt.byte_unpack(received_bytes);
received_bytes.delete();
rcv_pkt = new pkt;
rcv2sb_chan.put_t(rcv_pkt);
}
}

#endif

Index
Introduction
Rtl
Top
Interface
Program Block
Environment
Packet
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