From: Christiaan Baaij Date: Mon, 13 Jul 2009 09:22:43 +0000 (+0200) Subject: Only save normalized tfp integers in the tfp-cache X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=aa23b0116eaf65b01499cd1eba93a92f7c8c36e8;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Only save normalized tfp integers in the tfp-cache --- diff --git a/VHDLTools.hs b/VHDLTools.hs index a66f92d..e7c598d 100644 --- a/VHDLTools.hs +++ b/VHDLTools.hs @@ -473,9 +473,8 @@ mkHType ty = do case elem_htype_either of -- Could create element type Right elem_htype -> do - env <- getA vsHscEnv - let norm_ty = normalise_tfp_int env (tfvec_len_ty ty) - return $ Right $ VecType (OrdType norm_ty) elem_htype + len <- tfp_to_int (tfvec_len_ty ty) + return $ Right $ VecType len elem_htype -- Could not create element type Left err -> return $ Left $ "VHDLTools.mkHType: Can not construct vectortype for elementtype: " ++ pprString el_ty ++ "\n" @@ -528,10 +527,11 @@ tfp_to_int :: Type.Type -> TypeSession Int tfp_to_int ty = do lens <- getA vsTfpInts hscenv <- getA vsHscEnv - let existing_len = Map.lookup (OrdType ty) lens + let norm_ty = normalise_tfp_int hscenv ty + let existing_len = Map.lookup (OrdType norm_ty) lens case existing_len of Just len -> return len Nothing -> do let new_len = eval_tfp_int hscenv ty - modA vsTfpInts (Map.insert (OrdType ty) (new_len)) + modA vsTfpInts (Map.insert (OrdType norm_ty) (new_len)) return new_len \ No newline at end of file diff --git a/VHDLTypes.hs b/VHDLTypes.hs index b4c1d69..5562c6a 100644 --- a/VHDLTypes.hs +++ b/VHDLTypes.hs @@ -41,7 +41,7 @@ instance Ord OrdType where data HType = StdType OrdType | ADTType String [HType] | - VecType OrdType HType | + VecType Int HType | SizedWType Int | RangedWType Int | SizedIType Int |