Code Browser Pages:
Files in
vmm_eth.tar



call_back.sv
cfg_intf.sv
cfg_xtor.sv
chan.sv
cov.sv
env.sv
file_list
host_driver.sv
host_intf.sv
host_xtor_rx.sv
host_xtor.sv
phy_driver.sv
phy_intf.sv
Current file: phy_xtor_rx.sv
phy_xtor.sv
pkt_generator_rx.sv
pkt_generator.sv
pkt.sv
pro.sv
run
rx_pkt.sv
sb.sv
tb_top.v
timescale.v
top.sv
verilog_top.v



// by gopi@testbench.in
`include "vmm.sv"

`ifndef PHY_XTOR_CLASS
`define PHY_XTOR_CLASS


class phy_xtor_rx extends vmm_xactor ;
  integer EXECUTING;

  phy_driver drvr;
  packet_channel chan_phy2sb;
  rx_packet_channel chan_gen2xtor;

  extern function new(string name,phy_driver drvr,rx_packet_channel chan_gen2xtor,packet_channel chan_phy2sb);
  extern task drive_packet(packet p);
  extern task main();

endclass

function 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)
   `vmm_fatal(this.log,$psprintf("drvr is null"));
  this.drvr = drvr;
  this.chan_phy2sb   = chan_phy2sb  ;
  this.chan_gen2xtor = chan_gen2xtor;
  this.EXECUTING = this.notify.configure();

endfunction

task phy_xtor_rx::drive_packet(packet p);
  integer length,i,last_word,loop_var;
  bit[31:0] last_wd;
  logic [7:0] bytes[];
  rx_packet pkt;

  $cast(pkt,p);
  void'(pkt.byte_pack(bytes));
  length = bytes.size();
  `vmm_note(this.log,$psprintf("Sending packet of length 0",length));

  for(i = 0;i < length;i++)
   begin
     drvr.drive_Rx_dv(1);
     drvr.drive_Rxd(bytes[i]);
     //printf("%h[0] ",pkt.Pkt_Packed[i],i);
     drvr.posedge_clk();
   end

  repeat(30)
  begin
    drvr.drive_Rx_dv(0);
    drvr.drive_Rxd(8'b0);
    drvr.posedge_clk();
  end

endtask //end of task

task phy_xtor_rx::main();
rx_packet p;
  fork
    super.main();
  join_none

  fork
    forever
     begin
       this.chan_gen2xtor.activate(p);
       this.chan_gen2xtor.start();
       this.notify.indicate(this.EXECUTING,p);
       `vmm_trace(this.log, "Starting transaction...");
       `vmm_debug(this.log, p.psdisplay());
       `vmm_callback(data_callback,pre_call(p));
       drive_packet(p);
       `vmm_callback(data_callback,post_call(p));
       chan_phy2sb.sneak(p);
       this.notify.reset(this.EXECUTING);
       this.chan_gen2xtor.complete();
       `vmm_trace(this.log, "Completed transaction...");
       `vmm_debug(this.log, p.psdisplay());
       this.chan_gen2xtor.remove();
     end
  join_none
endtask




`endif