google / google/xls

Clarify fail!() semantics/behavior

Open
#470 2 comments 0 reactions 0 assignees View on GitHub
dslx investigation
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

We recently had some confusion over the behavior of the fail() predicate in XLS.

Consider the pseudo DSLX:
```
fn foo(a: u32) -> bool {
let x = bar(a); <-- Will fail!() on a == alpha
let y = baz(a); <-- Will never fail!()
y if a == alpha else x
}
```

A user expected that this code would never fail, whereas our targeted use case was that it would not. Our understanding is that the sort-of matching pseudoSystemVerilog could also fail:
```
module foo
input a;
output o;
X = bar(a); <= asserts on input alpha
Y = baz(a); <= does not assert on alpha
o = Y if a == alpha else X
endmodule
```

I'll double-check that SV's behavior matches our expectations, and if so, I'll update our docs to make that clear, I suppose.
If it does NOT match our expectations, then...ick.

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.