intel / intel/rohd-hcl

Shifting by constants produces complex names when using << versus >>>

Open
#234 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
115
Forks
39
Avg merge
1d 13h
Merged PRs (30d)
1

Description

### Motivation

```dart
final tShift = (t << 1).named('tShift');
final tBarShift = (~t << 1).named('tBarShift');
final zBarShift = (~z >>> 1).named('zBarShift');
final gBarShift = (~g >>> 1).named('gBarShift');
```
produces
```Verilog
assign tShift = t << _shiftAmount_const_8_h1;
assign tBarShift = ~t << _shiftAmount_const_8_h1_0;
assign zBarShift = ~z >> 1'h1;
assign gBarShift = ~g >> 1'h1;
```

### Desired solution

It would be nice to see
```Verilog
assign tShift = t << 1'h1;
```

### Alternatives considered

_No response_

### Additional details

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the Dart example from the issue and compare the generated Verilog for left and right shifts, especially the constant forms. Trace the shift-expression code-generation path and verify that constant shifts produce the desired compact Verilog without unnecessary generated names.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers, embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.