在SV中可以使用结构体作为模块的输入或输出,这使得它可以更加清晰地传递更多的信号,以简化RTL代码,类似于interface。
typedef struct {
bit [7:0] intr = 'h AA;
logic [23:0] addr = 'h FF_FF_FF;
} ext;
module SU (
output ext extOut);
assign extOut = '{intr: 8'hFF, addr:24'haa_aa_aa};
initial begin
#1; $display($stime,,, "extOut = %p", extOut);
end
endmodule
module top;
ext extIn;
//connect extOut of 'SU' with extIn of 'top'
SU SUInst(.extOut(extIn));
initial begin
#2; $display($stime,,, "extIn = %p", extIn);
end
endmodule
仿真log:
1 extOut = '{intr:'hff, addr:'haaaaaa}
2 extIn = '{intr:'hff, addr:'haaaaaa}
V C S S i m u l a t i o n R e p o r t
在上面的例子中,我们首先定义了一个名为“ext”的unpacked struct,然后直接作为module的output。
再声明一个moudle top,连接到这个struct。最后打印表明这个结构体确实完成了连接,打印相同的信息。
struct可以作为参数传递给task或function,前提是这个struct需要先使用typedef声明为用户自定义类型
typedef struct {
logic [31:0] addr;
logic [63:0] data;
logic [3:0] BEnable;
} control;
function Dbus (input control ct1);
….
endfunction
审核编辑 :李倩
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。
举报投诉
-
模块
+关注
关注
7文章
2822浏览量
52788 -
RTL
+关注
关注
1文章
393浏览量
62378 -
结构体
+关注
关注
1文章
131浏览量
11296
发布评论请先 登录
相关推荐
热点推荐
Dual Coupler Module skyworksinc
电子发烧友网为你提供()Dual Coupler Module相关产品参数、数据手册,更有Dual Coupler Module的引脚图、接线图、封装手册、中文资料、英文资料,Dual
发表于 10-28 18:34
SV8541A、SV8542A、SV8544A 微功率低噪声运算放大器技术手册
电子发烧友网站提供《SV8541A、SV8542A、SV8544A 微功率低噪声运算放大器技术手册.pdf》资料免费下载
发表于 09-09 17:17
•0次下载
飞凌嵌入式ElfBoard ELF 1板卡-input子系统之基于input子系统的按键驱动
例程代码路径:ELF 1开发板资料包\\03-例程源码\\03-2 驱动例程源码\\08_input子系统\\keyboard下面以控制开发板上的K2为例进行讲解。修改设备树(一)查看原理图和引脚
发表于 04-15 10:58
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-input子系统之input子系统简单构建流程
_device); input_free_device(input_device);
pr_info(\"Input device unregistered\\n\");}
module
发表于 04-15 10:54
飞凌嵌入式ElfBoard ELF 1板卡-input子系统之input子系统简单构建流程
_device); input_free_device(input_device);
pr_info(\"Input device unregistered\\n\");}
module
发表于 04-15 10:29
STM32CubeMX PA0、PA4、PA7、PB1等类似的端口不能作为普通的GPIO_Output和GPIO_Input口使用吗?
用STM32G0B1RCT6芯片
用STM32CubeMX配置端口,有些端口没有
GPIO_Output和GPIO_Input选项!比如PA0、PA4、PA7、PB1等类似的口。
这些口,不能作为
发表于 03-14 06:52
SV托管和IDC托管有什么区别
SV托管和IDC托管在本质上没有区别。实际上,“SV托管”并不是一个普遍认可或广泛使用的术语,而“IDC托管”是行业内对服务器托管服务的一种标准称呼。因此,当提到“SV托管”时,很可能是在指一种特定的服务器托管服务,但这种表述并
转换Keras H5模型,为什么无法确定--input_shape参数的值?
] is not fully defined for output 0 of \"conv2d_input\".
Use --input_shape with positive integers to override mode
发表于 03-05 07:51
DLP3010在设置时不知道如图所示的input和output指什么,这样的img文件从哪得到?
目的是更改开机图片,在设置时不知道如图所示的input和output指什么,这样的img文件从哪得到?
以下是各页设置情况,GUI使用的是3.1.0.3,EVM是2.2.0.6
发表于 02-25 07:23
ADA4511-2: Precision, 40 V, Rail-to-Rail Input and Output Op Amp with DigiTrim Data Sheet adi
电子发烧友网为你提供ADI(ADI)ADA4511-2: Precision, 40 V, Rail-to-Rail Input and Output Op Amp with DigiTrim
发表于 01-15 18:47
verilog计数器代码为什么要使用这句话if (count===8\'bxxxxxxxx)count=8\'b0000_0000;
本人小白,希望有贵人能指点下
counter.v
module counter( //Module naming
input clk,//Declarations of input
发表于 12-21 14:49
ADS1259 Input指的Digital Filter输出还是什么?
请问ADS1259手册中第26页Final Output Date=(Input-OFC[2:0])*FSC[2:0]/40000h式中,Input指的Digital Filter输出还是什么?
此外,ADS1259有像ADS
发表于 12-12 08:03

SV Structure作为module的input/output
评论