Comments (6)
Personally, I think to make the expression clearer, the tool should not remove parentheses.
Can you help me understand your downstream use case where the existing output of sv2v doesn't suit your needs? Are you feeding it into a downstream tool? Editing the generated output manually? Something else?
from sv2v.
@zachjs I used Spyglass to check the .v code generated by SV2V and encountered the warning WRN_61 (547): Parentheses should be used with the reduction AND operator following the bitwise AND operator [a&(&b)]. I think you shouldn't remove the parentheses in this case; it both conforms to the standard and provides clarity for designers
from sv2v.
sv2v's frontend, where the text is turned into an AST, doesn't distinguish x = y;
from x = (y);
from x = ((((y))));
. In this sense, certain parentheses are always "removed". I do not intend to adjust sv2v's frontend to preserve such parentheses.
Instead, we could change the behavior of sv2v's backend, where the converted AST is turned back into text, to adhere to some particular stylistic preferences.
Can you confirm that you are requesting only these two specific stylistic changes, where x
and y
are arbitrary expressions?
x | |y
=>x | (|y)
x & &y
=>x & (&y)
I personally disagree with Spyglass here, but I'm willing to make changes to sv2v's backend where the complexity is low and the scope is narrow. Though I might implement the above request, I do not necessarily intend to make sv2v's output Spyglass compliant.
I'm also not really sure that the existing output is unclear. There are at least a few other cases in SystemVerilog where spacing distinguishes between two valid parses.
x ^~ y
vs.x ^ ~ y
x <<< y
vs.x << < y
x >>> y
vs.x >> < y
from sv2v.
@zachjs I completely agree with you on this. It's just a warning in Spyglass, not a big concern. However, I think, for code readability, it would be beneficial to include parentheses for frequently used operations to avoid misunderstandings (even though it already has spaces for distinction). It also reduces warnings for downstream tool.
I think changing just these two specific stylistic elements is sufficient
- x | |y ==> x | (|y)
- x & &y ==> x & (&y)
I believe its scope is quite narrow and only slightly adjusts the code representation. So, it would be great if you're willing to make these changes. Thank you !!!
from sv2v.
I just pushed 9825bb9 to make this change. Please let me know if it works for you.
from sv2v.
I'm closing this because I think the original request is now satisfied. Please let me know if you have further issues!
from sv2v.
Related Issues (20)
- Streaming operator is not converted when combined with conditional operator HOT 2
- Would you please implement those enum methods for SystemVerilog ? HOT 1
- fork-join with wait produce a parse error HOT 2
- Different types in generate branches results in error HOT 2
- Converted Verilog Outputs Different Result Compared to Original SysVerilog HOT 3
- Width extension converts string to int and changes endianess / byte order HOT 2
- Option to Convert Procedural Blocks to Modules
- Support for `unique` and `priority`
- Mutidimensional Packed Arrays Handler Does Not Match Commercial Synthesis Tools HOT 1
- Token '#' issue in wire definition and assignment HOT 1
- Convert severity tasks to Verilog HOT 3
- Automatic Function Produces Construct with Infinite Loop in Yosys HOT 4
- LLVM dependency HOT 4
- Parse error on disable in named block HOT 4
- File name too long HOT 3
- regarding system verilog to verilog HOT 8
- How to build on GNU/Linux on ppc64? HOT 8
- How to build on GNU/Linux on arm64? HOT 15
- Build fails on MacOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sv2v.