Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[moved] OCX transmitter and receiver - packet notifications

Status
Not open for further replies.

sai685

Junior Member level 2
Joined
Sep 4, 2015
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
292
tell me by checking the following code that how can i generate sop for the first element of data_512 and eop for last element of data_512. i have tried in this way but it is not working . sop means start of packet and eop means end of packet


Code:
class data_item;
//rand bit sop,eop;
rand bit valid,error;
rand bit[7:0]  data_512[7];
rand bit [6:0] length;
rand byte cycles;

constraint normal
	{
	length inside {[2:63]};
	cycles <=128;
	}
endclass

typedef enum {min_len,max_len,normal,max_cycles} test;
class states;
rand test case_variable;
endclass

class driver;
virtual interface txintf tx_if;
//mailbox seq_drv;
data_item d_item;
states sta_item;
function new(virtual interface txintf tx_if);
d_item=new();
//seq_drv=new();
sta_item=new();
//this.seq_drv	= seq_drv;
this.tx_if  =tx_if;
this.d_item = d_item;
endfunction

task run();
 int i=0;
  logic[7:0] data; 
  forever
   
    begin
  
       if(tx_if.rst_n==0)
		begin
       @(posedge tx_if.clk);
		tx_if.ocx_out.sop	= 0;
		tx_if.ocx_out.valid	= 0;
		tx_if.ocx_out.eop	= 0;
		tx_if.ocx_out.error	= 0;
		tx_if.ocx_out.data_8= 0;
		//seq_drv.get(d_item);
        end
    else
      begin
            assert(d_item.randomize());
           tx_if.ocx_out.valid=$random;
      foreach(d_item.data_512[i])
         begin
       if(d_item.valid)
            begin
              tx_if.ocx_out.data_8 = d_item.data_512[i];
              if(d_item.data_512[0])
              tx_if.ocx_out.sop	= 1;
             else
               tx_if.ocx_out.sop=0;
              if(d_item.data_512[7])
              tx_if.ocx_out.eop=1;
              else
            tx_if.ocx_out.eop=1;
          end
         end
      end  
  //end
  //endcase   
$display("clk=%d,rst_n=%d,sop=%d,valid=%d,eop=%d,error=%d,data=%d",tx_if.clk,tx_if.rst_n,tx_if.ocx_out.sop,tx_if.ocx_out.valid,tx_if.ocx_out.eop,tx_if.ocx_out.error,tx_if.ocx_out.data_8);
 end      
endtask
endclass
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top