Code Browser Pages:
| #include <rvm_std_lib.vrh> #ifndef PHY_XTOR_CLASS #define PHY_XTOR_CLASS class phy_xtor_rx extends rvm_xactor{ integer EXECUTING; phy_driver drvr; packet_channel chan_phy2sb; rx_packet_channel chan_gen2xtor; task new(string name,phy_driver drvr,rx_packet_channel chan_gen2xtor,packet_channel chan_phy2sb); task drive_packet(rx_packet pkt); task main_t(); } task phy_xtor_rx::new(string name,phy_driver drvr,rx_packet_channel chan_gen2xtor,packet_channel chan_phy2sb){ super.new("PHY_RX",name); log = new("PHY_RX",name); if(drvr == null) { rvm_note(this.log,psprintf("drvr is null")); exit(0); } this.drvr = drvr; this.chan_phy2sb = chan_phy2sb ; this.chan_gen2xtor = chan_gen2xtor; this.EXECUTING = this.notify.configure(); } task phy_xtor_rx::drive_packet(rx_packet pkt){ integer length,i,last_word,loop_var; bit[31:0] last_wd; bit[7:0] bytes[*]; void = pkt.byte_pack(bytes); length = bytes.size(); rvm_note(this.log,psprintf("Sending packet of length 0",length)); for(i = 0;i < length;i++) { drvr.drive_Rx_dv(1); drvr.drive_Rxd(bytes[i]); //printf("%h[0] ",pkt.Pkt_Packed[i],i); drvr.posedge_clk(); } //Send MinIPG 30 bytes. repeat(30) { drvr.drive_Rx_dv(0); drvr.drive_Rxd(8'b0); drvr.posedge_clk(); } } //end of task task phy_xtor_rx::main_t(){ rx_packet p; fork super.main_t(); join none fork while(1) { p = this.chan_gen2xtor.activate_t(); void = this.chan_gen2xtor.start(); this.notify.indicate(this.EXECUTING,p); rvm_trace(this.log, "Starting transaction..."); rvm_debug(this.log, p.psdisplay()); rvm_OO_callback(data_callback,pre_cb(p)); drive_packet(p); rvm_OO_callback(data_callback,post_cb(p)); chan_phy2sb.put_t(p); this.notify.reset(this.EXECUTING); void = this.chan_gen2xtor.complete(); rvm_trace(this.log, "Completed transaction..."); rvm_debug(this.log, p.psdisplay()); void = this.chan_gen2xtor.remove(); } join none } #endif |