当前位置:网站首页>连接设计与测试平台——SystemVerilog 接口知识点总结
连接设计与测试平台——SystemVerilog 接口知识点总结
2022-07-28 16:23:00 【别再出error了】
1、为什么需要接口呢?
在SystemVerilog中,为了简化模块之间的连接、随着设计复杂化的大量端口、在不同设计层信号的反复声明和连接,利用接口作为块之间的通信模块来达到这个目的。
优点:简洁不易错,加入新信号时只需要改变接口的模块。
2、什么是接口?
它是一种代表一捆连线的结构,具有智能同步和连接功能的代码。(按我自己的理解,就是相当于把两个模块之间的端口全部同一在一个结构里,避免了重复的声明)
例如:如果不使用接口,仲裁器和测试平台针对同一信号都需要各自声明。如下
//使用端口的仲裁器模型
module arb_port(input logic[1:0] grant,output logic[1:0] request...);
//而在使用端口的测试平台中,对同一信号也需要定义端口
module test(input logic[1:0] grant,output logic[1:0] request...)3、具体如何使用接口来替代呢?--interface
//例如,仲裁器的简单接口
interface arb_if(input bit clk);
logic [1:0] grant,request;
logic rst;
endinterface
//使用了简单接口的仲裁器
module arb(arb_if arbif);
...
always @(posedge arbif.clk or posedge arbif.rst) //可以直接调用
begin
...
endmodule显而易见,定义了接口后就不需要再在仲裁器的module中声明了,信号的调用直接可以用.加上端口名称即可。(例如:.clk)(我觉得很像是调一个属性值)

注:时钟可以使接口的一部分或者是一个独立的端口,并且接口的实例名越短越好,方便引用。值得注意的是,接口信号必须使用非阻塞赋值来驱动。
4、使用modport将接口中的信号分组并指定方向
例如:
interface arb_if(input bit clk);
logic [1:0] grant,request;
logic rst;
modport TEST(output request,rst,input grant,clk);
//这就声明了信号的方向
...
endinterface
//对应的,在测试平台的使用中,需要在模块首部指明,在实例化时不需要指明
module test (arb_if.TEST arbif);边栏推荐
- 总数据量超万亿行,玉溪卷烟厂通过正确选择时序数据库轻松应对
- Unity shader uses rendered texture to achieve glass effect
- In 2020q2, shipments in the global tablet market soared by 26.1%: Huawei ranked third and Lenovo increased the most!
- Steps to configure V530 switch
- The practice of the beego framework of goweb development: Section II project initialization configuration
- Vscode界面介绍
- Verilog 每日一题 (VL24 多bit MUX同步器 跨时域输出)
- Realize the reset function of steering wheel UI with touch rotation and finger departure in unity
- 线性代数及矩阵论(七)
- Goweb开发之Beego框架实战:第三节 程序执行流程分析
猜你喜欢

如何在构建阶段保护镜像安全

Proof of the third scene (f) in 22 years

Ugui learning notes (II) Scrollview related

Re11: read EPM legal judgment prediction via event extraction with constraints

net框架

Realize the reset function of steering wheel UI with touch rotation and finger departure in unity

DGL Chapter 1 (official tutorial) personal notes

微服务架构-服务注册中心和服务网关(6.8) (转载)

influxdb2的使用

Unity editor learning (I) using features to change the display of fields in components
随机推荐
Comprehensively design an oppe homepage -- page service part
软考回顾总结
Learn about service discovery in kubernetes
Application of Pegasus d200s UAV and airborne lidar in large-scale DEM construction
The practice of the beego framework of goweb development: Section II project initialization configuration
Verilog 每日一题 (VL30 RAM的简单实现)
2021年4月份自考
Proof of the third scene (f) in 22 years
Educational codeforces round 126 (rated for Div. 2) f.teleporters (two sets and two points)
格雷码和二进制的转换及典型例题(4bits格雷码计数器)
Verilog 每日一题(VL6 数据串转并电路)
22年多校第三场(F的证明
异步FIFO基本原理(基于Verilog的简单实现)
Ugui learning notes (V) togglegroup makes multiple choice radio boxes
Goweb开发之Beego框架实战:第三节 程序执行流程分析
Make full use of English
DGL Chapter 1 (official tutorial) personal notes
C # traversal set
Mysql database addition, deletion, modification and query (detailed explanation of basic operation commands)
Visual Studio 2015 团队开发之Azure DevOps篇