google / xls

XLS: Accelerated HW Synthesis
http://google.github.io/xls/
Apache License 2.0
1.17k stars 171 forks source link

Cannot map parametric function #1412

Open grebe opened 3 months ago

grebe commented 3 months ago

Mapping a parametric function doesn't work, e.g.

fn f<N:u32>(x: u32) -> u32 { N + x }
fn main() { map(u32[4]:[0, 1, 2, 3], f<u32:4>) }
proppy commented 3 months ago

Note this fails with the following error:

0002: 
0003: fn f<N:u32>(x: u32) -> u32 { N + x }
0004: fn main() { map(u32[4]:[0, 1, 2, 3], f<u32:4>) }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ ParseError: Expected '(', got ')': Expected a '(' after parametrics for function invocation.
hzeller commented 2 months ago

Also duplicate of https://github.com/google/xls/issues/1063

mikex-oss commented 2 months ago

I think #1063 is a specific case of this bug for which there can be no available workaround. I.e. you can't simply wrap the parametric instantiation because it depends on parent parameters.

This more generalized issue can be worked around as indicated in https://github.com/google/xls/issues/1063#issuecomment-1633497494.

Not sure what this means for bug management...

proppy commented 2 months ago

Let's keep this open then, and #1063 as "related" then.

Sorry for the noise :)