From: Christiaan Baaij Date: Fri, 19 Jun 2009 14:14:28 +0000 (+0200) Subject: Added support for (!) function X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=9de634dc821ab58cb0fbfcf9e19cd39a7081a826;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Added support for (!) function --- diff --git a/Adders.hs b/Adders.hs index d4c43ca..6cf3be5 100644 --- a/Adders.hs +++ b/Adders.hs @@ -10,6 +10,7 @@ import Prelude hiding ( import Language.Haskell.Syntax import Types import Data.Param.TFVec +import Data.RangedWord mainIO f = Sim.simulateIO (Sim.stateless f) () @@ -171,8 +172,8 @@ highordtest = \x -> in \c d -> op' d c -functiontest :: TFVec D4 Bit -> Bit -functiontest = \v -> let r = head v in r +functiontest :: TFVec D4 Bit -> RangedWord D3 -> Bit +functiontest = \v i -> let r = v!i in r highordtest2 = \a b -> case a of diff --git a/Generate.hs b/Generate.hs index 97d9488..2beacb8 100644 --- a/Generate.hs +++ b/Generate.hs @@ -26,12 +26,12 @@ genUnconsVectorFuns :: AST.TypeMark -- ^ type of the vector elements genUnconsVectorFuns elemTM vectorTM = [ AST.SubProgBody exSpec [] [exExpr] , AST.SubProgBody replaceSpec [AST.SPVD replaceVar] [replaceExpr,replaceRet] - , AST.SubProgBody headSpec [] [headExpr] - , AST.SubProgBody lastSpec [] [lastExpr] - , AST.SubProgBody initSpec [AST.SPVD initVar] [initExpr, initRet] - , AST.SubProgBody tailSpec [AST.SPVD tailVar] [tailExpr, tailRet] - , AST.SubProgBody takeSpec [AST.SPVD takeVar] [takeExpr, takeRet] - , AST.SubProgBody dropSpec [AST.SPVD dropVar] [dropExpr, dropRet] + , AST.SubProgBody headSpec [] [headExpr] + , AST.SubProgBody lastSpec [] [lastExpr] + , AST.SubProgBody initSpec [AST.SPVD initVar] [initExpr, initRet] + , AST.SubProgBody tailSpec [AST.SPVD tailVar] [tailExpr, tailRet] + , AST.SubProgBody takeSpec [AST.SPVD takeVar] [takeExpr, takeRet] + , AST.SubProgBody dropSpec [AST.SPVD dropVar] [dropExpr, dropRet] ] where ixPar = AST.unsafeVHDLBasicId "ix" diff --git a/GlobalNameTable.hs b/GlobalNameTable.hs index ef4b25e..c860dcb 100644 --- a/GlobalNameTable.hs +++ b/GlobalNameTable.hs @@ -17,6 +17,6 @@ mkGlobalNameTable = Map.fromList globalNameTable :: NameTable globalNameTable = mkGlobalNameTable - [ (show ('(V.!)) , (2, genExprFCall2L exId ) ) - , ("head" , (1, genExprFCall1L headId ) ) + [ ("!" , (2, genExprFCall2L exId ) ) + , ("head" , (1, genExprFCall1L headId ) ) ] \ No newline at end of file