In my module, I have an output port named Cmd which is of 'reg' type.
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;
I have also defined the signal Cmd using typedef as shown below in another file.
typedef enum logic [2:0] {
IDLE,
WR,
RD,
RDX,
RDL,
WRN,
WRC,
BROADCAST
} Cmd_t;
The interface is defined like this
Interface intf (input clk);
Cmd_t Cmd;
...
endinterface
In top file where I instantiated the module,
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
so I get the following error:
** Error: (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]' for port (Cmd).
How to resolve this error, provided I can drive enum type values on Cmd signal in my design module?