ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

uvm lab2

2022-04-30 12:02:54  阅读:218  来源: 互联网

标签:sv packet da lab2 test uvm phase


注1:uvm lab1 - __见贤思齐 - 博客园 (cnblogs.com)

1.test.sv

(1)和uvm lab1中test.sv相同;

2.test_collection.sv

 1 `ifndef TEST_COLLECTION__SV
 2 `define TEST_COLLECTION__SV
 3 
 4 `include "router_env.sv"
 5 
 6 class test_base extends uvm_test;
 7   `uvm_component_utils(test_base)
 8   router_env env;
 9 
10   function new(string name, uvm_component parent);
11     super.new(name, parent);
12     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
13   endfunction
14 
15   virtual function void build_phase(uvm_phase phase);
16     super.build_phase(phase);
17     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
18     env = router_env::type_id::create("env", this);
19   endfunction
20 
21 //
22 // The start_of_simulation_phase method from lab1 is moved to final_phase
23 // for the convinience of seeing the topology and factory registry at the
24 // end of simulation.  In practice, you should implement both phases to
25 // display the topology and the factory registry.
26 //
27   virtual function void final_phase(uvm_phase phase);
28     super.final_phase(phase);
29     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
30     uvm_top.print_topology();
31     factory.print();
32   endfunction
33 endclass
34 
35 // Lab 2 - Include the packet_da_3.sv file
36 //
37 // ToDo
38 `include "packet_da_3.sv"
39 
40 
41 class test_da_3_inst extends test_base;
42   `uvm_component_utils(test_da_3_inst)
43 
44   function new(string name, uvm_component parent);
45     super.new(name, parent);
46     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
47   endfunction
48 
49   virtual function void build_phase(uvm_phase phase);
50     super.build_phase(phase);
51     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
52 
53     // Lab 2 - Use instance override to configure the packet sequencer
54     //         to use packet_da_3 instead of packet
55     //
56     // ToDo
57     set_inst_override_by_type("env.i_agent*.seqr.*", packet::get_type(), packet_da_3::get_type());
58 
59 
60   endfunction
61 
62 endclass
63 
64 // Optional Lab 2 - Create a test to globally set all packet instances to packet_da_3
65 
66 class test_da_3_type extends test_base;
67   `uvm_component_utils(test_da_3_type)
68 
69   function new(string name, uvm_component parent);
70     super.new(name, parent);
71     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
72   endfunction
73 
74   virtual function void build_phase(uvm_phase phase);
75     super.build_phase(phase);
76     `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
77     set_type_override_by_type(packet::get_type(), packet_da_3::get_type());
78   endfunction
79 endclass
80 
81 
82 `endif

3.router_env.sv

(1)和uvm lab1中router_env.sv相同;

4.input_agent.sv

(1)和uvm lab1中input_agent.sv相同;

5.driver.sv

(1)和uvm lab1中driver.sv相同;

6.packet_sequence.sv

(1)和uvm lab1中packet_sequence.sv相同;

7.packet.sv

(1)和uvm lab1中packet.sv相同;

8.packet_da_3.sv

 1 `ifndef PACKET_DA_3__SV
 2 `define PACKET_DA_3__SV
 3 
 4 class packet_da_3 extends packet;
 5   `uvm_object_utils(packet_da_3)
 6 
 7   // Lab 2 - set the constraint for destination address (da) to 3
 8   //
 9   // ToDo
10   constraint da_3 {
11     da == 3;
12   }
13 
14   function new(string name = "packet_da_3");
15     super.new(name);
16    `uvm_info("TRACE", $sformatf("%m"), UVM_HIGH);
17   endfunction
18 endclass
19 
20 `endif

 

标签:sv,packet,da,lab2,test,uvm,phase
来源: https://www.cnblogs.com/csjt/p/16209815.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有