VMM TEST「建议收藏」

VMM TEST「建议收藏」vmm_testisintroducedinvmm1.1.Toknowthevmmversionwhichyouareusing,usethiscommandvcs-R-sverilog-ntb_optsdtm        +incdir+$VMM_HOME/sv$VMM_HOME/sv/vmm_versions.svv

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
vmm_test is introduced in vmm 1.1.

To know the vmm version which you are using, use this command


vcs -R -sverilog -ntb_opts dtm


         +incdir+$VMM_HOME/sv $VMM_HOME/sv/vmm_versions.sv


vmm_test is used for compiling all the testcases in one compilation. The simulation of each testcase is done individually. Traditionally for each testcase, compile and simulation are done per testcase file. With this new approach, which dose compilation only once, will save lot of cup.


Generally each testcase can be divided into two parts.

  Procedural code part.

  The procedural code part (like passing the above new constrained transaction definition to some atomic generator, calling the env methods etc) has to be defined between these macros. vmm provides 2 macros to define testcase procedural part.

 
`vmm_test_begin
(testcase_name
,vmm_env
,
“Test Case Name String”
)

 
`vmm_test_env
(testcase_name
)

  Declarative code part.

  The declarative part( like new constrained transacting definition) is defined outside these macros.


   Writing A Testcase 

  Let us see an example of writing a testcase.


  Inside the testcase, we will define a new transaction and pass this transaction to the atomic generator.


   Declarative part:

1)   Define all the declarative code.

 
class constrained_tran
extends pcie_transaction
;

 
// Add some constraints

 
// Change some method definitions

 
end
class

2) Define a handle to the above object.

  constrained_tran c_tran_obj
;

   Procedural part:

Use a `vmm_test_begin . There are 3 arguments to macro.

VMM TEST「建议收藏」


The first argument is the name of the testcase class and will also be used as the name of the testcase in the global testcase registry.


VMM TEST「建议收藏」


The second argument is the name of the environment class that will be used to execute the testcase. A data member of that type named “env” will be defined and assigned, ready to be used.


VMM TEST「建议收藏」


The third argument is a string documenting the purpose of the test.


 
`vmm_test_begin
(test_1
,vmm_env
,
“Test_1”
)

  In this testcase, we want to pass the c_tran_obj object. The steps t pass the c_tran_obj as per the vmm_env is

  env
.build
();

  c_tran_obj
=
new
(
” “
);

  env
.atomic_gen
.randomized_obj
= c_tran_obj
;

  Start the vmm_env execution.

  env
.run
();

  Now use `vmm_test_end to define the end of the testcase. The argument to this is the testcase name.

 
`vmm_test_end
(test_1
)

Following is the full testcase source code which we discussed above
.


   Testcase source code

 

 
class constrained_tran
extends pcie_transaction
;

 
end
class

  constrained_tran c_tran_obj

`vmm_test_begin
(test_1
,vmm_env
,
“Test_1”
)

  
$display
(
” Start of Testcase :  Test_1 “
);

   env
.build
();

   c_tran_obj
=
new
(
” “
);

   env
.atomic_gen
.randomized_obj
= c_tran_obj
;

   env
.run
();

  
$display
(
” End of Testcase : Test_1 “
);


`vmm_test_end
(test_1
)

Like this you can write many testcases in separate file or single file.

   Example Of Using Vmm_test 

Now we will implement 3 simple testcases and a main testcase which will be used for selecting any one of the 3 testcases.

   testcase_1

Write this testcase in a testcase_1.sv file


// Define all the declarative code hear. I done have anything to show you.


//


//  class constrained_tran extends pcie_transaction;


//


//  end class


//


//  constrained_tran c_tran_obj

`vmm_test_begin
(test_1
,vmm_env
,
“Test_1”
)

  
$display
(
” Start of Testcase :  Test_1 “
);

  
// This is procedural part. You can call build method.

   env
.build
();

  
// You can pass the above created transaction to atomic gen.

  
// c_tran_obj = new(” “);

  
// env.atomic_gen.randomized_obj = c_tran_obj;

  
//

  
//

  

   env
.run
();

  
$display
(
” End of Testcase : Test_1 “
);


`vmm_test_end
(test_1
)

  testcase_2

Write this testcase in a testcase_2.sv file


`vmm_test_begin
(test_2
,vmm_env
,
“Test_2”
)

  
$display
(
” Start of Testcase :  Test_2 “
);

  
// Do something like this ….

   env
.build
();

  
// like this ….

   env
.run
();

  
$display
(
” End of Testcase : Test_2 “
);


`vmm_test_end
(test_2
)

  testcase_3

Write this testcase in a testcase_3.sv file


`vmm_test_begin
(test_3
,vmm_env
,
“Test_3”
)

  
$display
(
” Start of Testcase :  Test_3 “
);

  
// Do something like this ….

   env
.build
();

  
// like this ….

   env
.run
();

  
$display
(
” End of Testcase : Test_3 “
);


`vmm_test_end
(test_3
)

  main testcase

Now we will write the main testcase. This doesn’t have any test scenario, it is only used for handling the above 3 testcases.


  This should be written in program block.

1)  First include all the above testcases inside the program block.

 
`include
“testcase_1.sv”

 
`include
“testcase_2.sv”

 
`include
“testcase_3.sv”

2)  Define env class object.

  vmm_env env
=
new
();

  As I dont have a custom env class to show, I used vmm_env. You can use your custom defined env.


 


3)  In the initial block call the run() method of vmm_test_registry class and pass the above env object as argument. This run method of vmm_test_registry is a static method, so there is no need to create an object of this class.

vmm_test_registry
::run
(env
);


   Main testcase source code

`include
“vmm.sv”


program main
();

 
`include
“testcase_1.sv”

 
`include
“testcase_2.sv”

 
`include
“testcase_3.sv”

   vmm_env env
;

  

  
initial

  
begin

  
$display
(
” START OF TEST CASE “
);

   env
=
new
();

   vmm_test_registry
::run
(env
);

  
$display
(
” START OF TEST CASE “
);

  
end

  

  


endprogram


Now compile the above code using command.





vcs -sverilog main_testcase.sv +incdir+$VMM_HOME/sv

Now simulate the above compiled code.

To simulate , just do ./simv and see the log.


You can see the list of the testcases. This simulation will not ececute any testcase.

  LOG

  START OF TEST CASE


*FATAL*[FAILURE] on vmm_test_registry(class) at                    0:


    No test was selected at runtime using +vmm_test=<test>.


    Available tests are:


       0) Default : Default testcase that simply calls env::run()


       1) test_1  : Test_1


       2) test_2  : Test_2


       3) test_3  : Test_3


To run testcase_1 use ./simv +vmm_test=test_1

  LOG

   START OF TEST CASE


Normal[NOTE] on vmm_test_registry(class) at                    0:


    Running test “test_1″…


Start of Testcase :  Test_1


Simulation PASSED on /./ (/./) at                    0 (0 warnings, 0 demoted errors & 0 demoted warnings)


End of Testcase : Test_1


START OF TEST CASE


  Simillarly to run testcase_2 ./simv +vmm_test=test_2

  LOG

START OF TEST CASE


Normal[NOTE] on vmm_test_registry(class) at                    0:


    Running test “test_2″…


Start of Testcase :  Test_2


Simulation PASSED on /./ (/./) at                    0 (0 warnings, 0 demoted errors & 0 demoted warnings)


End of Testcase : Test_2


START OF TEST CASE


You can also call the Default testcase, which just calls the  env::run()

./simv +vmm_test=Default

  LOG

START OF TEST CASE


Normal[NOTE] on vmm_test_registry(class) at                    0:


    Running test “Default”…


Simulation PASSED on /./ (/./) at                    0 (0 warnings, 0 demoted errors & 0 demoted warnings)


START OF TEST CASE

 


   Download the source code

vmm_test.tar


Browse the code in vmm_test.tar


   Command to compile

   vcs -sverilog -ntb_opts dtm +incdir+$VMM_HOME/sv main_testcase.sv

   Commands to simulate testcases

  ./simv


  ./simv +vmm_test=Default


  ./simv +vmm_test=test_1


  ./simv +vmm_test=test_2


  ./simv +vmm_test=test_3

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/190578.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • mysql longtext查询慢_select中的longtext使查询速度极慢

    mysql longtext查询慢_select中的longtext使查询速度极慢我有一个结构如下的普通平台CREATETABLE`oc_pipeline_logging`(`id`INT(11)NOTNULLAUTO_INCREMENT,`source`TEXT,`comments`TEXT,`data`LONGTEXT,`query`TEXT,`date_added`TIMESTAMPNOTNULLDEFAULTCURRENT_TIMESTA…

    2022年5月14日
    104
  • 手机的屏幕分辨率_手机屏幕分辨率尺寸

    手机的屏幕分辨率_手机屏幕分辨率尺寸  什么是分辨率?说白了,分辫率高,屏幕显示就更清晰、更细腻。分辨率不高,屏幕显示就会有颗粒感,粗糙感。一句话:分辨率是屏幕显示清晰度的一个指标。现在手机常用的分辫率有:128*160、176*220、240*320。128*160多用在低档的手机。中档的手机一般分辨率为176*220。中高档手机分辨率多为:240*320。夏普现在有一款手机分辨率达到了480*640。比电脑显示屏还清晰

    2022年8月13日
    11
  • win10系统中pdf不显示缩略图及预览图

    win10系统中pdf不显示缩略图及预览图试试这个,我的取消了复选框反而出现了预览图:https://helpx.adobe.com/cn/acrobat/using/enable-pdf-thumbnail-preview-windows-explorer.html

    2022年5月6日
    397
  • 大数据到底应该如何学?

    大数据到底应该如何学?本文关键字:大数据专业、大数据方向、大数据开发、大数据分析、学习路线。笔者从事大数据开发和培训多年,曾为多家机构优化完整大数据课程体系,也为多所高校设计并实施大数据专业培养方案,并进行过多次大数据师资培训、高校骨干教师学习交流,希望自己的一点粗浅认识能够帮助到大家。

    2022年6月4日
    31
  • 小米手机_如何打开开发者模式?[通俗易懂]

    小米手机_如何打开开发者模式?[通俗易懂]小米手机如何打开开发者模式?大多数手机的开发者模式按钮都在更多设置中,但是小米手机有些不一样,更多设置中没有展示开发者选项,那么小米手机怎样打开开发者模式呢?咨询小伙伴后,成功打开开发者模式,步骤

    2022年8月3日
    6
  • oracle字段换名语句,修改表名的sql语句

    oracle字段换名语句,修改表名的sql语句sql语句能不能修改表名可以。SQL自带了一系列的系统存储过程。其中sp_rename就具有修改表名和列名的功能。对于sp_rename是这样定义的:更改当前数据库中用户创建对象(如表、列或用户定义数据类型)的名称。基本语法:修改表名:EXECsp_rename'[原有表名]’,'[新表名]’;修改列名:EXECsp_rename'[原有列名]’,‘[新列名]’,’COLUMN’…

    2022年5月13日
    67

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号