X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Generate.hs;h=264f4e350099eef9dae70ccffe02f2360eef555f;hb=7c32f78c85d0f73be7d5d436ae4ff1075c282f03;hp=22795440fe81daf4ecfc7ba26546ae20ca695a88;hpb=500eeddbc234537b7453f7368387977ad83f0262;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Generate.hs b/Generate.hs index 2279544..264f4e3 100644 --- a/Generate.hs +++ b/Generate.hs @@ -41,8 +41,8 @@ genMapCall :: genMapCall entity [arg, res] = genSm where -- Setup the generate scheme - len = getVectorLen res - label = mkVHDLExtId ("mapVector" ++ (bndrToString res)) + len = (tfvec_len . Var.varType) res + label = mkVHDLExtId ("mapVector" ++ (varToString res)) nPar = AST.unsafeVHDLBasicId "n" range = AST.ToRange (AST.PrimLit "0") (AST.PrimLit $ show (len-1)) genScheme = AST.ForGn nPar range @@ -51,13 +51,13 @@ genMapCall entity [arg, res] = genSm argport = map (Monad.liftM fst) (ent_args entity) resport = (Monad.liftM fst) (ent_res entity) -- Assign the ports - inport = mkAssocElemIndexed (head argport) (bndrToString arg) nPar - outport = mkAssocElemIndexed resport (bndrToString res) nPar + inport = mkAssocElemIndexed (head argport) (varToString arg) nPar + outport = mkAssocElemIndexed resport (varToString res) nPar clk_port = mkAssocElem (Just $ mkVHDLExtId "clk") "clk" portassigns = Maybe.catMaybes [inport,outport,clk_port] -- Generate the portmap mapLabel = "map" ++ (AST.fromVHDLId entity_id) - compins = genComponentInst mapLabel entity_id portassigns + compins = mkComponentInst mapLabel entity_id portassigns -- Return the generate functions genSm = AST.GenerateSm label genScheme [] [compins] @@ -74,7 +74,7 @@ genUnconsVectorFuns elemTM vectorTM = , AST.SubProgBody takeSpec [AST.SPVD takeVar] [takeExpr, takeRet] , AST.SubProgBody dropSpec [AST.SPVD dropVar] [dropExpr, dropRet] , AST.SubProgBody plusgtSpec [AST.SPVD plusgtVar] [plusgtExpr, plusgtRet] - , AST.SubProgBody emptySpec [AST.SPVD emptyVar] [emptyExpr] + , AST.SubProgBody emptySpec [AST.SPCD emptyVar] [emptyExpr] , AST.SubProgBody singletonSpec [AST.SPVD singletonVar] [singletonRet] , AST.SubProgBody copySpec [AST.SPVD copyVar] [copyExpr] ] @@ -217,12 +217,9 @@ genUnconsVectorFuns elemTM vectorTM = plusgtRet = AST.ReturnSm (Just $ AST.PrimName $ AST.NSimple resId) emptySpec = AST.Function emptyId [] vectorTM emptyVar = - AST.VarDec resId - (AST.SubtypeIn vectorTM - (Just $ AST.ConstraintIndex $ AST.IndexConstraint - [AST.ToRange (AST.PrimLit "0") - (AST.PrimLit "-1")])) - Nothing + AST.ConstDec resId + (AST.SubtypeIn vectorTM Nothing) + (Just $ AST.PrimLit "\"\"") emptyExpr = AST.ReturnSm (Just $ AST.PrimName (AST.NSimple resId)) singletonSpec = AST.Function singletonId [AST.IfaceVarDec aPar elemTM ] vectorTM @@ -248,4 +245,4 @@ genUnconsVectorFuns elemTM vectorTM = (Just $ AST.Aggregate [AST.ElemAssoc (Just AST.Others) (AST.PrimName $ AST.NSimple aPar)]) -- return res - copyExpr = AST.ReturnSm (Just $ AST.PrimName $ AST.NSimple resId) \ No newline at end of file + copyExpr = AST.ReturnSm (Just $ AST.PrimName $ AST.NSimple resId)