xls icon indicating copy to clipboard operation
xls copied to clipboard

[dslx] Allow struct parametrics to be types other than `u32`

Open cdleary opened this issue 1 year ago • 1 comments

Right now we evaluate all parametric expressions given to a struct as u32s, but that's technically too strict a limitation -- although we only allow u32s to appear in e.g. array dimensions when building a type, you could imagine a use case like the following:

  struct Point<N: u5, N_U32: u32 = {N as u32}> {                                                                                  
    x: uN[N_U32],                                                                                                                 
  }                                                                                                                               
                                                                                                                                  
  fn f(p: Point<u5:3>) -> uN[3] {                                                                                                 
    p.y                                                                                                                           
  } 

Note that the value given as N is not used in any type definition, just as a value that we do some computation from.

Note that I'm going to land a change that overly restricts them to all be u32s at first to fix #727, then we can loosen from there.

cdleary avatar May 23 '23 21:05 cdleary