pcxbenn_3 : begin
pcxbenn_out_mask = 4'b1111;
pcxbenn_out_mask[3] = 1'b0;
pcxbenn_out_data[3] = object_value[0];
pcxbenn_out(pcxbenn_out_data,zero_delay,delay_val);
end
ppar_pin : ppar_out(object_value[0],zero_delay,delay_val);
pframenn_pin : pframenn_out(object_value[0],zero_delay,delay_val);
ptrdynn_pin : ptrdynn_out(object_value[0],zero_delay,delay_val);
pirdynn_pin : pirdynn_out(object_value[0],zero_delay,delay_val);
pdevselnn_pin : pdevselnn_out(object_value[0],zero_delay,delay_val);
preqnn_pin : preqnn_out(object_value[0],zero_delay,delay_val);
pclkrunnn_pin : pclkrunnn_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
pbenn_4 : begin
pbenn_out_mask = 4'b1111;
pbenn_out_mask[4] = 1'b0;
pbenn_out_data[0] = object_value[0];
pbenn_out(pbenn_out_data,zero_delay,delay_val);
end
pbenn_5 : begin
pbenn_out_mask = 4'b1111;
pbenn_out_mask[5] = 1'b0;
pbenn_out_data[1] = object_value[0];
pbenn_out(pbenn_out_data,zero_delay,delay_val);
end
pbenn_6 : begin
pbenn_out_mask = 4'b1111;
pbenn_out_mask[6] = 1'b0;
pbenn_out_data[2] = object_value[0];
pbenn_out(pbenn_out_data,zero_delay,delay_val);
end
pbenn_7 : begin
pbenn_out_mask = 4'b1111;
pbenn_out_mask[7] = 1'b0;
pbenn_out_data[3] = object_value[0];
pbenn_out(pbenn_out_data,zero_delay,delay_val);
end
ppar64_pin : ppar64_out(object_value[0],zero_delay,delay_val);
preq64nn_pin : preq64nn_out(object_value[0],zero_delay,delay_val);
plocknn_pin : plocknn_out(object_value[0],zero_delay,delay_val);
pperrnn_pin : pperrnn_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
mbus : begin
case (object_name)
pad_bus : pad_out(object_value[31:0],zero_delay,delay_val);
pcxbenn_bus : pcxbenn_out(object_value[3:0],zero_delay,delay_val);
pd_bus : pd_out(object_value[31:0],zero_delay,delay_val);
pbenn_bus : pbenn_out(object_value[3:0],zero_delay,delay_val);
default : bfm_msg("EXE_SET: 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_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]);
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);
pdevselnn_pin : return_data_b(INP.pdevselnn);
pidsel_pin : return_data_b(INP.pidsel);
preqnn_pin : return_data_b(INP.preqnn);
pgntnn_pin : return_data_b(INP.pgntnn);
pclk_pin : return_data_b(INP.pclk);
pclkrunnn_pin : return_data_b(INP.pclkrunnn);
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);
pack64nn_pin : return_data_b(INP.pack64nn);
plocknn_pin : return_data_b(INP.plocknn);
pperrnn_pin : return_data_b(INP.pperrnn);
pserrnn_pin : return_data_b(INP.pserrnn);
psbonn_pin : return_data_b(INP.psbonn);
psdone_pin : return_data_b(INP.psdone);
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;
begin
bfm_msg("RELOAD command not yet implemented" ,`warnings,msg_level);
end
endtask // exe_reload
//------------------
// 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;
default bfm_msg("EXE_AUTO_IMMED: INVALID command code" ,`warnings,msg_level);
endcase
end
endtask // exe_auto_immed
task chk_excpt_detected;
inout [31:0] curr_mem_addr;
begin
end
endtask // chk_excpt_detected
//------------------------------
// 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;
reg cb_ack_event
;
always @(lmcver.cb_ack) begin
cb_ack_event = `true;
cb_ack_event <= #(0) `false;
end
reg cb_initiator_id_event
;
always @(lmcver.cb[cbinitiator_id1:cbinitiator_id2]) begin
cb_initiator_id_event = `true;
cb_initiator_id_event <= #(0) `false;
end
//------------
// RECEIVER --
//------------
task receiver;
reg [1:`slv_size] addr_str;
reg [1:`slv_size] data_str;
reg [`slv_size-1:0] addr_slv;
reg [`slv_size-1:0] data_slv;
reg valid_f;
integer i;
begin
valid_f = `false;
if (cb_ack_event) begin
if (driving_cb_ack_f) begin
driving_cb_ack_f = `false;
lmcver.cb_ack[ackack_val1:ackack_val2] <= #(0) `Release;
end // if
end // if
if (cb_initiator_id_event && (lmcver.cb[cbinitiator_id1:cbinitiator_id2] !== `cb_release_id) && (lmcver.cb[cbinitiator_id1:cbinitiator_id2] !== id_number)) begin
if ((lmcver.cb[cbtarget_id1:cbtarget_id2] === id_number) || (lmcver.cb[cbtarget_id1:cbtarget_id2] === `cb_brdcst_id)) begin
if ((!(msg_level < `debug_cb))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"Target %0d : Receiving", id_number);
$display("\"");
end // if
busy_f = `false;
//receive message if valid
case (lmcver.cb[cbtransaction1:cbtransaction2])
`cmd_trans : begin
temp_cmd[cbfield1:cbfield2] = lmcver.cb;
timing.to_fm_data_in(lmcver.cb[cbmsg1:cbmsg2], msg_level); //prechecks, issues syntax warnings
temp_cmd[fmfield1:fmfield2] = timing.wk_cmd;
if (temp_cmd[fmcode1:fmcode2] !== `null_cmd) begin
if (temp_cmd[cbbuffer_f]) begin
//store command in cmd_mem
addelement(temp_cmd[cbfield1:cbfield2],load_mem_addr,valid_f);
if (valid_f) begin
bfm_msg("Target stored buffer type command" ,`debug_cb,msg_level);
end
else begin
build_cmd(temp_cmd[cbmsg1:cbmsg2],"func_end"," "); // currently function name does not matter for end
max_cmd_mem_size = max_cmd_mem_size + 1;
addelement(temp_cmd[cbfield1:cbfield2],load_mem_addr,valid_f);
end // if
end
else begin
//verify legal execute type command
if (temp_cmd[fmcode1:fmcode2] !== `call_cmd) begin
//store command in exe_nxt_buf if empty??
if (exe_nxt_buf_pointer === 0) begin
exe_nxt_buf[exe_nxt_buf_pointer + 1] = temp_cmd;
exe_nxt_buf_pointer = exe_nxt_buf_pointer + 1;
bfm_msg("Target stored execute type command in exe_nxt_buf buffer" ,`debug_cb,msg_level);
end
else begin
busy_f = `true;
//set issued_busy_f so can broadcast a ready message
issued_busy_f = `true;
bfm_msg("Execute command buffer full, command not accepted" ,`debug_cb,msg_level);
end // if
end // if
else begin
bfm_msg("CALL_CMD Not allowed as remote/execute type command" ,`warnings,msg_level);
end // if
end // if
end // if
end
`status_trans : begin
if ((lmcver.cb[cbbuffer_avail_f]) && (lmcver.cb[cbinitiator_id1:cbinitiator_id2] === wait_on_avail_id)) begin
wait_on_avail_f = `false;
if ((!(msg_level < `debug_cb))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"BUFFER_AVAILABLE Status received from id_number =%0d", lmcver.cb[cbinitiator_id1:cbinitiator_id2]);
$display("\"");
end // if
end // if
if (lmcver.cb[cbdone_f]) begin
if ((wait_on_done_f) && (lmcver.cb[cbtag1:cbtag2] === wait_on_done_tag)) begin
done_f_rcvd = `true;
if ((!(msg_level < `debug_cb))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"DONE Status received from id_number =%0d\n", lmcver.cb[cbinitiator_id1:cbinitiator_id2]);
$write(" Received TAG =%0d\n", lmcver.cb[cbtag1:cbtag2]);
$write(" WAIT_ON_TAG =%0d", wait_on_done_tag);
$display("\"");
end // if
end
else begin
if ((!(msg_level < `debug_cb))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"DONE Status received from id_number = %0d\n", lmcver.cb[cbinitiator_id1:cbinitiator_id2]);
$write(" Received TAG = %0d\n", lmcver.cb[cbtag1:cbtag2]);
$write(" WAIT_ON_TAG = %0d", wait_on_done_tag);
$display("\"");
end // if
end // if
end // if
if (lmcver.cb[cbdvalid_f]) begin
if ((!(msg_level < `debug_cb))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"DVALID Status received from id_number = %0d\n", lmcver.cb[cbinitiator_id1:cbinitiator_id2]);
$display("\"");
end // if
addr_str = lmcver.cb[cbmsg1:1126];
data_str = lmcver.cb[1127:cbmsg2];
addr_slv = addr_str;
data_slv = data_str;
return_data_addrv(addr_slv,data_slv);
end // if
end
endcase
if (!busy_f)
lmcver.cb_ack[ackack_val1:ackack_val2] <= #(0) `ack_rsp;
else
lmcver.cb_ack[ackack_val1:ackack_val2] <= #(0) `busy_rsp;
lmcver.cb_ack[ackinitiator_id1:ackinitiator_id2] <= #(0) lmcver.cb[cbinitiator_id1:cbinitiator_id2];
lmcver.cb_ack[acktarget_id1:acktarget_id2] <= #(0) lmcver.cb[cbtarget_id1:cbtarget_id2];
driving_cb_ack_f = `true;
end // if
end // if
end
endtask // receiver
//====================================--
// BEGIN CONTROLLER SECTION --
//====================================--
reg ctrl_init
; initial ctrl_init
= `true;
reg first_call_f
; initial first_call_f
= `true;
integer nest_level
; initial nest_level
= 0;
integer for_nest_level
; initial for_nest_level
= 0;
integer fh
;
integer endfile
;
reg rsp_strobe
; initial rsp_strobe
= 1'b0;
reg strobe_rsp_f
; initial strobe_rsp_f
= `false;
reg rsp_strobe_set
; initial rsp_strobe_set
= `false;
//!!8.0.burst - remove var
//!!reg stop_queuing_f; initial stop_queuing_f = `false;
reg suspend_exe_f
; initial suspend_exe_f
= `false;
reg queue_overflow_f
; initial queue_overflow_f
= `false;
reg [1:1*8] curr_loop_var
; initial curr_loop_var
= "";
integer init_loop_val
; initial init_loop_val
= 0;
integer curr_loop_val
; initial curr_loop_val
= 0;
integer exit_val
; initial exit_val
= 0;
integer step_val
; initial step_val
= 0;
integer beg_loop_addr
; initial beg_loop_addr
= 0;
integer end_loop_addr
; initial end_loop_addr
= 0;
reg for_f
; initial for_f
= `false;
reg sequential_f
; initial sequential_f
= `false;
integer monitor_id
; initial monitor_id
= 0;
reg wait_on_f
; initial wait_on_f
= `false;
integer wait_on_val
; initial wait_on_val
= 0;
reg wait_on_node_f
; initial wait_on_node_f
= `false;
reg wait_on_node_val
; initial wait_on_node_val
= 1'b0;
reg wait_on_node_dummy
;
reg [1 : `token_size*8] exe_func_name
; initial exe_func_name
= "";
reg [1 : `token_size*8] curr_func_name
; initial curr_func_name
= "";
reg [1 : `token_size*8] seq_halt_func_name
; initial seq_halt_func_name
= "";
reg [1 : `max_cmd_size*8] tmp_str
; initial tmp_str
= "";
// type data_status_type is
parameter inactive = 0;
parameter active = 1;
parameter passed_val = 2;
// type data_table_element, [1:1088] = ([1:1024] name, [1025:1056] val, [1057:1088] status)
//type data_table_type is array(1 to 100) of data_table_element;
parameter addr_tbl_size = 100;
parameter var_tbl_size = 100;
integer var_tbl_counter
; initial var_tbl_counter
= 1;
integer addr_tbl_counter
; initial addr_tbl_counter
= 1;
reg [1 : 1088] var_tbl
[1 : var_tbl_size];
reg [1 : 1088] addr_tbl
[1 : addr_tbl_size];
initial begin
for (i = 1; i <= addr_tbl_size; i = i + 1) begin
var_tbl[i] = {nul_token,32'h0,32'h0};
addr_tbl[i] = {nul_token,32'h0,32'h0};
end // for
end
parameter stack_size = 20;
reg [31:0] returnto_stk
[1 : stack_size];
integer stack_pointer
; initial stack_pointer
= 0;
always @(posedge (wait_on_node_dummy === 1'b1)) begin
wait_on_node_val <= 1'b1;
end
//--------------------
// STACK PROCEDURES --
//--------------------
task push_stack;
input [31:0] stk_addr;
begin : loop_push
if (stack_pointer > stack_size) begin
$display("WARNING at %0t from %m", $time);
$display(" STACK IS FULL, CANNOT PUSH MORE THAN %0d", stack_size);
$display(" INCREASE \" stack_aize \"");
disable loop_push;
end // if
returnto_stk[stack_pointer+1] = stk_addr;
stack_pointer = stack_pointer + 1;
end
endtask // push_stack
task pop_stack;
output [31:0] stk_addr;
begin : loop_pop
if (stack_pointer < 1) begin
$display("WARNING at %0t from %m", $time);
$display(" STACK IS EMPTY, NOTHING TO POP OUT");
disable loop_pop;
end // if
stk_addr = returnto_stk[stack_pointer];
stack_pointer = stack_pointer - 1;
end
endtask // pop_stack
//-----------------------------
// Command Memory Procedures --
//-----------------------------
task build_cmd;
output [1:`max_cmd_size*8] ret_str;
input [1:`token_size*8] cmd_str;
input [1:`token_size*8] orig_str;
begin
case (cmd_str)
"func_end" : ret_str = {"func_end","(",orig_str,")",";"};
"declare_var" : ret_str = {"declare_var","(",orig_str,")",";"};
"call" : ret_str = {"call","(",orig_str,")",";"};
"assign_var" : ret_str = {"assign_var","(",orig_str,")",";"};
"func_beg" : ret_str = {"func_beg","(",orig_str,")",";"};
endcase
if ((!(msg_level < `debug_cmd_mem))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"BUILD_CMD: ret_str = %0s", ret_str);
$display("\"");
end // if
end
endtask // build_cmd
task set_addr_tbl_elmnt;
input [1:`token_size*8] name;
input [31:0] val;
output found;
integer i;
reg [1:`token_size*8] tmpname;
reg [1:1088] tmp_elmnt;
begin
tmpname = name;
begin : loop_set
if (addr_tbl_counter > addr_tbl_size) begin
$display("WARNING at %0t from %m", $time);
$write(" \"SET_ADDR_TBL_ELMNT: Array \"addr_tbl\" is full, increase \"addr_tbl_size\" parameter ");
$display("\"");
disable loop_set;
end // if
for (i = 1; i <= addr_tbl_size; i = i + 1) begin
tmp_elmnt = addr_tbl[i];
if (tmp_elmnt[1:1024] === tmpname) begin
if (tmp_elmnt[1057:1088] !== active) begin
bfm_msg("SET_ADDR_TBL_ELMNT: status of element is not active" ,`warnings,msg_level);
end // if
tmp_elmnt[1025 : 1056] = val;
found = `true;
addr_tbl[i] = tmp_elmnt;
disable loop_set;
end
else if (tmp_elmnt[1:1024] === nul_token) begin
//first empty location
tmp_elmnt[1:1024] = tmpname;
tmp_elmnt[1025:1056] = val;
tmp_elmnt[1057:1088] = active;
addr_tbl[i] = tmp_elmnt;
addr_tbl_counter = i;
found = `false;
disable loop_set;
end // if
end // loop
end // loop_set
end
endtask // set_addr_tbl_elmnt
task get_addr_tbl_elmnt;
//-- input addr_tbl
input [1:`token_size*8] name;
inout [31:0] val;
output found;
integer i;
reg [1:`token_size*8] tmpname;
reg [1:1088] tmp_elmnt;
begin
tmpname = name;
found = `false;
begin : loop_get
for (i = 1; i <= addr_tbl_size; i = i + 1) begin
tmp_elmnt = addr_tbl[i];
if (tmp_elmnt[1:1024] === tmpname) begin
if (tmp_elmnt[1057:1088] !== active) begin
bfm_msg("GET_ADDR_TBL_ELMNT: status of element is not active" ,`warnings,msg_level);
end // if
val = tmp_elmnt[1025:1056];
found = `true;
disable loop_get;
end // if
end // loop
if ((!(msg_level < `warnings))) begin
$display("WARNING at %0t from %m", $time);
$write(" \"GET_ADDR_TBL_ELMNT: %0s not found in table",tmpname);
$display("\"");
end // if
end // loop_get
end
endtask // get_addr_tbl_elmnt
task set_var_tbl_elmnt;
input [1:`token_size*8] name;
input [31:0] val;
output found;
integer i;
reg [1:`token_size*8] tmpname;
reg [1:1088] tmp_elmnt;
begin
tmpname = name;
begin : loop_set
if (var_tbl_counter > var_tbl_size) begin
$display("WARNING at %0t from %m", $time);
$write(" \"SET_VAR_TBL_ELMNT: Array \"var_tbl\" is full, increase \"var_tbl_size\" parameter ");
$display("\"");
disable loop_set;
end // if
for (i = 1; i <= var_tbl_size; i = i + 1) begin
tmp_elmnt = var_tbl[i];
if (tmp_elmnt[1:1024] === tmpname) begin
if (tmp_elmnt[1057:1088] !== active) begin
bfm_msg("SET_VAR_TBL_ELMNT: status of element is not active" ,`warnings,msg_level);
end // if
tmp_elmnt[1025:1056] = val;
found = `true;
var_tbl[i] = tmp_elmnt;
disable loop_set;
end
else if (tmp_elmnt[1:1024] === nul_token) begin
//first empty location
tmp_elmnt[1:1024] = tmpname;
tmp_elmnt[1025:1056] = val;
tmp_elmnt[1057:1088] = active;
addr_tbl[i] = tmp_elmnt;
var_tbl_counter = i;
found = `false;
disable loop_set;
end // if
end // loop
end // loop_set
end
endtask // set_var_tbl_elmnt
task get_var_tbl_elmnt;
//-- input var_tbl
input [1:`token_size*8] name;
inout [31:0] val;
output found;
integer i;
reg [1:`token_size*8] tmpname;
reg [1:1088] tmp_elmnt;
begin
tmpname = name;
found = `false;
begin : loop_get
for (i = 1; i <= var_tbl_size; i = i + 1) begin
tmp_elmnt = var_tbl[i];
if (tmp_elmnt[1:1024] === tmpname) begin
if (tmp_elmnt[1057:1088] !== active) begin
bfm_msg("GET_VAR_TBL_ELMNT: status of element is not active" ,`warnings,msg_level);
end // if
val = tmp_elmnt[1025:1056];
found = `true;
disable loop_get;
end // if
end // loop
if ((!(msg_level < `warnings))) begin
$display("WARNING at %0t from %m", $time);
$write(" \"GET_VAR_TBL_ELMNT: %0s not found in table",tmpname);
$display("\"");
end // if
end // loop_get
end
endtask // get_var_tbl_elmnt
task addelement;
//--inout cmd_mem
input [cbfield1:cbfield2] value;
output [31:0] idx;
output valid_f;
begin
valid_f = `true;
begin : loop_add
// check, whether we have space in the array
if ((cmd_mem_counter > initial_max_cmd_mem_size) && (!(msg_level < `warnings))) begin
$display("WARNING at %0t from %m", $time);
$display(" \"Internal Command Memory overflow while reading in command file/buffering remote commands;");
$display(" Internal memory size may be increased using the \" initial_max_cmd_mem_size \" parameter,");
$display(" Command file/buffer truncated, continuing simulation ...\"");
valid_f = `false;
disable loop_add;
end // if
cmd_mem[cmd_mem_counter + 1] = value;
cmd_mem_counter = cmd_mem_counter + 1;
idx = cmd_mem_counter;
end // loop_add
end
endtask // addelement
task get_mem_cmd;
output [ctrl_store1:ctrl_store2] retcmd;
input [31:0] cmd_addr;
output valid_get_f;
reg [cbfield1:cbfield2] tmp_msg;
begin
//get string at addr
//convert variables(compare to names in var_tbl) to actuals of current value
//call to_fm_data_in
valid_get_f = `false;
if ((cmd_addr <= max_cmd_mem_size) && (cmd_addr >= 1)) begin
tmp_msg = cmd_mem[cmd_addr];
if (tmp_msg[cbmsg1:cbmsg2] !== "") begin
valid_get_f = `true;
retcmd[cbfield1:cbfield2] = cmd_mem[cmd_addr];
cmd_mem_hold = cmd_mem[cmd_addr];
timing.to_fm_data_in(cmd_mem_hold[cbmsg1:cbmsg2], msg_level);
retcmd[fmfield1:fmfield2] = timing.wk_cmd;
This page: |
Created: | Thu Aug 19 11:57:02 1999 |
| From: |
../../../sparc_v8/system/lmc/rtl/pcimaster_fm.v
|