文档库 最新最全的文档下载
当前位置:文档库 › otuxr_task

otuxr_task

otuxr_task
otuxr_task

task derot(input bit dsk2derot_fp_que[$],

input bit [319:0] dsk2derot_data_320b_que[$],

output bit derot2dedis_fp_que[$],

output bit [319:0] derot2dedis_data_320b_que[$]);

int frame_num_tmp;

int index_tmp;

int data_remain;

bit derot2dedis_fp_tmp_que[$];

bit [319:0] derot2dedis_data_320b_tmp_que[$];

bit [15:0] dsk2derot_data_16b_ary[];

bit [15:0] derot2dedis_data_16b_ary[];

byte unsigned oa1 = 8'hf6;

byte unsigned oa2 = 8'h28;

bit [47:0] fas_tmp = {dsk2derot_data_320b_que[0][319:314],

dsk2derot_data_320b_que[1][319:314],

dsk2derot_data_320b_que[2][319:314]};

//====================clear tmp que================================================================

derot2dedis_fp_tmp_que.delete();

derot2dedis_data_320b_tmp_que.delete();

derot2dedis_fp_que.delete();

derot2dedis_data_320b_que.delete();

//====================check data que================================================================

if(dsk2derot_data_320b_que.size() != 20*408) //should 20 frame

`uvm_info(get_type_name(),$sformatf("dsk2derot_data_320b_que size unnormal, should 'd8160, real %0d",dsk2derot_data_320b_que.size()),UVM_LOW)

if(fas_tmp[47:8] != {oa1,oa1,oa1,oa2,oa2}) //start of que should fas `uvm_info(get_type_name(),$sformatf("dsk2derot_data_320b_que fas unnormal, should 'hf6f6f62828, real %0h",fas_tmp[47:8]),UVM_LOW)

//====================derot

data====================================================================

//------------------frame 0----------------------|--frame 1----||---------------frame 0-------------------|--frame 1---

//lane19 0 : 15 320 : 335 16000 : 16015 |304 : 319 || 0 : 15 320 :

335 16000 : 16015 | 0 : 15

//lane18 16 : 31 336 : 351 16016 : 16031 | 0 : 15 || 16 : 31 336 : 351 16016 : 16031 | 16 : 31

// ... ... | ... ==>|| ... ... | ...

//lane1 288 : 303 608 : 623 16288 : 16303 |272 : 287 || 288 : 303 608 : 623 16288 : 16303 |288 : 303

//lane0 304 : 319 624 : 639 16304 : 16319 |288 : 303 || 304 : 319 624 : 639 16304 : 16319 |304 : 319

//------------------------------------------------------------------------------

--------------------------------------

frame_num_tmp = dsk2derot_data_320b_que.size()/408; //4080*4*8/320=408

data_remain = dsk2derot_data_320b_que.size()%408;

if(data_remain != 0)

frame_num_tmp++;

dsk2derot_data_16b_ary = new[frame_num_tmp*8160]; //4080*4*8/16=8160

derot2dedis_data_16b_ary = new[frame_num_tmp*8160]; //4080*4*8/16=8160

dsk2derot_data_16b_ary = {>>{dsk2derot_data_320b_que}};

for(int i=0;i

for(int j=0;j<408;j++)

for(int k=0;k<20;k++)

begin

index_tmp = (k + i%20)>=20 ? ((k + i%20)-20): (k + i%20);

derot2dedis_data_16b_ary[408*i+20*j+k] = dsk2derot_data_16b_ary[408*i+20*j+index_tmp];

end

derot2dedis_data_320b_tmp_que = {>>{derot2dedis_data_16b_ary}};

derot2dedis_data_320b_tmp_que = derot2dedis_data_320b_tmp_que[0:(dsk2derot_data_320b_que.size()-1)];

//===================generate fp======================

derot2dedis_fp_tmp_que = dsk2derot_fp_que;

for(int i=0;i++;i

if(i%408=0)

dsk2derot_fp_tmp_que[i] =1;

//===================send one frame==================

while(1)

begin

if(dsk2derot_fp_tmp_que.size()>407)

begin

dsk2derot_fp_que = dsk2derot_fp_que[0:407];

derot2dedis_data_320b_que = derot2dedis_data_320b_tmp_que[0:407];

derot2dedis_fp_tmp_que = derot2dedis_fp_que_tmp[408:$];

derot2dedis_data_320b_tmp_que = derot2dedis_data_320b_tmp_que[408:$];

end

else

begin

dsk2derot_fp_que = dsk2derot_fp_tmp_que;

derot2dedis_data_320b_que = derot2dedis_data_320b_tmp_que;

break;

end

end

endtask : derot

task dedis(input bit derot2dedis_fp_que[$],

input bit [319:0] derot2dedis_data_320b_que[$]

output bit [255:0] dedis2fa_data_256b_que[$]);

int block_320byte_cnt;

int index_tmp;

byte unsigned [319:0] derot2dedis_data_320byte_ary[];

byte unsigned [319:0] dedis2fa_data_320byte_ary[];

byte unsigned oa1 = 8'hf6;

byte unsigned oa2 = 8'h28;

bit [47:0] fas_tmp = {derot2dedis_data_320b_que[0][319:314],

derot2dedis_data_320b_que[1][319:314],

derot2dedis_data_320b_que[2][319:314]};

//====================clear tmp que=====================

dedis2fa_data_256b_que.delete();

//====================check data que====================

if(derot2dedis_data_320b_que.size() != 408) //should 1 frame

`uvm_info(get_type_name(),$sformatf("derot2dedis_data_320b_que size unnormal, should 'd408, real %0d",derot2dedis_data_320b_que.size()),UVM_LOW)

if(fas_tmp[47:8] != {oa1,oa1,oa1,oa2,oa2}) //start of que should fas

`uvm_info(get_type_name(),$sformatf("derot2dedis_data_320b_que fas unnormal, should 'hf6f6f62828, real %0h",fas_tmp[47:8]),UVM_LOW)

//====================dedis data========================

if(derot2dedis_data_320b_que.size()%8) //8*320bit,means divisible by 320 byte

block_320byte_cnt++;

derot2dedis_data_320byte_ary = new[block_320byte_cnt];

dedis2fa_data_320byte_ary = new[block_320byte_cnt];

derot2dedis_data_320byte_ary = {>>{derot2dedis_data_320b_que}};

//--------------------------------------------------------

//dedis2fa_data_320byte_ary | derot2dedis_data_320byte_ary

// 0 : 15 320 : 335 | 0 1 40 41 ... 280 281

//16 : 31 336 : 351 | 2 3 42 43 ... 282 283

// ... ... | ... ...

//288 : 303 588 : 623 |

//304 : 319 624 : 639 |38 39 79 80 ... 319 320

//--------------------------------------------------------

foreach(derot2dedis_data_320byte_ary[i])

for(int j=0;j<20;j++)

for(int k=0;k<16;k++)

begin

index_tmp = 2*j+(40*(k/2)+k%2);

dedis2fa_data_320byte_ary[i][16*j+k] =

derot2dedis_data_320byte_ary[i][index_tmp];

end

dedis2fa_data_256b_que = {>>{dedis2fa_data_320byte_ary}}; dedis2fa_data_256b_que =

dedis2fa_data_que[0:(derot2dedis_data_320b_que.size()-1)];

endtask : dedis

//============task fa=============

task otu_fa(input bit [255:0] dedis2fa_data_256b_que[$],

output bit fa2descr_fp_que[$],

output bit [255:0] fa2descr_data_256b_que[$]);

bit oof = 1'b1;

int oof_cnt;

bit [63:0] data_64b_tmp;

bit fa2descr_fp_ary_tmp[];

bit [63:0] dedis2fa_data_64b_que[$];

bit [63:0] dedis2fa_data_64b_tmp_que[$];

bit [63:0] fa2descr_data_64b_tmp_que[$];

bit [255:0] fa2descr_data_256b_que[$];

bit [255:0] fa2descr_data_256b_tmp_que[$];

byte unsigned oa1 = 8'hf6;

byte unsigned oa2 = 8'h28;

dedis2fa_data_64b_que= {>>{dedis2fa_data_256b_que}}; //64bit slip

while(1)

begin

if(oof) // OOF = 1, find fas

begin

if(dedis2fa_data_64b_tmp_que.size()<2041) //4080*4*8/64=2040, find fas, need at least 2041*64bit

dedis2fa_data_64b_tmp_que = {dedis2fa_data_64b_tmp_que,dedis2fa_data_64b_que};

else

begin

if((dedis2fa_data_64b_tmp_que[0][256-8*0-1:256-8*4] == {oa1,oa1,oa1,oa2} ||

dedis2fa_data_64b_tmp_que[0][256-8*1-1:256-8*5] == {oa1,oa1,oa2,oa2} ||

dedis2fa_data_64b_tmp_que[0][256-8*2-1:256-8*6] == {oa1,oa2,oa2,oa2}) &&

(dedis2fa_data_64b_tmp_que[2040][256-8*0-1:256-8*4] == {oa1,oa1,oa1,oa2} ||

dedis2fa_data_64b_tmp_que[2040][256-8*1-1:256-8*5] == {oa1,oa1,oa2,oa2} ||

dedis2fa_data_64b_tmp_que[2040][256-8*2-1:256-8*6] == {oa1,oa2,oa2,oa2})) // OA1OA1OA1OA2,OA1OA1OA2OA2,OA1OA2OA2OA2;

begin

`uvm_info(get_type_name(),$sformatf("OTU4 frame alignment : OOF->IF!"),UVM_LOW)

if(fa2descr_data_256b_tmp_que.size() != 0) //oof->if, send remain data

begin

fa2descr_fp_ary_tmp = new[fa2descr_data_256b_tmp_que.size()]; fa2descr_fp_ary_tmp[0] = 1'b1;

fa2descr_fp_que = {>>{fa2descr_fp_ary_tmp}};

fa2descr_data_256b_que = {>>{fa2descr_data_256b_tmp_que}};

fa2descr_data_256b_tmp_que.delete();

end

oof = 1'b0;

end

else

begin

data_64b_tmp = dedis2fa_data_64b_tmp_que.pop_front();

fa2descr_data_64b_tmp_que.push_back(data_64b_tmp);

fa2descr_data_256b_tmp_que = {>>{fa2descr_data_64b_tmp_que}};

if(fa2descr_data_256b_tmp_que.size()>510) //4080*4*8/256=510,

in oof, should generate fp every frame time

begin

`uvm_info(get_type_name(),$sformatf("OTU4 frame alignment OOF state!"),UVM_LOW)

fa2descr_data_256b_que = fa2descr_data_256b_tmp_que[0:509];

fa2descr_data_256b_tmp_que =

fa2descr_data_256b_tmp_que[510:$];

fa2descr_fp_ary_tmp = new[510];

fa2descr_fp_ary_tmp[0] = 1'b1;

fa2descr_fp_que = {>>{fa2descr_fp_ary_tmp}}; end //if

end //

end //

end //oof

else // oof=0, In IF state

begin

if(dedis2fa_data_64b_tmp_que.size()<2041)

dedis2fa_data_64b_tmp_que = {dedis2fa_data_64b_tmp_que,dedis2fa_data_64b_que};

else

begin

fa2descr_data_256b_que = {>>{dedis2fa_data_64b_tmp_que[0:2039]}};

dedis2fa_data_64b_tmp_que = dedis2fa_data_64b_tmp_que[2039:$];

fa2descr_fp_ary_tmp = new[510];

fa2descr_fp_ary_tmp[0] = 1'b1;

fa2descr_fp_que = {>>{fa2descr_fp_ary_tmp}};

if(dedis2fa_data_64b_tmp_que[0][39:8] != {oa1,oa2,oa2}) //byte 3,4,5

oof_cnt++;

else

oof_cnt = 0;

if(oof_cnt == 5)

begin

`uvm_info(get_type_name(),$sformatf("OTU4 frame alignment : IF -> OOF!"),UVM_LOW)

oof = 1'b1;

end

end

end

end

endtask : otu_fa

task otu_descr(input bit [255:0] fa2descr_data_256b_que[$],

output bit [255:0] descr2defec_data_256b_que[$]);

endtask : otu_descr

task defec(input bit [255:0] descr2defec_data_256b_que[$],

output bit [255:0] defec2scr_data_256b_que[$]);

endtask : defec

task odu_scr(input bit [255:0] defec2scr_data_256_que[$],

output bit [255:0] scr2tpce_data_256b_que[$]);

endtask : scr

task tpce_if(input bit [255:0] scr2tpce_data_256b_que[$],

output bit otu2tpc_fp_que[$],

output bit [255:0] otu2tpc_data_256b_que[$]);

bit [255:0] otu2tpc_data_256b_tmp_que[$];

bit otu2tpc_fp_ary[717] = '{default:0};

while(1)

begin

if(scr2tpce_data_256b_tmp_que.size()<717) //91776*2/256=717

scr2tpce_data_256b_tmp_que = {scr2tpce_data_256b_tmp_que,scr2tpce_data_256b_que};

else

begin

otu2tpc_fp_ary[0] = 1'b1;

otu2tpc_fp_que = {>>{otu2tpc_fp_ary}};

otu2tpc_data_256b_que = scr2tpce_data_256b_tmp_que[0:716];

scr2tpce_data_256b_tmp_que = scr2tpce_data_256b_tmp_que[717:$];

end

end

endtask : tpce_if

task tpcdec_if(input bit [255:0] tpcdec_data_256b_que[$],

input bit tpcdec_sop[$];

input bit tpcdec_eop[$];

output bit tpcdec2fa_data_256b_que[$]); int eop_index[$];

bit [127:0] tpcdec_data_128b_que[$];

tpcdec_data_128b_que = {>>{tpcdec_data_256b_que}};

eop_index = tpcdec_eop.find_index with (item == 1'b1);

foreach(eop_index[i])

tpcdec_data_128b_que.delete(eop_index[i]-i);

tpcdec2fa_data_256b_que = {>>{tpcdec_data_128b_que}};

endtask : tpce_if

//============task fa=============

task odu_fa(input bit [255:0] tpdec2odufa_data_256b_que[$], output bit odufa2descr_fp_que[$],

output bit [255:0] odufa2descr_data_256b_que[$]);

bit oof = 1'b1;

int oof_cnt;

bit [47:0] fas_pattern_1;

bit [47:0] fas_pattern_2;

byte unsigned data_byte_tmp;

bit odufa2descr_fp_ary_tmp[];

byte unsigned tpcdec2fa_data_byte_que[$];

byte unsigned tpcdec2fa_data_byte_tmp_que[$];

byte unsigned odufa2descr_data_byte_tmp_que[$];

bit [255:0] odufa2descr_data_256b_que[$];

bit [255:0] odufa2descr_data_256b_tmp_que[$];

byte unsigned oa1 = 8'hf6;

byte unsigned oa2 = 8'h28;

tpcdec2odufa_data_byte_que= {>>{tpcdec2odufa_data_256b_que}}; //byte slip

while(1)

begin

if(oof) // OOF = 1, find fas

begin

if(tpcdec2odufa_data_byte_tmp_que.size()<15302) //3824*4*8/8=15296, find fas, need at least 15296+6 byte

tpcdec2odufa_data_byte_tmp_que = {tpcdec2odufa_data_byte_tmp_que,tpcdec2odufa_data_byte_que};

else

begin

fas_pattern_1 = {tpcdec2odufa_data_byte_tmp_que[0],

tpcdec2odufa_data_byte_tmp_que[1],

tpcdec2odufa_data_byte_tmp_que[2],

tpcdec2odufa_data_byte_tmp_que[3],

tpcdec2odufa_data_byte_tmp_que[4],

tpcdec2odufa_data_byte_tmp_que[5]};

fas_pattern_2 = {tpcdec2odufa_data_byte_tmp_que[15296],

tpcdec2odufa_data_byte_tmp_que[15297],

tpcdec2odufa_data_byte_tmp_que[15298],

tpcdec2odufa_data_byte_tmp_que[15299],

tpcdec2odufa_data_byte_tmp_que[15300],

tpcdec2odufa_data_byte_tmp_que[15301]};

if((fas_pattern_1[47:16] == {oa1,oa1,oa1,oa2} ||

fas_pattern_1[39:8] == {oa1,oa1,oa2,oa2} ||

fas_pattern_1[31:0] == {oa1,oa2,oa2,oa2}) &&

(fas_pattern_2[47:16] == {oa1,oa1,oa1,oa2} ||

fas_pattern_2[39:8] == {oa1,oa1,oa2,oa2} ||

fas_pattern_2[31:0] == {oa1,oa2,oa2,oa2})) // OA1OA1OA1OA2,OA1OA1OA2OA2,OA1OA2OA2OA2;

begin

`uvm_info(get_type_name(),$sformatf("ODU4 frame alignment : OOF->IF!"),UVM_LOW)

if(odufa2descr_data_256b_tmp_que.size() != 0) //oof->if, send remain data

begin

odufa2descr_fp_ary_tmp =

new[odufa2descr_data_256b_tmp_que.size()];

odufa2descr_fp_ary_tmp[0] = 1'b1;

odufa2descr_fp_que = {>>{odufa2descr_fp_ary_tmp}};

odufa2descr_data_256b_que =

{>>{odufa2descr_data_256b_tmp_que}};

odufa2descr_data_256b_tmp_que.delete();

end

oof = 1'b0;

end

else

begin

data_byte_tmp = tpcdec2odufa_data_byte_tmp_que.pop_front();

odufa2descr_data_byte_tmp_que.push_back(data_byte_tmp);

odufa2descr_data_256b_tmp_que =

{>>{odufa2descr_data_byte_tmp_que}};

if(odufa2descr_data_256b_tmp_que.size()>478) //3824*4*8/256=510,

in oof, should generate fp every frame time

begin

`uvm_info(get_type_name(),$sformatf("OTU4 frame alignment OOF

state!"),UVM_LOW)

odufa2descr_data_256b_que =

odufa2descr_data_256b_tmp_que[0:477];

odufa2descr_data_256b_tmp_que =

odufa2descr_data_256b_tmp_que[478:$];

odufa2descr_fp_ary_tmp = new[478];

odufa2descr_fp_ary_tmp[0] = 1'b1;

odufa2descr_fp_que = {>>{odufa2descr_fp_ary_tmp}}; end //if

end //

end //

end //oof

else // oof=0, In IF state

begin

if(tpcdec2odufa_data_byte_tmp_que.size()<15302)

tpcdec2odufa_data_byte_tmp_que =

{tpcdec2odufa_data_byte_tmp_que,tpcdec2odufa_data_byte_que};

else

begin

odufa2descr_data_256b_que =

{>>{tpcdec2odufa_data_byte_tmp_que[0:15295]}}; //3824*4*8/8=15296

tpcdec2odufa_data_byte_tmp_que =

tpcdec2odufa_data_byte_tmp_que[15296:$];

odufa2descr_fp_ary_tmp = new[510];

odufa2descr_fp_ary_tmp[0] = 1'b1;

odufa2descr_fp_que = {>>{odufa2descr_fp_ary_tmp}};

if({tpcdec2odufa_data_byte_tmp_que[2],

tpcdec2odufa_data_byte_tmp_que[3],

tpcdec2odufa_data_byte_tmp_que[4]} != {oa1,oa2,oa2}) //byte 3,4,5

oof_cnt++;

else

oof_cnt = 0;

if(oof_cnt == 5)

begin

`uvm_info(get_type_name(),$sformatf("ODU4 frame alignment : IF -> OOF!"),UVM_LOW)

oof = 1'b1;

end

end

end

end

endtask : odu_fa

task odu_descr(input bit [255:0] odufa2descr_data_256b_que[$],

input bit odufa2descr_fp_que[$],

output bit descr2fec_fp_que[$],

output bit [255:0] descr2fec_data_256b_que[$]);

endtask : odu_descr

task fec(input bit descr2fec_fp_que[$],

input bit [255:0] descr2fec_data_256b_que[$],

output bit fec2scr_fp_que[$],

output bit [255:0] fec2scr_data_256b_que[$]);

endtask : fec

task otu_scr(input bit fec2scr_fp_que[$],

input bit [255:0] fec2scr_data_256_que[$],

output bit scr2dis_fp_que[$],

output bit [255:0] scr2dis_data_256b_que[$]);

endtask : otu_scr

task dis(input bit scr2dis_fp_que[$],

input bit [255:0] scr2dis_data_256b_que[$],

output bit dis2rot_fp_que,

output bit [255:0] dis2rot_data_320b_que[$]);

int unsigned block_320byte_cnt;

int unsigned data_remain;

int unsigned index_tmp;

byte unsigned [319:0] scr2dis_data_320byte_ary[];

byte unsigned [319:0] dis2rot_data_320byte_ary[];

bit dis2rot_fp_ary[];

bit [319:0] scr2dis_data_320b_que[$];

byte unsigned scr2dis_data_byte_que[$];

scr2dis_data_320b_que = {>>{scr2dis_data_256b_que}};

scr2dis_data_byte_que = {>>{scr2dis_data_256b_que}};

block_320byte_cnt = scr2dis_data_byte_que.size()/320;

data_remain = scr2dis_data_byte_que.size()%320;

if(data_remain)

block_320byte_cnt++;

scr2dis_data_320byte_ary = new[block_320byte_cnt*320];

dis2rot_data_320byte_ary = new[block_320byte_cnt*320];

scr2dis_data_320byte_ary = {>>{scr2dis_data_byte_que}};

foreach(scr2dis_data_320byte_ary[i])

for(int j=0;j<16;j++)

for(int k=0;k<20;k++)

begin

index_tmp = 40*(j/2)+(16*(k/2)+(k%2));

dis2rot_data_320byte_ary[i][20*j+k] = scr2dis_data_320byte_ary[i][index_tmp];

end

dis2rot_data_320b_que = {>>{dis2rot_data_320byte_ary}};

dis2rot_data_320b_que = dis2rot_data_320b_que[0:(scr2dis_data_320b_que.size()-1)]

dis2rot_fp_ary = new[scr2dis_data_320b_que.size()];

dis2rot_fp_ary[0] = 1;

scr2dis_fp_que = {>>{scr2dis_fp_que}};

endtask : dis

task rot(input bit dis2rot_fp_que[$],

input bit [319:0] dis2rot_data_320b_que[$],

output bit rot2int_fp_que[$],

output bit [319:0] rot2int_data_320b_que[$]);

int unsigned index_tmp;

bit [47:0] fas_pattern;

byte unsigned oa1 = 8'hf6;

byte unsigned oa2 = 8'h28;

fas_pattern = {dis2rot_data_320b_que[0][319:304],

dis2rot_data_320b_que[1][319:304],

dis2rot_data_320b_que[2][319:304]};

if(fas_pattern[47:16] == {oa1,oa1,oa1,oa2} ||

fas_pattern[39:8] == {oa1,oa1,oa2,oa2}) //{oa1,oa1,oa1,oa2},{oa1,oa1,oa2,oa2}

llm = dis2rot_data_320b_que[2][311:304]; // llm , the 6th of fas

else

llm = ?;

foreach(dis2rot_data_320b_que[i])

for(int j=0;j<20;j++)

for(int k=0;k<16;k++)

begin

index_tmp = (j < llm) ? (20-(llm-j)) : (j-llm);

rot2int_data_320b_que[i][16*j+k] = dis2rot_data_320b_que[i][16*index_tmp+k];

end

endtask

task int(input bit [319:0] rot2int_data_320b_que[$],

output bit [639:0] int2sds_data_640b_que[$]);

int signed index_tmp; //signed

bit [15:0] rot2int_data_16b_ary[20][];

bit [64:0] rot2int_data_64b_ary[4][];

bit [319:0] int2sds_data_640b_ary[];

bit [319:0] int2sds_data_320b_que[$];

bit [31:0] int2sds_data_32b_tmp_que[$];

bit [31:0] int2sds_data_32b_que[10][$];

bit [63:0] int2sds_data_64b_que[10][$];

bit [63:0] int2sds_data_64b_tmp_que[$];

if(otu_10lane_mode)

begin

foreach(rot2int_data_320b_que[i])

for(int j=0;j<10;j++)

for(int k=0;k<32;k++)

begin

if(!(k%2))

index_tmp = 16+k/2;

else

index_tmp = -(k+1)/2;

int2sds_data_320b_que[i][32*j+k] = rot2int_data_320b_que[i][32*j+index_tmp];

end

int2sds_data_32b_tmp_que = {>>{ int2sds_data_320b_que}};

int2sds_data_64b_tmp_que.delete();

for(int i=0;i<10;i++)

begin

int2sds_data_32b_que[i] = int2sds_data_32b_tmp_que.find with (int2sds_data_32b_tmp_que.index%10==i);

int2sds_data_64b_que[i] = {>>{int2sds_data_32b_que[i]}};

int2sds_data_64b_tmp_que = {int2sds_data_64b_tmp_que,int2sds_data_64b_que[i].pop_front()};

end

int2sds_data_640b_que = {>>{int2sds_data_64b_tmp_que}};

end

if(otu_4lane_mode)

for(int i=0;i<20;i++)

rot2int_data_16b_ary[i] = new[rot2int_data_320b_que.size()];

for(int i=0;i<4;i++)

rot2int_data_64b_ary[i] = new[rot2int_data_320b_que.size()];

int2sds_data_320b_ary = new[rot2int_data_320b_que.size()];

for(int i=0;i<20;i++)

for(int j=0;j++;j

rot2int_data_16b_ary[i][j] = rot2int_data_320b_que[j][319-16*i:304-16*i];

for(int i=0;i<4;i++)

for(int j=0;j++;j

rot2int_data_64b_ary[i][j] = {rot2int_data_16b_ary[4*i+4][j],

rot2int_data_16b_ary[4*i+3][j],

rot2int_data_16b_ary[4*i+2][j],

rot2int_data_16b_ary[4*i+1][j],

rot2int_data_16b_ary[4*i+0][j]};

for(int j=0;j++;j

int2sds_data_640b_ary = {(64*6)'h0,

rot2int_data_64b_ary[0][j],

rot2int_data_64b_ary[1][j],

rot2int_data_64b_ary[2][j],

rot2int_data_64b_ary[3][j]};

int2sds_data_640b_que = {>>{int2sds_data_320b_ary}};

endtask

task dsk(input bit dsk_fp_que[20][$],

input bit [319:0] dsk_data_320b_que[$],

output bit dsk2derot_fp_que[$],

output bit [319:0] dsk2derot_data_320b_que[$]);

bit ola = 1'b0;

bit [15:0] dsk_data_16b_que[$];

bit [15:0] dsk_data_16b_tmp_que[$];

int signed lane_fp_index[20];

for(int i=0;i<20;i++)

lane_fp_index[i] = dsk_fp_que[i].find_first_index(item == 1);

if(lane_fp_index[0] !=0)

begin

dsk_fp_tmp_que = dsk_fp_que[0:lane_fp_index[0]-1];

dsk_fp_que = dsk_fp_que[lane_fp_index[0]:$];

dsk_data_320b_tmp_que = dsk_data_320b_que[0:lane_fp_index[0]-1];

dsk_data_320b_que = dsk_data_320b_que[lane_fp_index[0]:$];

`uvm_info(get_type_name(),$sformatf("DSK : lane0 fp don't come first clk!"),UVM_LOW)

end

dsk_data_16b_tmp_que = {>>{dsk_data_320b_que}};

for(int j=0;j<20;j++)

dsk_data_16b_que[j].delete();

for(int i=0;i

for(int j=0;j<20;j++)

dsk_data_16b_que[j].push_back(dsk_data_16b_tmp_que.pop_front());

for(int i=0;i<20;i++)

begin

lane_fp_index[i] = lane_fp_index[i] - lane_fp_index[0];

if(lane_fp_index[i]-408*i>46 || 408*i-lane_fp_index[i]>46) //deskew limit 46*16 UI; 4080*4*8/320=408;

begin

ola = 1;

`uvm_info(get_type_name(),$sformatf("DSK : in OLA state!"),UVM_LOW)

end

if(!ola)

begin

if(lane_fp_index[i]-408*i>0) // fp come late, should delete

repeat(lane_fp_index[i]-408*i)

dsk_data_16b_que[i].delete(lane_fp_index[i]-1);

else // fp come early, should insert

repeat(408*i-lane_fp_index[i])

dsk_data_16b_que[i].insert(lane_fp_index[i]-1,dsk_data_16b_que[(lane_fp_index[i] -1)]);

end

end

dsk_data_16b_tmp_que.delete();

for(int i=0;i

for(int j=0;j<20;j++)

dsk_data_16b_tmp_que.push_back(dsk_data_16b_que[j].pop_front());

dsk_data_320b_que = {>>{dsk_data_16b_tmp_que}};

dsk2derot_fp_que = {};

dsk2derot_data_320b_que = {dsk_data_320b_tmp_que,dsk_data_320b_que};

endtask : dsk

task llsort(input bit llfa2llsort_fp_que[20][$],

input bit [319:0] llfa2llsort_data_320b_que[$],

output bit llsort2dsk_fp_que[20][$],

output bit llsort2dsk_data_320b_que[$]);

bit oor_ary[20] = '{default:1};

bit [7:0] llm_que[20][$];

bit [7:0] llm_value[$];

bit [7:0] sort_llm_value[$];

bit [7:0] dif_llm_que[20][$];

int fp_index_que[20][$];

//=================change 320bit to 20 logic lane===================

llfa2llsort_data_16b_tmp_que = {>>{llfa2llsort_data_320b_que}};

for(int j=0;j<20;j++)

llfa2llsort_data_16b_que[j].delete();

for(int i=0;i< llfa2llsort_data_320b_que.size();i++)

for(int j=0;j<20;j++)

llfa2llsort_data_16b_que[j].push_back(llfa2llsort_data_16b_tmp_que.pop_front()); //==================================================================

//should check every 16320 byte...

for(int i=0;i<20;i++)

fp_index_que[i] = llfa2llsort_fp_que.find_index with (item == 1);

for(int i=0;i<20;i++)

for(int j=0;j

llm_que[i][j] = llfa2llsort_data_16b_que[i][fp_index_que[j]+2][7:0]%20; //the 6th of fas is llm

for(int i=0;i<20;i++)

begin

llm_tmp_que[i] = {llm_tmp_que[i],llm_que[i]};

if(llm_tmp_que[i].size()>4)

begin

dif_llm_que[i] = llm_tmp_que[i][0:4].unique();

if(oor_ary[i])

begin

if(dif_tmp_que[i].size()==1) // five continus same llm, oor->ir

begin

`uvm_info(get_type_name(),$sformatf("SORT : lane[%0d] in IR state!",i),UVM_LOW)

oor_ary[i] = 0;

llm_value[i] = dif_tmp_que[i];

end

llm_tmp_que[i].delete(0);

end

else

begin

if(dif_tmp_que[i].size()==5) // five continus not same llm, ir->oor begin

`uvm_info(get_type_name(),$sformatf("SORT : lane[%0d] in IR state!",i),UVM_LOW)

oor_ary[i] = 1;

end

llm_tmp_que[i].delete(0);

end

end

end

//======================sort lane========================

if(oor_ary[i] == '{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}) //20 lane in IR state begin

sort_llm_value = llm_value.sort();

if(sort_llm_value != {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19})

begin

`uvm_info(get_type_name(),$sformatf("SORT : LLM same, In OLA state!",i),UVM_LOW)

end

else

begin

for(int i=0;i<20;i++)

llsort2dsk_data_16b_que[llm_value[i]] = llfa2llsort_data_16b_que[i]; end

end

endtask

相关文档