Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Verilog 2001 attributes? #5

Open
mithro opened this issue Feb 21, 2018 · 1 comment
Open

Support for Verilog 2001 attributes? #5

mithro opened this issue Feb 21, 2018 · 1 comment

Comments

@mithro
Copy link

mithro commented Feb 21, 2018

So I saw in #3 that you are looking at trying to keep hdlparse simple and targeted at just being used for documentation generation.

In the IEEE Verilog 1364-2001 standard, an attribute is a way to add information to a Verilog object, statement or groups of statements that is tool-specific and does not affect simulation of that design. All Verilog-2001 attributes begin with the token (* and end with the token *). An attribute can be multi-line and is "attached" to the Verilog object, statement, or group of statements that is specified immediately beneath the attribute.

An example of an attribute is shown below;

(* preserve *) reg my_reg;

I think these attributes would be super useful to be included in documentation. In fact, I think you could probably use attributes for the "symbol-sections" inside Symbolator.

From reading the following page it seems fairly standard to support using attributes or special comment forms for specifying this type of special information. See below;

To use a synthesis attribute or directive in a Verilog Design File you can use the (* and *) delimiters. For example, you can use the following code to use the preserve synthesis attribute:

(* preserve *) reg my_reg;

You can also use a synthesis attribute or directive if you specify the synthesis attribute or directive in a comment in the file. The comment can use one of the following formats:

/* <comment> */
// <comment>

For example, you can use the following comment to use the preserve synthesis attribute in a Verilog Design File:

reg my_reg /* synthesis preserve */;

To use more than one synthesis attribute and/or directive for a single node, separate the synthesis attributes and/or directives with a space. For example, you can use the following comment to use the maxfan and preserve synthesis attributes for a single node:

reg my_reg /* synthesis maxfan = 16 preserve */;

Looking at this page these attributes can also be useful for adding more information about things like finite state machines;

 (* covered_fsm, channel, is="state", os="next_state",
                           trans="STATE_IDLE->STATE_IDLE",
                           trans="STATE_IDLE->STATE_HEAD",
                           trans="STATE_HEAD->STATE_DATA",
                           trans="STATE_HEAD->STATE_TAIL",
                           trans="STATE_DATA->STATE_DATA",
                           trans="STATE_DATA->STATE_TAIL",
                           trans="STATE_TAIL->STATE_HEAD",
                           trans="STATE_TAIL->STATE_IDLE" *)
  always @(reset or state or head or tail or valid)
    ...

Would you accept a patch which adds support for these?

@tejaverilogattribute
Copy link

hi all,
i'm trying to write the pin_numbers synthesis attribute

i tried like this:
(* synthesis pin_numbers = "143" *) input in;

showing an error, can anyone help?

michael-etzkorn referenced this issue in hdl/pyHDLParser Oct 2, 2021
…es (#5)

* Add comment for param_desc attribute of class VhdlParameter
* Add VhdlParameterType class to support vector and array parameter types
* Support end entity with entity keyword and name
* Improve pattern for array_range_val
* Make it Python3 friendly

Co-authored-by: Katharina Ceesay-Seitz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants