Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] System Verilog error in modelsim with enum types.

Status
Not open for further replies.

vipinlal

Full Member level 6
Joined
Mar 8, 2010
Messages
357
Helped
76
Reputation
152
Reaction score
60
Trophy points
1,308
Location
India
Activity points
3,191
I have a design which looks like this:

Code:
typedef enum { a,b,c d, e} enum_t; 

module test
		( 
		output enum_t test_op,
		input xx,
		input clk
		);

I have a testbench code too where I instantiate module test.

Code:
module tb_test();

logic clk,xx;
enum_t test_op;

My question is how do I make the enum_t type available for the testbench. I tried defining it in the testbench file, but there is an error during simulation.

When I dont declare enum_t in the testbench, the error says:

** Error: D:/tb_test.sv(11): 'enum_t' is an unknown type.
Or did you omit the '()' for an instantiation?

Thanks for any inputs.
 

Re: system verilog error in modelsim with enum types.

why not put enum_t in a package?
 

Re: system verilog error in modelsim with enum types.

why not put enum_t in a package?

I used the following line for this:
import enum_types::enum_t;

Yes. I tried that too. But then I get these types of errors.

** Error: D:/test.sv(46): (vlog-2730) Undefined variable: 'c'.

I have some statements inside the code, where I do,

test_op = c;

these lines throw an error.
 

Re: system verilog error in modelsim with enum types.

Unfortunately, because the enum label identifiers are declared at the same scope level as the enum type, importing just the enum type does not import the enum labels. So you need to import them explicitly,
import enum_types::enum_t;
import enum_types::a;
import enum_types::b;
import enum_types::c;

or use a wildcard import
import enum_types::*;
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top