From 470b9fcfe0743054e2a1adb435e2806a140c732e Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 13 Apr 2010 14:39:17 +0200 Subject: [PATCH] No longer treat tfp ints as builtin types. This makes tfp ints non-representable, breaking their use as literal arguments to fromIntegerT for now. --- "c\316\273ash/CLasH/VHDL/VHDLTools.hs" | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" index 27517cd..7166630 100644 --- "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" +++ "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" @@ -148,23 +148,10 @@ mkComponentInst label entity_id portassigns = AST.CSISm compins varToVHDLExpr :: Var.Var -> TypeSession AST.Expr varToVHDLExpr var = case Id.isDataConWorkId_maybe var of - Just dc -> dataconToVHDLExpr dc -- This is a dataconstructor. - -- Not a datacon, just another signal. Perhaps we should check for - -- local/global here as well? - -- Sadly so.. tfp decimals are types, not data constructors, but instances - -- should still be translated to integer literals. It is probebly not the - -- best solution to translate them here. - -- FIXME: Find a better solution for translating instances of tfp integers - Nothing -> do - let ty = Var.varType var - case Type.splitTyConApp_maybe ty of - Just (tycon, args) -> - case Name.getOccString (TyCon.tyConName tycon) of - "Dec" -> do - len <- tfp_to_int ty - return $ AST.PrimLit (show len) - otherwise -> return $ AST.PrimName $ AST.NSimple $ varToVHDLId var + Just dc -> dataconToVHDLExpr dc + -- Not a datacon, just another signal. + Nothing -> return $ AST.PrimName $ AST.NSimple $ varToVHDLId var -- Turn a VHDLName into an AST expression vhdlNameToVHDLExpr = AST.PrimName @@ -292,8 +279,7 @@ builtin_types :: TypeMap builtin_types = Map.fromList [ (BuiltinType "Bit", Just (std_logicTM, Nothing)), - (BuiltinType "Bool", Just (booleanTM, Nothing)), -- TysWiredIn.boolTy - (BuiltinType "Dec", Just (integerTM, Nothing)) + (BuiltinType "Bool", Just (booleanTM, Nothing)) -- TysWiredIn.boolTy ] -- Is the given type representable at runtime? -- 2.30.2