Closed shivang-chipstack closed 2 months ago
You cannot safely assume that the defaults are valid, and doing so could issue otherwise spurious errors or warnings. Some libraries (I think basejump_stl does this) set parameter defaults to huge invalid values so that users get an error if they forget to provide a value when instantiating. That's why slang forces invalid values; type checking and semantic analysis suppress errors / skip analyzing expressions involving invalid values.
Thanks for the explanation. Closing this issue as intended behavior.
Thank you for the explanation on parameterized interfaces. However, rather than assuming some invalid/forced value for an uninstantiated interface, we should provide with default value in type. To give little more context, consider below code:
For above example, when we check the type of my_intf.sp.d_in, it returns \<error>. Technically, we should return \<logic [7:0]> as we can assume default value of IN_WIDTH=8 from interface definition. If the actual DUT instance is provided then we can refer to instantiated interface width, but when there is no instantiation provide we should use default value rather than \<error> for interface signal type.
Can you please update and add this support?
Originally posted by @shivang-chipstack in https://github.com/MikePopoloski/slang/issues/980#issuecomment-2201383393