Verification Engineerの戯言
前回、vmm_vxc_managerクラスのrunタスクの内容をみました。
今回は、runタスクのvmm_xvc_tcl_execute_file関数をみていきます。
vmm_xvc_tcl_execute_file関数は、vmm_xvc_manager.svファイルにはありません。
今回は、runタスクのvmm_xvc_tcl_execute_file関数をみていきます。
vmm_xvc_tcl_execute_file関数は、vmm_xvc_manager.svファイルにはありません。
vmm_xvc_tcl_execute_file関数は、次のようにvmm_xvc_dpi.cファイルにC言語で実装されています。
シミュレータの引数に+vmm_path=XXXXでパスを設定すれば、その値を使います。設定しなければ、環境変数VCS_HOME/etc/vmmmになります。
VCS_HOMEが設定されていないとエラーになり、アボートします。
ユーザーTCL関数を登録(xvc_register_tcl_functions)し、テストシナリオファイルを読み込みます(Tcl_Eval)。
VCS_HOMEが設定されていないとエラーになり、アボートします。
void vmm_xvc_tcl_execute_file(char *test_file) { int tcl_error; char xvc_home_path[200]; char *xvc_tcl_utils_file_fullpath; char xvc_tcl_cmd_buf[1000]; /* perform creation and inits of the TCL interpreter */ tcl_error = xvc_tcl_init(); if (tcl_error != TCL_OK) { io_printf("Error in initialization of TCL for VMM xvc manager\n"); abort(); } /* Source the startup script */ /* Check for +vmm_path=%s string, if present, it overrides VCS_HOME/etc/vmm as the location to pickup the vmm_xvc_parse.tcl initialization file */ if (mc_scan_plusargs("vmm_path")) { char *str; str = mc_scan_plusargs("vmm_path") + 1; strcpy(xvc_home_path,str); strcat(xvc_home_path,"/"); } else { /* get VCS_HOME env. variable */ char *vcs_home_path; vcs_home_path = getenv("VCS_HOME"); if (vcs_home_path == NULL) { io_printf("VCS_HOME env. variable not set, needed for xvc manager\n"); abort(); } strcpy(xvc_home_path,vcs_home_path); strcat(xvc_home_path,"/etc/vmm/"); } }後半部は、VXCのホームディレクトリからTCLのコマンドファイルvmm_xvc_parse.tclを読み込み(Tcl_EvalFile)、
ユーザーTCL関数を登録(xvc_register_tcl_functions)し、テストシナリオファイルを読み込みます(Tcl_Eval)。
//ToDo: Error out if xvc_home_path is NULL xvc_tcl_utils_file_fullpath = strcat(xvc_home_path, "vmm_xvc_parse.tcl"); tcl_error = Tcl_EvalFile(xvc_tcl_interp, xvc_tcl_utils_file_fullpath); if (tcl_error != TCL_OK) { io_printf("Error: xvc manager: could not eval file%s\n", xvc_tcl_utils_file_fullpath); io_printf(" Either +vmm_path=<str> or VCS_HOME env. variable needs to be provided\n"); abort(); } /* register user TCL functions */ xvc_register_tcl_functions(); //execute the parse-start command from C sprintf(xvc_tcl_cmd_buf, "execute_file %s", test_file); tcl_error = Tcl_Eval(xvc_tcl_interp, xvc_tcl_cmd_buf); if (tcl_error != TCL_OK) { io_printf("Error: xvc manager: in executing file %s: File does not exist ?\n", test_file); abort(); } }ここまでのポイントは!
1)、テストシナリオファイルの解析は、TCLで行っている 2)、+vmm_pathを指定するか?VCS_HOME環境変数を設定する。
検証、Verification、SystemVerilog、VMM、Verification Methodology Manual