Skip to content

EBLIF cell parameter interpretation #1663

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

Merged
merged 8 commits into from
Mar 24, 2022

Conversation

mkurc-ant
Copy link
Collaborator

A proposed solution to #1662

  • Updated EBLIF cell parameter specification
  • Added EBLIF parameter value validation on reading
  • Added binary prefix to relevant parameters in post-routing Verilog netlist writing.

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Feb 12, 2021
@mkurc-ant mkurc-ant linked an issue Feb 12, 2021 that may be closed by this pull request
* **binary word**
Binary words are specified using strings of characters ``0`` and ``1``. No other characters are allowed. Number of characters denotes the word length.

* **real number**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is .param x 2? A real number or error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its an error. For an integer 2 you need 10, for a real 2 you need 2.0.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to make clear that 2 is illegal, because it is not a binary word (has a 2) and is not a string (no quotes) and not a real number (no .).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added clearer explanation of illegal formats

Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A few wording / variable name tweaks suggested, and one bug to fix (digit 9 would not be considered part of a real right now).

.param multiplier 0.50
.param power 001101

Would set the parameters ``feedback``, ``multipleir`` and ``power`` of the above ``pll`` ``.subckt`` to ``"internal"``, ``0.50`` and ``001101`` respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: multipleir -> multiplier

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


``.param`` statements propagate to ``<parameter>`` elements in the packed netlist.

Paramerer values propagate also to post-route Verilog netlist. Strings and real numbers are passed directly while binary words are prepended with the ``<N>'b`` prefix where ``N`` denotes a binary word length.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slight wording change:
"to the post-route Verilog netlist, if it is generated."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected.

}

bool is_real_param(const std::string& param) {
const std::string chars = "012345678.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing 9 --> need to add it to "chars".
Suggest using a more descriptive name than chars. real_chars would be better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right... stupid mistake. Fixed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it more thought and made the function use a regular expression.

.param test_latch_param "test_latch_param_value"
.param test_latch_param "test_latch_param_str_value"
.param test_latch_param_bin 00110101
.param test_latch_param_num 2.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need negative tests here!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I recommend reviewing the failure output to make sure it is possible to understand the problem from the error message. Concrete things I'd look for:

  • Is the location of the error made clear (e.g. file and line number)
  • Is there an explanation of why the input was wrong?
  • For example, missing quotes
  • A bare integer with no period

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that VPR at this point doesn't support test cases that are meant to fail (however https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/scripts/python_libs/vtr/util.py#L73-L75 allows that but this parameter is not used anywhere in the test framework).
Anyway, I tested the error output and modified it to provide more useful information.

Copy link
Collaborator

@litghost litghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments in

Parameters can have one of the three available types. Type is inferred from the format in which a parameter is provided.

* **string**
Whenever a parameter value is quoted it is considered to be a string.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to clarify that escaping rules (if any). For example what is .param "\""? Is that an error? What is it's behavior?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the external parser is not allowing escaped quote chars. In such case, VPR will throw syntax error there before the flow even gets to the logic responsible for distinguishing between 3 available formats of .param.
I modified documentation to highlight this.

@vaughnbetz
Copy link
Contributor

@mkurc-ant : just prodding on this one. It would be good to address the review comments and get this one in soon.

@mkurc-ant
Copy link
Collaborator Author

@vaughnbetz Right. I'll have some time to look into it in the second part of this week.

@lpawelcz lpawelcz force-pushed the eblif_params branch 2 times, most recently from 84d502e to faebf9d Compare January 21, 2022 13:58
@lpawelcz
Copy link
Contributor

lpawelcz commented Jan 21, 2022

Hi, I updated this PR and responded to review comments because those changes will be useful for incoming PR that will deal with #1946.

@vaughnbetz can I ask you to take a look at my updates?

@mkurc-ant mkurc-ant changed the title [WIP] EBLIF cell parameter interpretation EBLIF cell parameter interpretation Mar 16, 2022
@mkurc-ant
Copy link
Collaborator Author

@vaughnbetz Could you please take look at this PR?

@mkurc-ant mkurc-ant requested a review from sfkhalid March 22, 2022 10:52
Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cell parameters in post P&R verilog
4 participants