From: christiaanb Date: Mon, 21 Jun 2010 11:33:51 +0000 (+0200) Subject: adtShow now calls vhdl show function to show the constructor X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=5594e632ef0aa31926c5533cd67fef8b56b088b1;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git adtShow now calls vhdl show function to show the constructor --- diff --git a/clash/CLasH/VHDL/VHDLTools.hs b/clash/CLasH/VHDL/VHDLTools.hs index 507fe3b..6ba4d76 100644 --- a/clash/CLasH/VHDL/VHDLTools.hs +++ b/clash/CLasH/VHDL/VHDLTools.hs @@ -645,18 +645,16 @@ mkAdtShow conLbl conIds elemIdss adtTM = AST.SubProgBody showSpec [] [showExpr] where adtPar = AST.unsafeVHDLBasicId "adt" showSpec = AST.Function showId [AST.IfaceVarDec adtPar adtTM] stringTM - showExpr = AST.CaseSm (AST.PrimName $ AST.NSelected $ (AST.NSimple adtPar) AST.:.: (AST.SSimple $ (mkVHDLBasicId conLbl))) - [AST.CaseSmAlt [AST.ChoiceE $ AST.PrimLit $ show x] [AST.ReturnSm (Just $ ((AST.PrimLit $ '"':(conIds!!x)++[' ','"'])) AST.:&: showFields x)] | x <- [0..(length conIds) -1]] + showExpr = AST.CaseSm ((selectedName adtPar) (mkVHDLBasicId conLbl)) + [AST.CaseSmAlt [AST.ChoiceE $ AST.PrimLit $ show x] + [AST.ReturnSm (Just $ ((genExprFCall showId) . (selectedName adtPar) $ mkVHDLBasicId conLbl) AST.:&: showFields x)] | x <- [0..(length conIds) -1]] showFields i = if (null (elemIdss!!i)) then AST.PrimLit "''" else - foldr1 (\e1 e2 -> e1 AST.:&: AST.PrimLit "' '" AST.:&: e2) $ - map ((genExprFCall showId). - AST.PrimName . - AST.NSelected . - (AST.NSimple adtPar AST.:.:). - tupVHDLSuffix) - (map mkVHDLBasicId (elemIdss!!i)) + foldr1 (\e1 e2 -> e1 AST.:&: e2) $ + map ((AST.PrimLit "' '" AST.:&:) . (genExprFCall showId) . (selectedName adtPar)) + (map mkVHDLBasicId (elemIdss!!i)) + selectedName par = (AST.PrimName . AST.NSelected . (AST.NSimple par AST.:.:) . tupVHDLSuffix) mkEnumShow :: [String]