From: Christiaan Baaij Date: Thu, 13 Aug 2009 16:03:30 +0000 (+0200) Subject: Hopefully generate completely unique varNames now (also for comp_ins labels) X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=53dde2157115e5212dd8991208b57c46a7b3a44a;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Hopefully generate completely unique varNames now (also for comp_ins labels) --- diff --git "a/c\316\273ash/CLasH/VHDL/Generate.hs" "b/c\316\273ash/CLasH/VHDL/Generate.hs" index 0be4f60..ba84747 100644 --- "a/c\316\273ash/CLasH/VHDL/Generate.hs" +++ "b/c\316\273ash/CLasH/VHDL/Generate.hs" @@ -863,7 +863,7 @@ genApplication dst f args = do let entity_id = ent_id signature -- TODO: Using show here isn't really pretty, but we'll need some -- unique-ish value... - let label = "comp_ins_" ++ (either show prettyShow) dst + let label = "comp_ins_" ++ (either (prettyShow . varToVHDLName) prettyShow) dst let portmaps = mkAssocElems args' ((either varToVHDLName id) dst) signature return ([mkComponentInst label entity_id portmaps], [f]) False -> do diff --git "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" index 2cd647b..0d95f55 100644 --- "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" +++ "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" @@ -5,6 +5,7 @@ module CLasH.VHDL.VHDLTools where import qualified Maybe import qualified Data.Either as Either import qualified Data.List as List +import qualified Data.Char as Char import qualified Data.Map as Map import qualified Control.Monad as Monad import qualified Control.Arrow as Arrow @@ -183,7 +184,10 @@ dataconToVHDLExpr dc = AST.PrimLit lit varToVHDLId :: CoreSyn.CoreBndr -> AST.VHDLId -varToVHDLId var = mkVHDLExtId $ (varToString var ++ varToStringUniq var) +varToVHDLId var = mkVHDLExtId $ (varToString var ++ varToStringUniq var ++ (show $ lowers $ varToStringUniq var)) + where + lowers :: String -> Int + lowers xs = length [x | x <- xs, Char.isLower x] -- Creates a VHDL Name from a binder varToVHDLName ::