Vengineerの妄想(準備期間)

人生は短いけど、長いです。人生を楽しみましょう!

vmm_vxc_managerクラスの実装(その8)

Verification Engineerの戯言

EXECUTEコマンドで実行するシナリオIDは、SCENARIOコマンドで登録します。
SCENARIOコマンドを解釈するtry_scenario関数を見てみましょう!
    function bit vmm_xvc_manager::try_scenario();
        if (this.argv[0].tolower() != "scenario") begin
            return 0;
        end
        try_scenario = 1;
        //put out any messages caught in the parser
        if (this.errMsg.len() > 0) begin
            `vmm_fatal(this.log, this.errMsg);
            return 1;
        emd
        
        if (this.current_sc != null) begin
            this.save_scenario(this.current_sc);
            this.current_sc = null;  
        end      
前半は、EXECUTEコマンドと同様に、コマンドのチェックです。
        this.current_sc = this.lookup_scenario(this.argv[1]);
        if (this.current_sc != null) begin
            `vmm_fatal(this.log, 
                       $psprintf("%s, line %0d: Scenario \"%s\" already defined at %s, line %0d",
                                 this.testfile, 
                                 this.linec, 
                                 this.argv[1],
                                 this.current_sc.testfile, 
                                 this.current_sc.linec)
                       );
            this.current_sc = null;
            return 1;
        end
        this.current_sc = new(this.argv[1]);
        if (this.argv.size() == 3)
            this.current_sc.descr = this.argv[2];
        else
            $sformat(this.current_sc.descr,
                     "Unnamed Scenario:%s[%0d]",
                     this.testfile, 
                     this.linec);
        this.current_sc.testfile = this.testfile;
        this.current_sc.linec    = this.linec;

    endfunction: try_scenario
後半では、シナリオIDをチェックし、まだ登録されていないときは、this.current_scを新しく生成します。
そして、this.current_scに次のような設定を行います。
        this.current_sc          = new(this.argv[1]);
        this.current_sc.descr    = this.argv[2]
        this.current_sc.testfile = this.testfile;
        this.current_sc.linec    = this.linec;
たとえば、
    scenario 2 "This is scenario 2"
のコマンドでは、descr2を設定します。
また、testfileにこの記述があるファイル名を、linecにライン番号を設定します。
なお、これら設定値は、デバッグ用途です。

SCENARIOコマンドに続く記述がこのシナリオIDで実行するアクション(action)等になります。
次回は、ACTIONコマンドを、その次はINTERRUPTコマンドを見ていきます。

検証、Verification、SystemVerilog、VMM、Verification Methodology Manual