google / google/xls

Make the data of receive ops with predicates equal to 'false' reduce to literals

Open
#787 1 comment 0 reactions 0 assignees View on GitHub
enhancement optimizer
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

For example:

```
package sample

file_number 0 "fake_file.x"

chan sample__x3(bits[34], id=0, kind=streaming, ops=receive_only, flow_control=ready_valid, metadata="""""")
chan sample__x8(bits[50], id=1, kind=streaming, ops=send_only, flow_control=ready_valid, metadata="""""")
chan sample__x28(bits[34], id=2, kind=streaming, ops=send_only, flow_control=ready_valid, metadata="""""")

top proc __sample__main_0_next(__token: token, __state: bits[50], init={0}) {
literal.5: bits[1] = literal(value=0, id=5, pos=[(0,13,48)])
x4: (token, bits[34]) = receive(__token, predicate=literal.5, channel_id=0, id=6)
x5: token = tuple_index(x4, index=0, id=9, pos=[(0,14,22)])
x9: token = send(__token, __state, channel_id=1, id=14)
x26: token = after_all(x5, x9, id=70)
x15: bits[34] = tuple_index(x4, index=1, id=24, pos=[(0,23,21)])
x29: token = send(x26, x15, channel_id=2, id=72)
after_all.74: token = after_all(__token, x5, x9, x26, x29, id=74)
next (after_all.74, __state)
}
```

The return of the receive op can be a literal of bits[34]:0.

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.