In SystemVerilog I CAN do
typedef logic [15:0] bus16;
typedef reg [15:0] reg16;
interface myif;
bus16 mybus;
wor [15:0] myotherbus;
endinterface
But I CAN'T do
typedef wor [15:0] wor16;
interface myif;
wor16 myotherbus;
endinterface
I get "unknown variable declaration type"
It seems, at least in my Synplicity version, typedefs of 'wor' is not permitted.
Is this a limitation defined in the IEEE1800 spec or is it perhaps a bug?
It is disallowed because System Verilog Standard does not allow using
netsintypedefs. Sorry, no other explanation.You can look at the syntax in paragraph 6.18. Follow
data_typedefinition. It is based on system verilogvars but does not includenets (6.8).You can define a new net type using the
nettypeconstruct, but it still does no allow you to use other net types. However, you can create them with a custom resolution behavior (check 6.6.7). It is a special syntax and does not fit for simple renaming. BTW, neitherwornor this are synthesizable.So, your best bet is to use macros:
`define wor16 wor[15:0]