[Verilog] Modelsim problem of enum in simulation

Status
Not open for further replies.

sqx

Member level 1
Joined
Sep 21, 2018
Messages
34
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
347
For system verilog, I use "typedef enum {WAIT, WATCH, ASSERT} STATE;" in both module and testbench. The compiling is passed but when starting simulation, here comes the error:

** Error: (vsim-3906) F:/modelsim_projects/4/test_cd.v(23): Connection type 'test_cd_v_unit.enum int ' is incompatible with 'fsm_cd_v_unit.enum int ' for port (state): Enum types must match.

In both module and testbench, I use "STATE state, n_state; " for the definition of input and output. I think nothing is wrong but how can I make the simulation working?
 

You must have only one typedef for STATE. Put it in a common package.
 

Thanks! I defined STATE in a .vh file and included this file in both module an testbench, but Modelsim still created 2 unit packages. How can I fix this problem?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…