当前位置:网站首页>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 .

边栏推荐
- What is virtual DOM? How to implement a virtual DOM
- 微服务 - Hystrix 熔断器
- ZTE's first 5g mobile phone, axon 10 pro, was launched in the first half of this year
- Three must know and know problems of redis
- STL notes (III): input / output stream
- STL notes (VIII): container - List
- Delivery practice of private PAAS platform based on cloud native
- deep报错
- AirServer 7.3.0中文版手机设备无线传送电脑屏幕工具
- Harbor installation
猜你喜欢

I have seven schemes to realize web real-time message push, seven!
Set up private CA server

Three schemes for finclip to realize wechat authorized login

微服务及相关组件概念

Redis的三个必知必会的问题

Implement is by yourself_ class
搭建私有CA服务器

Preliminary understanding of Panda3D particle system

"Niuke | daily question" inverse Polish expression

easyrecovery免费数据恢复工具操作简单一键恢复数据
随机推荐
Pikachu vulnerability platform exercise
AirServer 7.3.0中文版手机设备无线传送电脑屏幕工具
LeetCode 15:三数之和
如何判断是否遭到DDOS攻击
systemverilog中function和task区别
Redis集群搭建(Windows)
H5 new feature domcontentloaded event - custom attribute -async attribute -history interface method - local storage -postmessage
接口幂等性
STL notes (IV): String
OpenFegin远程调用丢失请求头问题
初步了解Panda3d粒子系统
What content does the software test plan include and how to write it. Share test plan template
Sword finger offer II 012. the sum of the left and right subarrays is equal
Interface idempotency
Add transition layer to JS page
The third day of rhcsa summer vacation
Sword finger offer II 014. anagrams in strings
deep报错
VPP不能加载UP状态接口
学习记录[email protected]研发效能度量指标