RE: [sv-bc] nettype

From: Steven Sharp <sharp@cadence.com>
Date: Mon Dec 05 2011 - 14:34:52 PST

Daniel,

So you are simply trying to create a new identifier that is a synonym for an existing built-in nettype keyword. That could have been done, but it would be far less useful than typedefs for data types are.

A typedef does not just allow creating a synonym for a simple type. It allows you to give a name to a complex type declaration, which can be large. That saves redeclaring the complex type in multiple places, saving a large amount of text and avoiding potential errors. It also allows multiple declarations to refer to the same type, which is important for type equivalence in languages like SV that don't use a structural equivalence rule for some types. For example, if you declare two different variables by repeating the same complex struct type declaration with members that have the same names and types, they are not considered to have the same struct type in SV. So using another mechanism such as a macro for the complex type declaration would not provide the same capability as a typedef.

Since the built-in nettypes are all simple identifiers, the value of being able to rename them is limited. It doesn't significantly shorten your source code or encapsulate anything complex. The only use would be the one that you listed: the ability to change the built-in nettype used in many declarations by making a change in only one place. And if you really want to do that, you can use a macro.

The user-defined nettype proposal is not intended to provide this functionality of renaming the built-in nettypes. It is intended to support analog modeling where a single electrical signal is being represented with complex data, such as a combination of floating point values for currents, voltages and impedances. This is expected to be useful for some users. If it doesn't do anything useful for you, such as letting you rename the built-in nettypes, that doesn't mean there is something wrong with the proposal.

It may be possible to extend this feature to do some or all of what you suggest also. The fact that the nettype proposal associates a datatype with each user-defined nettype would make this more difficult, though I don't think it would be impossible. But this association of a datatype is necessary for the primary purpose of the nettypes, and that is more important than a potential minor secondary use for them.

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Daniel Mlynek
Sent: Monday, December 05, 2011 9:39 AM
To: Francoise Martinolle
Cc: sv-bc@eda.org
Subject: Re: [sv-bc] nettype

No i want simple feature equals to what can I do for data types.
Ie I want do declare a net with a data type and predefined net type

wire logic [3:0] w;

Assume that I'm using such pair in many places and I want to change the net type - to do so I would have to find each interesting occurrence and do the change is I could :

typedef_net wire mynet;
typedef reg[3:0] mytype;
mynet mytype w;

then all I need to do is to change mynet declaration.

Same idea like for types

DANiel

On 12/5/2011 3:26 PM, Francoise Martinolle wrote:
> I am trying to understand what you want to achieve.
> Do you want to "redefine' the already predefined nettype "wire" and use its
> predefined resolution for the logic datatype?
>
> Francoise
> '
>
> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Daniel Mlynek
> Sent: Wednesday, November 30, 2011 3:09 AM
> To: sv-bc@eda.org
> Subject: [sv-bc] nettype
>
> sv2012 adds nettype: mantis: 3398 . Extension define in this mantis add more possibilities but I was thinking about smth simpler.
> Now I do not have a way to define smth like typedef on net_type to achieve declaration like:
>
> typedef_net wire mynet;
> typedef reg[3:0] mytype;
> mynet mytype w;
>
> mantis 3398 will also wont help me.
>
> DANiel
>
>
> --
> This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Dec 5 14:35:32 2011

This archive was generated by hypermail 2.1.8 : Mon Dec 05 2011 - 14:35:39 PST