URL
https://opencores.org/ocsvn/sv_dir_tb/sv_dir_tb/trunk
Subversion Repositories sv_dir_tb
[/] [sv_dir_tb/] [trunk/] [sv/] [cmd_lst.sv] - Rev 2
Compare with Previous | Blame | View Log
//////////////////////////////////////////////////////////////////////////////// Copyright 2014 Ken Campbell//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at//// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.///////////////////////////////////////// command list classclass cmd_lst;tb_cmd lst_cmds;lst_item file_lst;lst_item var_lst;lst_item inst_lst;integer lst_sz;integer lst_idx;integer last_idx;integer curr_line_num;string file_name;string include_name;integer call_stack [8:1];integer call_index = 0;integer loop_cnt [7:0];integer loop_term [7:0];integer loop_line [7:0];integer loop_num = 0;integer if_state = 0;integer wh_state = 0;integer wh_top = 0;//prototypesextern function void define_instruction(string inst_txt, int args);extern function void define_defaults();extern function void load_stm(string stm_file);extern function void load_include();extern function void add_cmd(tb_cmd cmd);extern function void check_cmds();extern function tb_trans get(tb_trans inst);extern function integer exec_defaults(tb_trans r);extern function new();extern function void print_cmds();extern function void print_str();extern function void print_str_wvar();endclass // cmd_lst////////////////////////////////////////////////////////////////////////////////////////// method definitions.///////////////////////////////////////////////////////////// function cmd_lst::newfunction cmd_lst::new();lst_cmds = new();file_lst = new("Files");var_lst = new("Variables");inst_lst = new("Instructions");lst_sz = 0;lst_idx = 0;last_idx = 0;curr_line_num = 0;file_name = "";include_name = "";endfunction // new///////////////////////////////////////////////////////////// function cmd_lst::getfunction tb_trans cmd_lst::get(tb_trans inst);tb_trans rtn;cmd_lst tmp_cmd;lst_item tmp_item;integer int_val;integer tmp_int;integer len;string tmp_str;rtn = inst;rtn.rtn_val.par1 = 0;rtn.rtn_val.par2 = 0;rtn.rtn_val.par3 = 0;rtn.rtn_val.par4 = 0;rtn.rtn_val.par5 = 0;rtn.rtn_val.par6 = 0;if(rtn.next > rtn.cmd.lst_cmds.idx) beginwhile (rtn.next > rtn.cmd.lst_cmds.idx && rtn.cmd.lst_cmds != null) beginrtn.cmd.lst_cmds = rtn.cmd.lst_cmds.next;check_get_next : assert (rtn.cmd.lst_cmds != null) else begin$fatal(0, "cmd_lst::get failed due to attemped access to commands behond the end of the script.");endendend else if (rtn.next < rtn.cmd.lst_cmds.idx) beginwhile (rtn.next < rtn.cmd.lst_cmds.idx && rtn.cmd.lst_cmds != null) beginrtn.cmd.lst_cmds = rtn.cmd.lst_cmds.prev;check_get_prev : assert (rtn.cmd.lst_cmds != null) else begin$fatal(0, "cmd_lst::get failed due to attemped access to commands before the beginning of the script.");endendendrtn.rtn_val.cmd = rtn.cmd.lst_cmds.cmd;for (int i = 1; i <= rtn.cmd.lst_cmds.valid_fld - 1; i++) begincase (i)1: tmp_str = rtn.cmd.lst_cmds.var1;2: tmp_str = rtn.cmd.lst_cmds.var2;3: tmp_str = rtn.cmd.lst_cmds.var3;4: tmp_str = rtn.cmd.lst_cmds.var4;5: tmp_str = rtn.cmd.lst_cmds.var5;6: tmp_str = rtn.cmd.lst_cmds.var6;default: $display("ERROR: more than six parameters ????");endcasetmp_int = is_var(tmp_str);if (tmp_int == 0) begintmp_int = stm2_int(tmp_str);end else if (tmp_int == 1) beginlen = tmp_str.len();tmp_str = tmp_str.substr(1, len - 1);tmp_item = rtn.cmd.var_lst.find(tmp_str);tmp_int = tmp_item.val;end else if (tmp_int == 2) begintmp_item = rtn.cmd.var_lst.find(tmp_str);tmp_int = tmp_item.index;end else if (tmp_int == 3) begincase (tmp_str)"==" : tmp_int = 0;"!=" : tmp_int = 1;">" : tmp_int = 2;"<" : tmp_int = 3;">=" : tmp_int = 4;"<=" : tmp_int = 5;default : $display("Condition text not found ???");endcaseend else begin$display("is_var() returned an unknown value???");endcase (i)1: rtn.rtn_val.par1 = tmp_int;2: rtn.rtn_val.par2 = tmp_int;3: rtn.rtn_val.par3 = tmp_int;4: rtn.rtn_val.par4 = tmp_int;5: rtn.rtn_val.par5 = tmp_int;6: rtn.rtn_val.par6 = tmp_int;default: $display("ERROR: more than six parameters ????");endcaseendreturn rtn;endfunction///////////////////////////////////////////////////////////// function cmd_lst::define_instructionfunction void cmd_lst::define_instruction(string inst_txt, int args);lst_item tmp_lst;lst_item new_itm;integer stat = 0;// search the list for this instructiontmp_lst = new("");tmp_lst = this.inst_lst;while(tmp_lst != null) beginif(tmp_lst.txt != inst_txt) begintmp_lst = tmp_lst.next;end else begincheck_duplicate_inst : assert (0) else begin$fatal(0, "Duplicate instruction definition attempted : %s", inst_txt);end//$display("ERROR: Duplicate instruction definition attempted : %s", inst_txt);//stat = 1;//return stat;endend// all good lets add this instruction to the listnew_itm = new("");new_itm.txt = inst_txt;new_itm.val = args;inst_lst.add_itm(new_itm);//return stat;endfunction // define_instruction/////////////////////////////////////////////////////////// function cmd_lst::add_cmd// INPUT: tb_cmd cmdfunction void cmd_lst::add_cmd(tb_cmd cmd);tb_cmd tmp_cmd;tb_cmd new_cmd;integer stat = 0;tmp_cmd = new();tmp_cmd = this.lst_cmds;// firstif((this.lst_cmds.next == null) && (this.lst_cmds.cmd == "")) beginnew_cmd = new();new_cmd = cmd;new_cmd.idx = 0;this.lst_cmds = new_cmd;// secondend else if(this.lst_cmds.next == null) beginnew_cmd = new();new_cmd = cmd;new_cmd.idx = 1;tmp_cmd.next = new_cmd;new_cmd.prev = tmp_cmd;// restend else beginwhile (tmp_cmd.next != null) begintmp_cmd = tmp_cmd.next;endnew_cmd = new();new_cmd = cmd;new_cmd.idx = tmp_cmd.idx + 1;tmp_cmd.next = new_cmd;new_cmd.prev = tmp_cmd;endthis.lst_sz++;this.last_idx = new_cmd.idx;endfunction/////////////////////////////////////////////////////////// function cmd_lst::load stimulusfunction void cmd_lst::load_stm(string stm_file);tb_cmd new_cmd;tb_cmd tst_cmd;integer in_fh;integer stat = 0;integer fstat = 0;integer idx = 0;integer len;integer i, ilen;string input_str;string tstr;lst_item tmp_item;// open the file passed and test for existance.in_fh = $fopen(stm_file, "r");check_file_open : assert (in_fh != 0) else begin$fatal(0, "ERROR: File not found in cmd_lst::load_stm : %s", stm_file);endthis.file_name = stm_file;// this is the main file, add to file list.tmp_item = new("");tmp_item.txt = stm_file;file_lst.add_itm(tmp_item);this.curr_line_num = 0;// new the test results storage ...tmp_item = new("");while (! $feof(in_fh)) beginfstat = $fgets(input_str, in_fh);// increment the line numberthis.curr_line_num++;tst_cmd = new();if (input_str == "\n" || input_str == "")continue;// check for special commands DEFINE_VAR and INCLUDEtst_cmd = tst_cmd.parse_cmd(input_str);len = tst_cmd.cmd.len();if (tst_cmd.cmd == "DEFINE_VAR") begintmp_item.txt = tst_cmd.var1;tmp_item.val = stm2_int(tst_cmd.var2);var_lst.add_itm(tmp_item);// check for INCLUDE file defend else if (tst_cmd.cmd == "INCLUDE") beginif(tst_cmd.var1 != "") beginthis.include_name = tst_cmd.var1;end else if (tst_cmd.cmd_str != "") begintstr = tst_cmd.cmd_str;ilen = tstr.len();i = ilen-1;// strip any trailing spaceswhile(tstr[i] == " ") begintstr = tstr.substr(0,i-1);i--;endthis.include_name = tstr;end else begincheck_include : assert (0) else begin$fatal(0, "No INCLUDE file found in command on\n line: %4d in file: %s", curr_line_num, stm_file);endendthis.load_include();// check for inline variable.end else if(tst_cmd.cmd[len-1] == ":") begintmp_item.txt = tst_cmd.cmd.substr(0, len-2);tmp_item.val = this.last_idx + 1;var_lst.add_itm(tmp_item);// else is a standard commandend else begin// parse out the commandnew_cmd = new();new_cmd = new_cmd.parse_cmd(input_str);if (new_cmd.valid_fld > 0) beginnew_cmd.line_num = curr_line_num;new_cmd.file_idx = 0;this.add_cmd(new_cmd);endendend // while (! $feof(in_fh))check_cmds();endfunction // load_stm//////////////////////////////////////////////////////// function cmd_lst::load_includefunction void cmd_lst::load_include();tb_cmd tmp_cmd;tb_cmd new_cmd;tb_cmd tst_cmd;integer inc_fh;integer stat = 0;integer idx = 0;string input_str;lst_item tmp_item;lst_item var_item;integer file_idx;integer len;integer file_line = 0;// open the file passed and test for existance.inc_fh = $fopen(this.include_name, "r");check_include_open : assert(inc_fh != 0) else begin$fatal(0, "INCLUDE File not found: %s\nFound in file: %s\nOn line: %4d", this.include_name, this.file_name, this.curr_line_num);end// this is an include file, add to list.tmp_item = new("");tmp_item.txt = this.include_name;file_lst.add_itm(tmp_item);tmp_item = file_lst.find(this.include_name);file_idx = tmp_item.index;// new the test results storage ...var_item = new("");while (! $feof(inc_fh)) beginfile_line++;stat = $fgets(input_str, inc_fh);tst_cmd = new();// skip blank linesif (input_str == "\n" || input_str == "")continue;// check for special commands DEFINE_VAR, INCLUDE and inline variablestst_cmd = tst_cmd.parse_cmd(input_str);len = tst_cmd.cmd.len();// DEFINE_VARif (tst_cmd.cmd == "DEFINE_VAR") beginvar_item.txt = tst_cmd.var1;var_item.val = stm2_int(tst_cmd.var2);var_lst.add_itm(var_item);continue;// INCLUDE Not nested.end else if (tst_cmd.cmd == "INCLUDE") begincheck_nest_include : assert (0) else begin$fatal(0, "INCLUDE can not be nested!!\nFound in file: %s\nOn line: %4d", this.include_name, file_line);end// In line VARend else if (tst_cmd.cmd[len - 1] == ":") beginvar_item.txt = tst_cmd.cmd.substr(0, len-2);var_item.val = this.last_idx + 1;var_lst.add_itm(var_item);continue;end// parse out the commandnew_cmd = new();new_cmd = new_cmd.parse_cmd(input_str);if (new_cmd.valid_fld > 0) beginnew_cmd.file_idx = file_idx;new_cmd.line_num = file_line;this.add_cmd(new_cmd);endend // while (! $feof(inc_fh))endfunction // load_include////////////////////////////////////////////////////////////// function check_cmds// checks that the commands loaded exist, have correct # params and// variable names existfunction void cmd_lst::check_cmds();tb_cmd tmp_cmd;tb_cmd dum;int found;string cname;string fname;string t_var;byte c;int num_params;lst_item tmp_lst;lst_item flst;lst_item tmp_item;integer stat = 0;integer file_idx;integer len;integer vtype;tmp_cmd = this.lst_cmds;// go through all the commands from the stimulus file.while(tmp_cmd != null) begincname = tmp_cmd.cmd;num_params = tmp_cmd.valid_fld;tmp_lst = this.inst_lst;found = 0;// get the file name from this commandfile_idx = tmp_cmd.file_idx;flst = this.file_lst;while (flst != null) beginif(flst.index == file_idx) beginfname = flst.txt;endflst = flst.next;end// go through the list of valid commandswhile (tmp_lst != null && found == 0) beginif (tmp_lst.txt == cname) beginfound = 1;check_num_params : assert ((tmp_lst.val == num_params - 1) || (tmp_lst.val >= 7)) else begin$fatal(0, "Incorrect number of parameters found in command on\n line: %4d in file: %s", tmp_cmd.line_num, fname);endendtmp_lst = tmp_lst.next;end// if we did not find a commandcheck_valid_instruction : assert (found != 0) else begin$fatal(0, "Command %s was not found in the list of valid commands on\n line: %4d in file: %s", cname, tmp_cmd.line_num, fname);end// Check the line for invalid variable namesif(num_params != 0) begintmp_lst = this.var_lst;for (int i = 1; i <= num_params - 1; i++) begincase (i)1: t_var = tmp_cmd.var1;2: t_var = tmp_cmd.var2;3: t_var = tmp_cmd.var3;4: t_var = tmp_cmd.var4;5: t_var = tmp_cmd.var5;6: t_var = tmp_cmd.var6;default: $display("ERROR: num_params greater than six???");endcasec = t_var[0];vtype = is_var(t_var);if(vtype) beginif(c == "$") beginlen = t_var.len();t_var = t_var.substr(1, len - 1);end// if condition operator skipif(vtype == 3) begincontinue;endend else begincontinue;endtmp_item = var_lst.find(t_var);check_valid_variable : assert (tmp_item != null) else begin$fatal(0, "Variable number: %2d >>> %s <<< on line %4d in file: %s Is NOT defined!!", i, t_var, tmp_cmd.line_num, fname);endendendtmp_cmd = tmp_cmd.next;endendfunction // cmd_lst::check_cmds///////////////////////////////////////////////////////////////function void cmd_lst::define_defaults();this.define_instruction("ABORT", 0);this.define_instruction("FINISH", 0);this.define_instruction("EQU_VAR", 2);this.define_instruction("ADD_VAR", 2);this.define_instruction("SUB_VAR", 2);this.define_instruction("CALL", 1);this.define_instruction("RETURN_CALL", 0);this.define_instruction("JUMP", 1);this.define_instruction("LOOP", 1);this.define_instruction("END_LOOP", 0);this.define_instruction("IF", 3);this.define_instruction("ELSEIF", 3);this.define_instruction("ELSE", 0);this.define_instruction("END_IF", 0);this.define_instruction("WHILE", 3);this.define_instruction("END_WHILE", 0);endfunction // define_defaults/////////////////////////////////////////////////////////////////////function integer cmd_lst::exec_defaults(tb_trans r);integer rtn = 0;lst_item tmp_item;integer idx = 0;string cmd_string;// get the command stringcmd_string = r.cmd.lst_cmds.cmd;// output the dynamic text if there is some. (Note: before command runs.)r.cmd.print_str_wvar();/// The Main else if chain /////////////////////////////////////////////////// ABORTif(cmd_string == "ABORT") begin$display("The test has aborted due to an error!!");$finish(2);rtn = 1;///////////////////////////////////////////////////////////////////////////// FINISHend else if (cmd_string == "FINISH") begin$display("Test Finished with NO error!!");$finish();rtn = 1;///////////////////////////////////////////////////////////////////////////// ADD_VARend else if (cmd_string == "ADD_VAR") begintmp_item = this.var_lst.get(r.rtn_val.par1);idx = tmp_item.index;tmp_item.val = tmp_item.val + r.rtn_val.par2;r.cmd.var_lst.set(idx, tmp_item.val);rtn = 1;///////////////////////////////////////////////////////////////////////////// SUB_VARend else if (cmd_string == "SUB_VAR") begintmp_item = this.var_lst.get(r.rtn_val.par1);idx = tmp_item.index;tmp_item.val = tmp_item.val - r.rtn_val.par2;r.cmd.var_lst.set(idx, tmp_item.val);rtn = 1;///////////////////////////////////////////////////////////////////////////// EQU_VARend else if (cmd_string == "EQU_VAR") begintmp_item = this.var_lst.get(r.rtn_val.par1);idx = tmp_item.index;tmp_item.val = r.rtn_val.par2;r.cmd.var_lst.set(idx, tmp_item.val);rtn = 1;///////////////////////////////////////////////////////////////////////////// CALLend else if (cmd_string == "CALL") begincall_index++;check_call_depth : assert(call_index <= 8) else begin$fatal(0,"CALL nesting depth maximum is 7. On Line: %4d", r.cmd.lst_cmds.line_num);endcall_stack[call_index] = r.cmd.lst_cmds.idx + 1;r.next = r.rtn_val.par1;rtn = 1;///////////////////////////////////////////////////////////////////////////// RETURN_CALLend else if (cmd_string == "RETURN_CALL") begincheck_call_under_run : assert(call_index > 0) else begin$fatal(0,"RETURN_CALL causing nesting underflow?. On Line: %4d", r.cmd.lst_cmds.line_num);endr.next = call_stack[call_index];call_index--;rtn = 1;///////////////////////////////////////////////////////////////////////////// JUMPend else if (cmd_string == "JUMP") beginr.next = r.rtn_val.par1;call_index = 0;rtn = 1;///////////////////////////////////////////////////////////////////////////// LOOPend else if (cmd_string == "LOOP") beginloop_num++;loop_line[loop_num] = r.cmd.lst_cmds.idx + 1;loop_cnt[loop_num] = 0;loop_term[loop_num] = r.rtn_val.par1;rtn = 1;///////////////////////////////////////////////////////////////////////////// END_LOOPend else if (cmd_string == "END_LOOP") beginloop_cnt[loop_num]++;if(loop_cnt[loop_num] == loop_term[loop_num]) beginloop_num--;r.next = r.cmd.lst_cmds.idx + 1;end else beginr.next = loop_line[loop_num];endrtn = 1;///////////////////////////////////////////////////////////////////////////// IFend else if (cmd_string == "IF") beginif_state = 0;case (r.rtn_val.par2)0: if(r.rtn_val.par1 == r.rtn_val.par3) if_state = 1;1: if(r.rtn_val.par1 != r.rtn_val.par3) if_state = 1;2: if(r.rtn_val.par1 > r.rtn_val.par3) if_state = 1;3: if(r.rtn_val.par1 < r.rtn_val.par3) if_state = 1;4: if(r.rtn_val.par1 >= r.rtn_val.par3) if_state = 1;5: if(r.rtn_val.par1 <= r.rtn_val.par3) if_state = 1;default: if_op_error : assert (0) else begin$fatal(0, "IF statement had unknown operator in par2. On Line: %4d", r.cmd.lst_cmds.line_num);endendcaseif (!if_state) beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;while(cmd_string != "ELSE" && cmd_string != "ELSEIF" && cmd_string != "END_IF") beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;check_if_end : assert (r.cmd.lst_cmds.next != null) else begin$fatal(0,"Unable to find terminating element for IF statement!!");endendr.next--;endrtn = 1;///////////////////////////////////////////////////////////////////////////// ELSEIFend else if (cmd_string == "ELSEIF") beginif(if_state) beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;while(cmd_string != "END_IF") beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;check_elseif_statement : assert (r.cmd.lst_cmds.next != null) else begin$fatal(0,"Unable to find terminating element for ESLEIF statement!!");endendr.next--;end else begincase (r.rtn_val.par2)0: if(r.rtn_val.par1 == r.rtn_val.par3) if_state = 1;1: if(r.rtn_val.par1 != r.rtn_val.par3) if_state = 1;2: if(r.rtn_val.par1 > r.rtn_val.par3) if_state = 1;3: if(r.rtn_val.par1 < r.rtn_val.par3) if_state = 1;4: if(r.rtn_val.par1 >= r.rtn_val.par3) if_state = 1;5: if(r.rtn_val.par1 <= r.rtn_val.par3) if_state = 1;default: elseif_op_error : assert (0) else begin$fatal(0, "ELSEIF statement had unknown operator in par2. On Line: %4d", r.cmd.lst_cmds.line_num);endendcaseif (!if_state) beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;while(cmd_string != "ELSE" && cmd_string != "ELSEIF" && cmd_string != "END_IF") beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;check_elseif_end : assert (r.cmd.lst_cmds.next != null) else begin$fatal(0,"Unable to find terminating element for IF statement!!");endendr.next--;endendrtn = 1;///////////////////////////////////////////////////////////////////////////// ELSEIFend else if (cmd_string == "ELSE") beginif(if_state) beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;while(cmd_string != "END_IF") beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;check_else_statement : assert (r.cmd.lst_cmds.next != null) else begin$fatal(0,"Unable to find terminating element for ELSE statement!!");endendr.next--;endrtn = 1;///////////////////////////////////////////////////////////////////////////// END_IFend else if (cmd_string == "END_IF") beginrtn = 1;// This command is just a place holder, skip to next instruction.///////////////////////////////////////////////////////////////////////////// WHILE non-nested implementationend else if (cmd_string == "WHILE") beginwh_state = 0;wh_top = r.cmd.lst_cmds.idx;case (r.rtn_val.par2)0: if(r.rtn_val.par1 == r.rtn_val.par3) wh_state = 1;1: if(r.rtn_val.par1 != r.rtn_val.par3) wh_state = 1;2: if(r.rtn_val.par1 > r.rtn_val.par3) wh_state = 1;3: if(r.rtn_val.par1 < r.rtn_val.par3) wh_state = 1;4: if(r.rtn_val.par1 >= r.rtn_val.par3) wh_state = 1;5: if(r.rtn_val.par1 <= r.rtn_val.par3) wh_state = 1;default: while_op_error : assert (0) else begin$fatal(0, "WHILE statement had unknown operator in par2. On Line: %4d", r.cmd.lst_cmds.line_num);endendcaseif(!wh_state) beginwhile(cmd_string != "END_WHILE") beginr = r.cmd.get(r);cmd_string = r.cmd.lst_cmds.cmd;r.next++;check_while_statement : assert (r.cmd.lst_cmds.next != null) else begin$fatal(0,"Unable to find terminating element for WHILE statement!!");endendendrtn = 1;///////////////////////////////////////////////////////////////////////////// END_WHILEend else if (cmd_string == "END_WHILE") beginr.next = wh_top;rtn = 1;endreturn rtn;endfunction // exec_defaults// dynamic print function.function void cmd_lst::print_str();if (this.lst_cmds.cmd_str != "") begin$display("%s", this.lst_cmds.cmd_str);endendfunction// dynamic print function with variable sub// output var in HEX.function void cmd_lst::print_str_wvar();integer len;integer vlen;integer v;integer i = 0;integer j = 0;integer val;string sval;string tmp;string tmpv;string vari;string varv;lst_item lvar;if (this.lst_cmds.cmd_str == "") beginreturn;endlen = this.lst_cmds.cmd_str.len();tmp = this.lst_cmds.cmd_str;while (i < len) beginif (tmp[i] == "$") begini++;j = 0;vari = "";while (tmp[i] != " " && i < len) beginvari = {vari,tmp[i]};i++;j++;endlvar = this.var_lst.find(vari);val = lvar.val;// convert var to str$sformat(varv,"%x",val);j = 0;vlen = varv.len();tmpv = varv;// strip pre-paddingwhile(varv[j] == "0" && j < vlen) beginj++;v = tmpv.len();tmpv = tmpv.substr(1, v-1);endsval = {sval, "0x", tmpv};end else beginsval = {sval,tmp[i]};i++;endend$display(sval);endfunction////////////////////////////////////////////////////////////// print commands function: intened for debug and devfunction void cmd_lst::print_cmds();tb_cmd tmp_cmd;tmp_cmd = this.lst_cmds;while(tmp_cmd != null) begintmp_cmd.print();tmp_cmd = tmp_cmd.next;end//tmp_cmd.print();$display("List Size: %s", this.lst_sz);$display();$display();endfunction // print_cmds
