intel / intel/rohd

Omit redundant parentheses in generated SystemVerilog

Open
#552 2 comments 0 reactions 1 assignee Claimed by @gus-bonilla-86 View on GitHub
enhancement help wanted
Dominant language
Dart
Stars
489
Forks
88
Avg merge
3d 23h
Merged PRs (30d)
10

Description

### Motivation

There are a handful of cases where generated SystemVerilog has too many parentheses. Currently, they are added conservatively for safety, to ensure order of operations and evaluation matches the generated intent. With some knowledge about the context in which an expression is placed, it should be possible to omit (at least some) unnecessary parentheses.

A couple examples:

```SystemVerilog
// module instantation
my_mod inst1(
.a_0((a[0]))
);
```

```SystemVerilog
// chained operators
assign a = (b & (c & (d & e)));
```

It's important to maintain parentheses sometimes, especially when it helps disambiguate order of operations to the user. Maybe, for example, keep `&` and `|` terms separated by parentheses? This is a bit subjective -- perhaps there exist some other recommendations in other languages/contexts.

### Desired solution

Omit "unnecessary" parentheses in generated SystemVerilog

### Alternatives considered

_No response_

### Additional details

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.