【发布时间】:2016-12-06 07:02:32
【问题描述】:
在我的模块中,我有一个名为 Cmd 的输出端口,它属于“reg”类型。
module ddesign (clk, rst, addr, data, Cmd);
input clk;
input rst;
input [31:0] addr;
input [31:0] data;
...
output reg [2:0] Cmd; // this is the signal concerned
...
always @(posedge clk) begin
if (rst == 0) begin
Cmd = IDLE; // I wanted to drive enum values
end
else begin
Cmd = WR;
...
end
end
endmodule;
我还在另一个文件中使用 typedef 定义了信号 Cmd,如下所示。
typedef enum logic [2:0] {
IDLE,
WR,
RD,
RDX,
RDL,
WRN,
WRC,
BROADCAST
} Cmd_t;
接口是这样定义的
Interface intf (input clk);
Cmd_t Cmd;
...
endinterface
在我实例化模块的顶层文件中,
module top;
...
intf vif(clk); // interface instantiation
ddesign dut(
...
.Cmd(vif.Cmd), // the module port and interface are connected like this, but here is the incompatibility problem
...
);
endmodule
所以我收到以下错误:
** 错误: (vsim-3906) F:/folder1/project1/DV/top/top.sv(79): Connection type 'file_list_svh_unit.enum reg[2:0] ' is incompatible with 'reg[2 :0]' 用于端口 (Cmd)。
如果我可以在我的设计模块中驱动 Cmd 信号上的枚举类型值,如何解决此错误?
【问题讨论】:
-
你可以构造一个MCVE。我在EDA Playground 上这样做了,没有发现错误。我也在 Questa 上试过,没有发现错误。