endtask // pperrnn_out
task pserrnn_out;
input output_value;
input [127:0] delay_in;
input [31:0] skew_in;
integer delay[0:3];
integer delay_time, skew, i;
begin
delay[0] = delay_in[31:0];
delay[1] = delay_in[63:32];
delay[2] = delay_in[95:64];
delay[3] = delay_in[127:96];
skew = skew_in;
delay_time = delay[lmcver.map(output_value)] + model_times.tld_pserrnn + skew;
if (delay_time < 0) begin delay_time = 0; end
begin : pserrnn_loop
if ((!x_transition_l) && (output_value === 1'bx)) begin disable pserrnn_loop; end
pserrnn <= #( delay_time) output_value;
end //pserrnn_loop
end
endtask // pserrnn_out
//-------------
//-- EXE_SET --
//-------------
task exe_set;
input [fm_data_in1:fm_data_in2] cmd;
integer stype;
integer object_name;
reg [`slv_size-1:0] object_value;
integer delay_val;
reg [31 : 0] pad_out_data;
reg [31 : 0] pd_out_data;
begin
stype = cmd[instype1:instype2];
object_name = cmd[inobject_name1:inobject_name2];
object_value = cmd[inobject_value1:inobject_value2];
delay_val = cmd[indelay_val1:indelay_val2];
case (stype)
mpin : begin
case (object_name)
pad_0 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[0] = 1'b0;
pad_out_data[0] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_1 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[1] = 1'b0;
pad_out_data[1] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_2 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[2] = 1'b0;
pad_out_data[2] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_3 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[3] = 1'b0;
pad_out_data[3] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_4 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[4] = 1'b0;
pad_out_data[4] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_5 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[5] = 1'b0;
pad_out_data[5] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_6 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[6] = 1'b0;
pad_out_data[6] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_7 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[7] = 1'b0;
pad_out_data[7] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_8 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[8] = 1'b0;
pad_out_data[8] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_9 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[9] = 1'b0;
pad_out_data[9] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_10 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[10] = 1'b0;
pad_out_data[10] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_11 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[11] = 1'b0;
pad_out_data[11] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_12 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[12] = 1'b0;
pad_out_data[12] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_13 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[13] = 1'b0;
pad_out_data[13] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_14 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[14] = 1'b0;
pad_out_data[14] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_15 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[15] = 1'b0;
pad_out_data[15] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_16 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[16] = 1'b0;
pad_out_data[16] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_17 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[17] = 1'b0;
pad_out_data[17] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_18 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[18] = 1'b0;
pad_out_data[18] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_19 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[19] = 1'b0;
pad_out_data[19] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_20 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[20] = 1'b0;
pad_out_data[20] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_21 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[21] = 1'b0;
pad_out_data[21] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_22 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[22] = 1'b0;
pad_out_data[22] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_23 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[23] = 1'b0;
pad_out_data[23] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_24 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[24] = 1'b0;
pad_out_data[24] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_25 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[25] = 1'b0;
pad_out_data[25] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_26 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[26] = 1'b0;
pad_out_data[26] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_27 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[27] = 1'b0;
pad_out_data[27] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_28 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[28] = 1'b0;
pad_out_data[28] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_29 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[29] = 1'b0;
pad_out_data[29] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_30 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[30] = 1'b0;
pad_out_data[30] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
pad_31 : begin
pad_out_mask = 32'hffffffff;
pad_out_mask[31] = 1'b0;
pad_out_data[31] = object_value[0];
pad_out(pad_out_data,zero_delay,delay_val);
end
ppar_pin : ppar_out(object_value[0],zero_delay,delay_val);
ptrdynn_pin : ptrdynn_out(object_value[0],zero_delay,delay_val);
pstopnn_pin : pstopnn_out(object_value[0],zero_delay,delay_val);
pdevselnn_pin : pdevselnn_out(object_value[0],zero_delay,delay_val);
pd_32 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[32] = 1'b0;
pd_out_data[0] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_33 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[33] = 1'b0;
pd_out_data[1] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_34 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[34] = 1'b0;
pd_out_data[2] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_35 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[35] = 1'b0;
pd_out_data[3] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_36 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[36] = 1'b0;
pd_out_data[4] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_37 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[37] = 1'b0;
pd_out_data[5] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_38 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[38] = 1'b0;
pd_out_data[6] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_39 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[39] = 1'b0;
pd_out_data[7] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_40 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[40] = 1'b0;
pd_out_data[8] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_41 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[41] = 1'b0;
pd_out_data[9] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_42 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[42] = 1'b0;
pd_out_data[10] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_43 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[43] = 1'b0;
pd_out_data[11] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_44 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[44] = 1'b0;
pd_out_data[12] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_45 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[45] = 1'b0;
pd_out_data[13] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_46 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[46] = 1'b0;
pd_out_data[14] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_47 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[47] = 1'b0;
pd_out_data[15] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_48 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[48] = 1'b0;
pd_out_data[16] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_49 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[49] = 1'b0;
pd_out_data[17] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_50 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[50] = 1'b0;
pd_out_data[18] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_51 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[51] = 1'b0;
pd_out_data[19] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_52 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[52] = 1'b0;
pd_out_data[20] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_53 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[53] = 1'b0;
pd_out_data[21] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_54 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[54] = 1'b0;
pd_out_data[22] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_55 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[55] = 1'b0;
pd_out_data[23] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_56 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[56] = 1'b0;
pd_out_data[24] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_57 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[57] = 1'b0;
pd_out_data[25] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_58 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[58] = 1'b0;
pd_out_data[26] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_59 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[59] = 1'b0;
pd_out_data[27] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_60 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[60] = 1'b0;
pd_out_data[28] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_61 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[61] = 1'b0;
pd_out_data[29] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_62 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[62] = 1'b0;
pd_out_data[30] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
pd_63 : begin
pd_out_mask = 32'hffffffff;
pd_out_mask[63] = 1'b0;
pd_out_data[31] = object_value[0];
pd_out(pd_out_data,zero_delay,delay_val);
end
ppar64_pin : ppar64_out(object_value[0],zero_delay,delay_val);
pack64nn_pin : pack64nn_out(object_value[0],zero_delay,delay_val);
pperrnn_pin : pperrnn_out(object_value[0],zero_delay,delay_val);
pserrnn_pin : pserrnn_out(object_value[0],zero_delay,delay_val);
default :
bfm_msg("EXE_SET: INVALID value for OBJECT_NAME using MPIN format" ,`warnings,msg_level);
endcase
end //mpin
mbus : begin
case (object_name)
pad_bus : pad_out(object_value[31:0],zero_delay,delay_val);
pd_bus : pd_out(object_value[31:0],zero_delay,delay_val);
default :
bfm_msg("EXE_SET: INVALID value for OBJECT_NAME using MBUS format" ,`warnings,msg_level);
endcase
end //mbus
mregister : begin
exe_user_immed(cmd);
end
default : begin
exe_user_immed(cmd);
end
endcase
end
endtask // exe_set
//-------------
//-- EXE_GET --
//-------------
//--side effects
// --return_data
task exe_get;
input [fm_data_in1:fm_data_in2] cmd;
integer stype;
integer object_name;
begin
stype = cmd[instype2:instype2];
object_name = cmd[inobject_name1:inobject_name2];
case (stype)
mpin : begin
case (object_name)
pad_0 : return_data_b(INP.pad[0]);
pad_1 : return_data_b(INP.pad[1]);
pad_2 : return_data_b(INP.pad[2]);
pad_3 : return_data_b(INP.pad[3]);
pad_4 : return_data_b(INP.pad[4]);
pad_5 : return_data_b(INP.pad[5]);
pad_6 : return_data_b(INP.pad[6]);
pad_7 : return_data_b(INP.pad[7]);
pad_8 : return_data_b(INP.pad[8]);
pad_9 : return_data_b(INP.pad[9]);
pad_10 : return_data_b(INP.pad[10]);
pad_11 : return_data_b(INP.pad[11]);
pad_12 : return_data_b(INP.pad[12]);
pad_13 : return_data_b(INP.pad[13]);
pad_14 : return_data_b(INP.pad[14]);
pad_15 : return_data_b(INP.pad[15]);
pad_16 : return_data_b(INP.pad[16]);
pad_17 : return_data_b(INP.pad[17]);
pad_18 : return_data_b(INP.pad[18]);
pad_19 : return_data_b(INP.pad[19]);
pad_20 : return_data_b(INP.pad[20]);
pad_21 : return_data_b(INP.pad[21]);
pad_22 : return_data_b(INP.pad[22]);
pad_23 : return_data_b(INP.pad[23]);
pad_24 : return_data_b(INP.pad[24]);
pad_25 : return_data_b(INP.pad[25]);
pad_26 : return_data_b(INP.pad[26]);
pad_27 : return_data_b(INP.pad[27]);
pad_28 : return_data_b(INP.pad[28]);
pad_29 : return_data_b(INP.pad[29]);
pad_30 : return_data_b(INP.pad[30]);
pad_31 : return_data_b(INP.pad[31]);
pcxbenn_0 : return_data_b(INP.pcxbenn[0]);
pcxbenn_1 : return_data_b(INP.pcxbenn[1]);
pcxbenn_2 : return_data_b(INP.pcxbenn[2]);
pcxbenn_3 : return_data_b(INP.pcxbenn[3]);
ppar_pin : return_data_b(INP.ppar);
pframenn_pin : return_data_b(INP.pframenn);
ptrdynn_pin : return_data_b(INP.ptrdynn);
pirdynn_pin : return_data_b(INP.pirdynn);
pstopnn_pin : return_data_b(INP.pstopnn);
pidsel_pin : return_data_b(INP.pidsel);
psbonn_pin : return_data_b(INP.psbonn);
psdone_pin : return_data_b(INP.psdone);
pclk_pin : return_data_b(INP.pclk);
prstnn_pin : return_data_b(INP.prstnn);
pd_32 : return_data_b(INP.pd[32]);
pd_33 : return_data_b(INP.pd[33]);
pd_34 : return_data_b(INP.pd[34]);
pd_35 : return_data_b(INP.pd[35]);
pd_36 : return_data_b(INP.pd[36]);
pd_37 : return_data_b(INP.pd[37]);
pd_38 : return_data_b(INP.pd[38]);
pd_39 : return_data_b(INP.pd[39]);
pd_40 : return_data_b(INP.pd[40]);
pd_41 : return_data_b(INP.pd[41]);
pd_42 : return_data_b(INP.pd[42]);
pd_43 : return_data_b(INP.pd[43]);
pd_44 : return_data_b(INP.pd[44]);
pd_45 : return_data_b(INP.pd[45]);
pd_46 : return_data_b(INP.pd[46]);
pd_47 : return_data_b(INP.pd[47]);
pd_48 : return_data_b(INP.pd[48]);
pd_49 : return_data_b(INP.pd[49]);
pd_50 : return_data_b(INP.pd[50]);
pd_51 : return_data_b(INP.pd[51]);
pd_52 : return_data_b(INP.pd[52]);
pd_53 : return_data_b(INP.pd[53]);
pd_54 : return_data_b(INP.pd[54]);
pd_55 : return_data_b(INP.pd[55]);
pd_56 : return_data_b(INP.pd[56]);
pd_57 : return_data_b(INP.pd[57]);
pd_58 : return_data_b(INP.pd[58]);
pd_59 : return_data_b(INP.pd[59]);
pd_60 : return_data_b(INP.pd[60]);
pd_61 : return_data_b(INP.pd[61]);
pd_62 : return_data_b(INP.pd[62]);
pd_63 : return_data_b(INP.pd[63]);
pbenn_4 : return_data_b(INP.pbenn[4]);
pbenn_5 : return_data_b(INP.pbenn[5]);
pbenn_6 : return_data_b(INP.pbenn[6]);
pbenn_7 : return_data_b(INP.pbenn[7]);
ppar64_pin : return_data_b(INP.ppar64);
preq64nn_pin : return_data_b(INP.preq64nn);
plocknn_pin : return_data_b(INP.plocknn);
default :
bfm_msg("EXE_GET: INVALID value for OBJECT_NAME using MPIN format" ,`warnings,msg_level);
endcase
end
mbus : begin
case (object_name)
pad_bus : return_data_v(INP.pad);
pcxbenn_bus : return_data_v(INP.pcxbenn);
pd_bus : return_data_v(INP.pd);
pbenn_bus : return_data_v(INP.pbenn);
default :
bfm_msg("EXE_GET: INVALID value for OBJECT_NAME using MBUS format" ,`warnings,msg_level);
endcase
end
mregister : begin
exe_user_immed(cmd);
end
default : begin
exe_user_immed(cmd);
end
endcase
end
endtask // exe_get
//--------------
// EXE_RELOAD --
//--------------
task exe_reload;
input [fm_data_in1:fm_data_in2] cmd;
integer mtype;
reg [1 : `token_size*8] dfile;
reg flush_f;
reg [61:0] addr;
reg [31 : 0] data;
reg [31 : 0] old_cmd_data;
begin
mtype = cmd[inmtype1:inmtype2];
dfile = cmd[indfile1:indfile2];
flush_f = cmd[inflush_f];
bfm_msg("exe_reload" ,`debug_1,msg_level);
`ifdef no_pli
// No Reload code
`else
// RELOAD(req_space,file number)
if (msg_level >= `debug_3) begin
$display("%m RELOAD(%0d,%0s) at time %0t",mtype,dfile,$time);
end
if (mtype === mem) begin
if (msg_level >= `debug_3) begin
$display("%m Loading Mem Space from file %s",dfile);
end
if (flush_f) begin
`ifdef paged
$lmv_mempage_declare("mem_head",0,31,0,536870912);
`else
$lmv_memory_declare("mem_head",0,31,0,536870912);
`endif
end
preload_mem(dfile);
end
else if (mtype === io) begin
if (msg_level >= `debug_3) begin
$display("%m Loading IO Space from file %s",dfile);
end
if (flush_f) begin
`ifdef paged
$lmv_mempage_declare("io_head",0,31,0,536870912);
`else
$lmv_memory_declare("io_head",0,31,0,536870912);
`endif
end
preload_io(dfile);
end
else if (mtype === cfg) begin
if (msg_level >= `debug_3) begin
$display("%m Loading CFG Space from file %s",dfile);
end
if (flush_f) begin
`ifdef paged
$lmv_mempage_declare("cfg_head",0,31,0,536870912);
`else
$lmv_memory_declare("cfg_head",0,31,0,536870912);
`endif
preload_cfg(dfile);
end
else begin
// save old cmd/status value
addr = 62'h0;
addr = addr + 1;
`ifdef paged
$lmv_mempage_read("mem_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_read("mem_head",addr,data);
`endif
old_cmd_data = data;
preload_cfg(dfile);
addr = 62'h0;
data[31 : 16] = device_id;
data[15 : 0] = vendor_id;
`ifdef paged
$lmv_mempage_write("cfg_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_write("cfg_head",addr,data);
`endif
addr = addr + 1;
// restore old cmd/status value
data = old_cmd_data;
`ifdef paged
$lmv_mempage_write("cfg_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_write("cfg_head",addr,data);
`endif
addr = addr + 1;
data[31 : 8] = class_code;
data[7 : 0] = revision_id;
`ifdef paged
$lmv_mempage_write("cfg_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_write("cfg_head",addr,data);
`endif
addr = addr + 1;
data = 32'h0;
data[23 : 16] = header_type;
data[7 : 0] = cache_line_size;
`ifdef paged
$lmv_mempage_write("cfg_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_write("cfg_head",addr,data);
`endif
line_size = cache_line_size;
data = 32'h0;
for (i = 1; i <= 12; i = i + 1) begin
addr = addr + 1;
`ifdef paged
$lmv_mempage_write("cfg_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_write("cfg_head",addr,data);
`endif
end // loop
end
end
`endif
end
endtask // exe_reload
//--------------
//-- EXE_DUMP --
//--------------
task exe_dump;
input [fm_data_in1:fm_data_in2] cmd;
integer mtype;
reg [`slv_size-1 : 0] start_addr;
reg [`slv_size-1 : 0] end_addr;
reg [1 : `token_size*8] dfile;
integer tmp, i,j;
reg ok ;
reg [61:0] addr;
reg [31 : 0] data;
reg [31 : 0] chk_sum;
reg valid;
begin
mtype = cmd[inmtype1:inmtype2];
start_addr = cmd[instart_addr1:instart_addr2 -2];
end_addr = cmd[inend_addr1:inend_addr2 -2];
dfile = cmd[indfile1:indfile2];
if (msg_level >= `debug_1) begin
$display("%m DUMP(%0d,%h,%h) at time %0t",mtype,start_addr,end_addr,$time);
end
// $display("%m mtype = %0d",mtype);
// $display("%m start_addr : end_addr = [%h:%h]",start_addr,end_addr);
// $display("%m dfile = %0s",dfile);
if (mtype === mem)
begin
if (first_mem_dump)
fm = $fopen(dfile); // open memory output file
first_mem_dump = `false;
if (msg_level >= `debug_3) begin
$display("%m Dumping MEMORY Space [%h:%h]",start_addr,end_addr);
end
$fdisplay(fm,"MEMORY Space [%h:%h] at time %0t",start_addr,end_addr,$time);
for (i = start_addr; i <= end_addr; i = i + 1)
begin
addr = i; // DWORD address
`ifdef no_pli
data[31:0] = mem_head[addr[max_addr_width-1:0]];
`else
`ifdef paged
$lmv_mempage_read("mem_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_read("mem_head",addr,data);
`endif
`endif
valid = `true;
for (j = 0; j<32 ; j = j + 1)
begin
if (data[j] === 1'bx)
valid = `false;
end
if (valid)
begin
addr = addr * 4; // convert to byte address
chk_sum = 4;
chk_sum = chk_sum + addr[15 : 8] + addr[7 : 0];
chk_sum = chk_sum + data[31 : 24] + data[23 : 16] + data[15 : 8] + data[7 : 0];
chk_sum = chk_sum % 256;
chk_sum = 256 - chk_sum;
$fdisplay(fm,": 04 %h 00 %h %h",addr[15:0],data[31:0],chk_sum[7:0]);
end
end // loop
$fdisplay(fm,": 00F000010F");
end
else if (mtype === io)
begin
if (msg_level >= `debug_3) begin
$display("%m Dumping IO Space [%h:%h]",start_addr,end_addr);
end
if (first_io_dump)
fi = $fopen(dfile); // open memory output file
first_io_dump = `false;
$fdisplay(fi,"IO Space [%h:%h] at time %0t",start_addr,end_addr,$time);
for (i = start_addr; i <= end_addr; i = i + 1)
begin
addr = i;
`ifdef no_pli
data[31:0] = io_head[addr[max_addr_width-1:0]];
`else
`ifdef paged
$lmv_mempage_read("io_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_read("io_head",addr,data);
`endif
`endif
valid = `true;
for (j = 0; j<32 ; j = j + 1)
begin
if (data[j] === 1'bx)
valid = `false;
end
if (valid)
begin
addr = addr * 4; // convert to byte address
chk_sum = 4;
chk_sum = chk_sum + addr[15 : 8] + addr[7 : 0];
chk_sum = chk_sum + data[31 : 24] + data[23 : 16] + data[15 : 8] + data[7 : 0];
chk_sum = chk_sum % 256;
chk_sum = 256 - chk_sum;
$fdisplay(fi,": 04 %h 00 %h %h",addr[15:0],data[31:0],chk_sum[7:0]);
end
end // loop
$fdisplay(fi,": 00F000010F");
end
else if (mtype === cfg)
begin
if (msg_level >= `debug_3) begin
$display("%m Dumping CONFIG Space [%h:%h]",start_addr,end_addr);
end
if (first_cfg_dump)
fc = $fopen(dfile); // open memory output file
first_cfg_dump = `false;
$fdisplay(fc,"CONFIG Space [%h:%h] at time %0t",start_addr,end_addr,$time);
for (i = start_addr; i <= end_addr; i = i + 1)
begin
addr = i;
`ifdef no_pli
data[31:0] = cfg_head[addr[max_addr_width-1:0]];
`else
`ifdef paged
$lmv_mempage_read("cfg_head",addr[61:9],addr[8:0],data);
`else
$lmv_memory_read("cfg_head",addr,data);
`endif
`endif
valid = `true;
for (j = 0; j<32 ; j = j + 1)
begin
if (data[j] === 1'bx)
valid = `false;
end
if (valid)
begin
addr = addr * 4; // convert to byte address
chk_sum = 4;
chk_sum = chk_sum + addr[15 : 8] + addr[7 : 0];
chk_sum = chk_sum + data[31 : 24] + data[23 : 16] + data[15 : 8] + data[7 : 0];
chk_sum = chk_sum % 256;
chk_sum = 256 - chk_sum;
$fdisplay(fc,": 04 %h 00 %h %h",addr[15:0],data[31:0],chk_sum[7:0]);
end
end // loop
$fdisplay(fc,": 00F000010F");
end
end
endtask // exe_dump
//------------------
// EXE_AUTO_IMMED --
//------------------
task exe_auto_immed;
input [fm_data_in1:fm_data_in2] cmd; // fm_data_in
begin
if ((!(msg_level < `debug_3))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"EXE_AUTO_IMMED: Executing %0s",cmd2string(cmd[incode1:incode2]));
$display("\"");
end // if
case(cmd[incode1:incode2])
`set_cmd : exe_set(cmd);
`get_cmd : exe_get(cmd);
`reload_cmd : exe_reload(cmd);
`dump_cmd : exe_dump(cmd);
default bfm_msg("EXE_AUTO_IMMED: INVALID command code" ,`warnings,msg_level);
endcase
end
endtask // exe_auto_immed
//------------------------------
// EXE_USER_IMMED DECLARATION --
//------------------------------
//----------------
// COMPARE DATA --
//----------------
task compare_data;
input [`slv_size-1:0] eslv;
input [`slv_size-1:0] rslv;
input [`slv_size-1:0] addr;
reg result;
reg comp_f;
integer rslv_len;
integer addr_len;
integer i;
begin : loop_compare
result = `true;
comp_f = `false;
rslv_len = 0;
addr_len = 0;
//find valid range of addr
begin : loop_addr
for (i = 0; i <= `slv_size-1; i = i + 1) begin //addr valid characters must be in lowest positions
if (addr[i] !== 1'bx) addr_len = addr_len + 1;
else disable loop_addr;
end // loop
end // loop_addr
//verify eslv != all 'x'
begin : loop_eslv
for (i = 0; i <= `slv_size-1; i = i + 1) begin
if (eslv[i] !== 1'bx) begin
comp_f = `true;
disable loop_eslv;
end // if
end // loop
end // loop_eslv
if (comp_f) begin
//find valid range of rslv
begin : loop_rslv
for (i = 0; i <= `slv_size-1; i = i + 1) begin
// if (rslv[i] !== 1'bx) rslv_len = rslv_len + 1;
if (ret_data_mask[i] !== 1'b1) rslv_len = rslv_len + 1;
else disable loop_rslv;
end // loop
end // loop_rslv
//verify rslv != all 'x'
if (rslv_len === 0) begin
bfm_msg("COMPARE_DATA: Invalid return data",`warnings,msg_level);
disable loop_compare;
end // if
//verify vector sizes
if (`slv_size < rslv_len) begin
bfm_msg("COMPARE_DATA: not enough bits in expected_data",`debug_1,msg_level);
disable loop_compare;
end // if
//perform comparison
begin : loop_addr4
for (i = 0; i <= rslv_len-1; i = i + 1) begin
// if (rslv[i] === 1'bx) disable loop_addr4;
if (ret_data_mask[i] === 1'b1) disable loop_addr4;
if (eslv[i] !== 1'bx) begin
if (eslv[i] !== rslv[i]) result = `false;
end // if
end // loop
end // loop_addr4
//print results
if ((!(msg_level < `debug_1)) && result) begin
$display("NOTE at %0t from %m", $time);
$write(" \"COMPARE_DATA: Results TRUE\n");
$write(" Address = %H\n", addr[`slv_size-1:0]);
$write(" Expected data = %H\n", eslv[`slv_size-1:0]);
$write(" Returned data = %H", rslv[`slv_size-1:0]);
$display("\"");
end // if
if ((!(msg_level < `warnings)) && (!result)) begin
$display("WARNING at %0t from %m", $time);
$write(" \"COMPARE_DATA: Results FALSE\n");
$write(" Address = %H\n", addr[`slv_size-1:0]);
$write(" Expected data = %H\n", eslv[`slv_size-1:0]);
$write(" Returned data = %H", rslv[`slv_size-1:0]);
$display("\"");
end // if
// Update global STATUS flag
if (!result) lmcver.exit_status = 1;
end // if
end // loop_compare
endtask // compare_data
//-----------------------------
// Receiver Declarations ------
//-----------------------------
reg busy_f
; initial busy_f
= `false;
reg driving_cb_ack_f
; initial driving_cb_ack_f
= `false;
This page: |
Created: | Thu Aug 19 12:01:54 1999 |
| From: |
../../../sparc_v8/system/lmc/rtl/pcislave_fm.v
|