Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Generics Specman-如何将测试更改为更通用的测试?_Generics_Parameters_Verification_Specman - Fatal编程技术网

Generics Specman-如何将测试更改为更通用的测试?

Generics Specman-如何将测试更改为更通用的测试?,generics,parameters,verification,specman,Generics,Parameters,Verification,Specman,我有一个测试名为test_dpwm 该测试包含一些代码,如“ 我想为另一个dpwm模块创建完全相同的测试,它称为aux_dpwm…所以每个“dpwm”都将是“aux_dpwm”。 例如,上述代码将变为: event aux_dpwm_clk_e is rise (driver.lv_top_env.smp.port_aux_dpwm_clk$)@sim; event tc_e is rise (driver.lv_top_env.smp.port_tc$)@aux_dpwm_cl

我有一个测试名为test_dpwm

该测试包含一些代码,如“

我想为另一个dpwm模块创建完全相同的测试,它称为aux_dpwm…所以每个“dpwm”都将是“aux_dpwm”。 例如,上述代码将变为:

    event aux_dpwm_clk_e is rise (driver.lv_top_env.smp.port_aux_dpwm_clk$)@sim;
    event tc_e is rise (driver.lv_top_env.smp.port_tc$)@aux_dpwm_clk_e;

    body()@driver.clock is only {

        message(LOW,"Configure Modules wait states");
        do CONFIG_WAIT_STATE seq keeping {.module=="AUX_DPWM_CNT";      .wait_state in [0..3];};
.....
......

        do EN_AUX_DPWM_CNT seq keeping {.en==1;};
        do AUX_DPWM_TEST seq keeping {.aux_dpwm_idx==0; .hw_en==hw_en; .num_of_cycles==num_of_cycles;};

...
..};

有没有什么通用的方法可以通过param或其他方法来实现这一点?

您可以使用宏轻松地实现这一点。 为简单起见,我将忽略以下事实:在您的示例中,有几个地方使用了名称的大写变体,然后一个简单的
define as
宏就足够了。通过一些其他技巧(可能还涉及
define as computed
宏),也可以处理大写的用法

define <my_test'struct_member> "my_test <module'name>" as {
    event <module'name>_clk_e is rise (driver.lv_top_env.smp.port_<module'name>_clk$)@sim;
    event tc_e is rise (driver.lv_top_env.smp.port_tc$)@<module'name>_clk_e;

    body()@driver.clock is only {

        message(LOW,"Configure Modules wait states");
        do CONFIG_WAIT_STATE seq keeping {.module=="<module'name>_CNT";      .wait_state in [0..3];};
.....
......

        do EN_<module'name>_CNT seq keeping {.en==1;};
        do <module'name>_TEST seq keeping {.<module'name>_idx==0; .hw_en==hw_en; .num_of_cycles==num_of_cycles;};

...
    };
};
或:

等等

define <my_test'struct_member> "my_test <module'name>" as {
    event <module'name>_clk_e is rise (driver.lv_top_env.smp.port_<module'name>_clk$)@sim;
    event tc_e is rise (driver.lv_top_env.smp.port_tc$)@<module'name>_clk_e;

    body()@driver.clock is only {

        message(LOW,"Configure Modules wait states");
        do CONFIG_WAIT_STATE seq keeping {.module=="<module'name>_CNT";      .wait_state in [0..3];};
.....
......

        do EN_<module'name>_CNT seq keeping {.en==1;};
        do <module'name>_TEST seq keeping {.<module'name>_idx==0; .hw_en==hw_en; .num_of_cycles==num_of_cycles;};

...
    };
};
    my_test dpwm;
    my_test aux_dpwm;