X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FVHDL%2FVHDLTools.hs;h=1378376f0f034880a4ccba733b649acb79b09420;hb=a54863feb7304aa6a843efc15d29f017c45407f4;hp=b16da44e6f1cd2c3b7653afbbfcd7263618468c7;hpb=ca2ff678ca78a5cdbd4bc904b3075ca751018564;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" index b16da44..1378376 100644 --- "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" +++ "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" @@ -402,7 +402,7 @@ mk_tycon_ty ty tycon args = -- Throw away all empty members case Maybe.catMaybes elem_tys' of [] -> -- No non-empty members - return $ Right Nothing + return $ Right Nothing elem_tys -> do let elems = zipWith AST.ElementDec recordlabels elem_tys -- For a single construct datatype, build a record with one field for @@ -413,7 +413,8 @@ mk_tycon_ty ty tycon args = let ty_id = mkVHDLExtId $ nameToString (TyCon.tyConName tycon) ++ elem_names let ty_def = AST.TDR $ AST.RecordTypeDef elems let tupshow = mkTupleShow elem_tys ty_id - modA tsTypeFuns $ Map.insert (OrdType ty, showIdString) (showId, tupshow) + let htype = ADTType (nameToString (TyCon.tyConName tycon)) (map (\x -> StdType (OrdType x)) real_arg_tys) + modA tsTypeFuns $ Map.insert (htype, showIdString) (showId, tupshow) return $ Right $ Just (ty_id, Left ty_def) -- There were errors in element types (errors, _) -> return $ Left $ @@ -428,7 +429,8 @@ mk_tycon_ty ty tycon args = let ty_id = mkVHDLExtId $ nameToString (TyCon.tyConName tycon) let ty_def = AST.TDE $ AST.EnumTypeDef elems let enumShow = mkEnumShow elems ty_id - modA tsTypeFuns $ Map.insert (OrdType ty, showIdString) (showId, enumShow) + let htype = EnumType (nameToString (TyCon.tyConName tycon)) (map (nameToString . DataCon.dataConName) dcs) + modA tsTypeFuns $ Map.insert (htype, showIdString) (showId, enumShow) return $ Right $ Just (ty_id, Left ty_def) xs -> return $ Left $ "VHDLTools.mkTyConHType: Only enum-like constructor datatypes supported: " ++ pprString dcs ++ "\n" @@ -472,7 +474,7 @@ mk_vector_ty ty = do modA tsTypes (Map.insert (StdType $ OrdType vec_ty) (Just (vec_id, (Left vec_def)))) modA tsTypeDecls (\typedefs -> typedefs ++ [mktydecl (vec_id, (Left vec_def))]) let vecShowFuns = mkVectorShow el_ty_tm vec_id - mapM_ (\(id, subprog) -> modA tsTypeFuns $ Map.insert (OrdType vec_ty, id) ((mkVHDLExtId id), subprog)) vecShowFuns + mapM_ (\(id, subprog) -> modA tsTypeFuns $ Map.insert (StdType $ OrdType el_ty, id) ((mkVHDLExtId id), subprog)) vecShowFuns let ty_def = AST.SubtypeIn vec_id (Just range) return (Right $ Just (ty_id, Right ty_def)) -- Empty element type? Empty vector type then. TODO: Does this make sense?