Use numbers in case-selectors to reflect changes to encoding of enum types
[matthijs/master-project/cλash.git] / clash / CLasH / VHDL / VHDLTools.hs
index 6ba4d765179bf118b729744a2e29e07a09500d15..edaa5d2128ae271c782869ac5c8835aa70067f34 100644 (file)
@@ -495,7 +495,7 @@ mkTyconTy htype =
           return $ Just (ty_id, Just $ Left ty_def)
     (EnumType tycon dcs) -> do
       let ty_id = mkVHDLExtId tycon
-      let range = AST.SubTypeRange (AST.PrimLit "0") (AST.PrimLit $ show (length dcs))
+      let range = AST.SubTypeRange (AST.PrimLit "0") (AST.PrimLit $ show ((length dcs) - 1))
       let ty_def = AST.TDI $ AST.IntegerTypeDef range
       let enumShow = mkEnumShow dcs ty_id
       MonadState.modify tsTypeFuns $ Map.insert (htype, showIdString) (showId, enumShow)