rems-project / sail

Sail architecture definition language
Other
611 stars 109 forks source link

Underlying type must be a constant-width bitvector, but it is #431

Closed Timmmm closed 9 months ago

Timmmm commented 9 months ago
default Order dec

$include <prelude.sail>
$include <smt.sail>

type log2_xlen_bytes : Int = 2
type xlen_bytes : Int = 2 ^ log2_xlen_bytes
type xlen       : Int = xlen_bytes * 8
type xlenbits         = bits(xlen)

bitfield foo : xlenbits = {
  A : 0,
}

Gives:

Type error:
test.sail:11.0-13.1:
11 |bitfield foo : xlenbits = {
   |^--------------------------
13 |}
   |^
   | Underlying bitfield type must be a constant-width bitvector

But it looks pretty constant-width to me?

Alasdair commented 9 months ago

Oh, I think we are avoiding expanding out 2 ^ x that's probably what's tripping this up.

Alasdair commented 9 months ago

Should be fixed now

Timmmm commented 9 months ago

Works now, thanks!