当前位置:网站首页>[UVM basics] TLM common data receiving and sending and data receiving examples
[UVM basics] TLM common data receiving and sending and data receiving examples
2022-06-26 07:33:00 【ReCclay】
List of articles
stay UVM in , Usually use TLM( Transaction Level Modeling) Realization component Between transaction Level communication .
This section will cover the following figures UVM Take the tree structure as an example , demonstration UVM transaction Data receiving and sending of level communication (uvm_analysis_port) And data reception (uvm_blocking_get_port).

The flow of data is :my_model It's from my_agent Of my_monitor Get in my_transaction, After treatment ,my_model hold my_transaction Pass to my_scoreboard.
1、 Data receiving and sending (uvm_analysis_port)
stay UVM Of transaction Level of communication , There are many ways to send data , One is the use of uvm_analysis_port. stay my_monitor The following variables are defined in :
file : src/ch2/section2.3/2.3.5/my_monitor.sv
uvm_analysis_port #(my_transaction) ap;
uvm_analysis_port Is a parameterized class , The parameter is this analysis_port The type of data to be transferred , In this section is my_transaction.
The statement ap after , Need to be in monitor Of build_phase Instantiate it :
file : src/ch2/section2.3/2.3.5/my_monitor.sv
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
...
ap = new("ap", this);
endfunction
stay main_phase in , When you finish collecting one transaction after , It needs to be written to ap in :
task my_monitor::main_phase(uvm_phase phase);
my_transaction tr;
while(1) begin
tr = new("tr");
collect_one_pkt(tr);
ap.write(tr); // write in ap
end
endtask
write yes uvm_analysis_port A built-in function of . Here we are , stay my_monitor We need to provide for transaction The communication preparation has been completed .
2、 Data reception (uvm_blocking_get_port)
UVM Of transaction There are also many data receiving methods for level communication , One of them is to use uvm_blocking_get_port. This is also a parameterized class , Its parameters are to be passed in transaction The type of .
stay my_model in , Defines a port
uvm_blocking_get_port #(my_transaction) port;
And in build_phase Instantiate it in :
function void my_model::build_phase(uvm_phase phase);
super.build_phase(phase);
port = new("port", this);
endfunction
stay main_phase in , adopt port.get Task to get from i_agt Of monitor It's coming out of transaction.
task my_model::main_phase(uvm_phase phase);
my_transaction tr;
my_transaction new_tr;
super.main_phase(phase);
while(1) begin
port.get(tr); // Receive from monitor Of transaction
...
end
endtask
3、 Connect send and receive ports
stay my_monitor and my_model After each port is defined and implemented in , The function of communication has not been realized , Still need to be in my_env Use in fifo Connect the two ports together . stay my_env Define a fifo, And in build_phase Instantiate it :
file : src/ch2/section2.3/2.3.5/my_env.sv
class my_env extends uvm_env;
...
uvm_tlm_analysis_fifo #(my_transaction) agt_mdl_fifo;
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
...
agt_mdl_fifo = new("agt_mdl_fifo", this);
endfunction
...
endclass
fifo The type is uvm_tlm_analysis_fifo, It is also a parameterized class itself , Its parameters are stored in transaction The type of , Here is my_transaction.
after , stay connect_phase Lieutenant general fifo Respectively with my_monitor Medium analysis_port and my_model Medium blocking_get_port Connected to a :
file : src/ch2/section2.3/2.3.5/my_env.sv
function void my_env::connect_phase(uvm_phase phase);
super.connect_phase(phase);
i_agt.ap.connect(agt_mdl_fifo.analysis_export);
mdl.port.connect(agt_mdl_fifo.blocking_get_export);
endfunction
Why do we need a fifo Well ? You can't put my_monitor Medium analysis_port and my_model Medium blocking_get_port Connected ? because analysis_port Is non blocking , ap.write After the function call is completed, it will return to , Do not wait for data to be received . Suppose that write When a function is called ,blocking_get_port Busy with other things , When you're not ready to receive new data , At this time write Function write my_transaction You need a temporary storage location , This is it. fifo.
In the above connection , Yes i_agt A member variable of ap, Its definition is similar to my_monitor in ap The definition of is exactly the same :
file : src/ch2/section2.3/2.3.5/my_agent.sv
uvm_analysis_port #(my_transaction) ap;
And my_monitor Medium ap The difference is , No need. my_agent Medium ap instantiate , And just need to be in my_agent Of connect_phase Lieutenant general monitor The value of , let me put it another way , This is equivalent to a point my_monitor Of ap The pointer to :
file : src/ch2/section2.3/2.3.5/my_agent.sv
function void my_agent::connect_phase(uvm_phase phase);
super.connect_phase(phase);
ap = mon.ap;
endfunction
According to the introduction connect_phase Execution order of , my_agent Of connect_phase The execution order of is earlier than my_env Of connect_phase Execution order of , So as to ensure the execution to i_agt.ap.connect When the sentence is , i_agt.ap Not a null pointer .
边栏推荐
- Thymeleaf中使用二维数组[[]]报错:Could not parse as expression
- Jemter 壓力測試 -基礎請求-【教學篇】
- Jemter 压力测试 -可视化工具支持-【安装篇】
- Porphyrin based polyimide (ppbpis); Synthesis of crosslinked porphyrin based polyimides (ppbpi CRS) porphyrin products supplied by Qiyue biology
- Exploration and practice of incremental data Lake in station B
- Xiaosha's counting (bit operation, Combinatorial Mathematics) - Niuke
- [recommend 10 easy idea plug-ins with less tedious and repetitive code]
- Jmeter压力测试-Web代理本地接口测试【教学篇】
- ES cluster_block_exception read_only_allow_delete问题
- 十大证券公司哪个佣金手续费最低,最安全可靠?
猜你喜欢

ZRaQnHYDAe

Stm32f1 and stm32subeide programming example - thermal sensor driver

Liquid crystal texture diagram of purple solid mm-tpp-10c methacrylic acid decanoxy tetraphenyl porphyrin and mm-tpp-12c methacrylic acid dodecanoxy tetraphenyl porphyrin - Qi Yue display

一文搞懂Glide,不懂来打我

Iron / zinc / copper / platinum metal complexes such as 5,10,15,20-tetra (4-hydroxyphenyl) porphyrin (THPP) / (thppfe) / (thppzn) / (thppcu) / (thpppt) - Qiyue R & D

How MySQL implements the RC transaction isolation level

B站增量数据湖探索与实践

This paper analyzes the use method and implementation principle of eventbus event bus

How to convert Unicode into Chinese characters in Excel

Cocoscreator plays spine animation
随机推荐
How MySQL implements the RC transaction isolation level
ZRaQnHYDAe
The "big grievances" in the workplace are not only physically tired, but also mentally emptied
Golang source package collection
C implementation adds a progress bar display effect to the specified column of the GridView table in devaxpress - code implementation method
Here comes the apple ar/vr device exclusive system! Or named realityos
执行npm install -g serve时报错权限权限问题解决方案
蓝桥杯嵌入式学习总结(新版)
Summary of domestic database examination data (continuously updated)
Is it safe for individuals to buy stocks with compass software? How to buy stocks
Service interface test guide
Jemter stress test - Basic request - [teaching]
Introduction to mapping in ES
The performance of iron and steel enterprises was expected to be good in January this year. Since February, the prices of products of iron and steel enterprises have increased significantly. A mighty
ES cluster_block_exception read_only_allow_delete问题
The first screen time, you said you optimized it, then you calculated it and showed it to me!
Porphyrin based polyimide ppbpis (ppbpi-pa, ppbpi-pepa and ppbpi-pena); Crosslinked porphyrin based polyimide (ppbpi-pa-cr, ppbpi-pepa-cr, ppbpi-pena-cr) reagent
5,10,15,20-tetra (4-methoxycarbonylphenyl) porphyrin tcmpp purple crystal; Meso-5,10,15,20-tetra (4-methoxyphenyl) porphyrin tmopp|zn[t (4-mop) p] and co[t (4-mop) p] complexes
Esp32-c3 introductory tutorial WiFi part ⑥ - WIFI intelligent distribution network based on serial port
Network IO, disk IO