当前位置:网站首页>Introduction to interface in SystemVerilog
Introduction to interface in SystemVerilog
2022-07-25 05:24:00 【Cored】
interface Background
With the increase of design complexity , The connection between modules has also become more complex . Two RTL There may be dozens of connection signals between modules , These signals must be arranged in the correct order for them to communicate correctly . When adding a new signal to two modules , Not only do you need to edit the module code to add new ports , You also need to edit the net list code of the connecting device in the upper level , Errors at any level will cause the design to fail to work properly .
traditional method : Signal connection method using signal name mapping , But this undoubtedly increases the amount of code input , And it's easy to make mistakes .
terms of settlement : Use interface , It is systemVerilog One of them represents a bundle of wires , It is a code with intelligent synchronization and connection functions . An interface can be instantiated like a module , It can also be connected to the port like a signal line .
Interface function :
Interfaces contain connections 、 Sync 、 Even the communication function between two or more blocks , They connect the design block and the test platform .
Illustrate with examples :
(1) Arbiter interface :
interface arb_if(input bit clk);
logic [1:0] grant,request;
logic rst;
endinterface(2) Arbitrators using interfaces
module arb (arb_if arbif);
...
always @(posedge arbif.clk or posedge arbif.rst) begin
if(arbif.rst)
arbif.grant<=2'b00;// Transmit data to the interface
else
arbif.grant<=next_grant;
...
end
endmodule(3) Test platform using arbiter interface
module test (arb_if arbif)
...
initial begin
// The reset code is omitted here
@(posedge arbif.clk) arbif.request <=2'b01;
$display("@%0t: Drove req=01",$time);
repeat (2) @(posedge arbif.clk);
if(arbif.grant !=2'b01) $display("@%0t:al:grant!=2'b01",$time);
$finish
end
endmodule : test
(4) Using the arbiter interface top modular
module top;
bit clk;
always #5 clk=~clk;
arb_if arbif(clk);
arb_al (arbif);
test_t1(arbif);
endmodule : topExample benefits :
Connections become simpler and less error prone . If you want to put a new signal into an interface , You only need to make changes in the interface definition and the modules that actually use this interface . You don't need to change any other modules , For example, in top modular , The signal just passes through the module , Without any operation . This feature greatly reduces the probability of connection errors .
=================== Do not conform to the Verilog-2001 Old code processing method ================
If you can't meet Verilog-2001 Modify the old source code , Change the port into an interface , You can connect the signal of the interface directly to each port . In the following example arb_port Code module .

边栏推荐
- Terminate 5g chip cooperation! The official response of Intel and zhanrui came
- OpenFegin远程调用丢失请求头问题
- How to carry out the function test with simple appearance and complex interior?
- An article takes you to understand the sentinel mode of redis
- Implement is by yourself_ base_ of
- How do novices open accounts for stock speculation? Is it safe for securities companies to open accounts online?
- FinClip实现微信授权登录的三种方案
- ThreadLocal
- LCP插件创建对等802.1ad接口
- Shenzhen on call test, subject 4 on call test, subject 3 theory, second theory on call test instructions
猜你喜欢
随机推荐
[cloud co creation] design Huawei cloud storage architecture with the youngest cloud service hcie (Part 1)
Set up private CA server
systemVerilog中automatic用法
DOM在Ahooks中的处理过程
LCP插件创建对等802.1ad接口
Sword finger offer II 014. anagrams in strings
nacos中哪边有这个列的sql脚本啊?
An article takes you to understand the sentinel mode of redis
弹性布局总结
Introduction to base ring tree
STL notes (III): input / output stream
Execution process of NPM run XX
06. Libavdevice Library of ffmpeg
The third question of force deduction -- the longest substring without repeated characters
初步了解Panda3d粒子系统
When image component in wechat applet is used as background picture
How to carry out the function test with simple appearance and complex interior?
Interface idempotency
LCP插件创建对等物理接口
VPP cannot load up status interface








