Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using typedef with wire in SystemVerilog

When using typedef to declare a user-defined type, both these forms are accepted by EDA Playground:

typedef reg[4:0] reg5;
typedef logic[4:0] logic5;

However, if doing something similar based on wire type, then this format fails:

typedef wire[4:0] wire5;

I get "Syntax Error".

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

How can that be explained?

>Solution :

It is illegal to declare a typedef with a wire type, according to the IEEE Std 1800-2017. Refer to section 6.18 User-defined types:

type_declaration ::=                // from A.2.1.3 
typedef data_type type_identifier { variable_dimension } ;

A wire is not a data_type, whereas reg and logic are. A wire is a net_type.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading