$bits conversion handles types with more than 1 dimension

This commit is contained in:
Zachary Snow 2019-04-02 13:44:47 -04:00
parent 86195d9ea1
commit ba7ffdf14d
1 changed files with 9 additions and 2 deletions

View File

@ -18,6 +18,13 @@ convert =
convertExpr
convertExpr :: Expr -> Expr
convertExpr (Bits (Left (IntegerVector _ _ [r]))) = rangeSize r
convertExpr (Bits (Left (Implicit _ [r]))) = rangeSize r
convertExpr (Bits (Left (IntegerVector _ _ rs))) = size rs
convertExpr (Bits (Left (Implicit _ rs))) = size rs
convertExpr other = other
size :: [Range] -> Expr
size ranges =
simplify $
foldl (BinOp Mul) (Number "1") $
map rangeSize $
ranges