From 0dcd1ce078cbae64bc2b968b4c8233c9b94727dc Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 10 Mar 2010 13:32:07 +0100 Subject: [PATCH] Put a list of builtin functions in VHDL.Constants This will allow normalization to use this list, without creating circular dependencies by using VHDL.Generate.globalNameTable. --- "c\316\273ash/CLasH/VHDL/Constants.hs" | 16 +++++++++++++++- "c\316\273ash/CLasH/VHDL/Generate.hs" | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git "a/c\316\273ash/CLasH/VHDL/Constants.hs" "b/c\316\273ash/CLasH/VHDL/Constants.hs" index 22bf14a..b9cbb0b 100644 --- "a/c\316\273ash/CLasH/VHDL/Constants.hs" +++ "b/c\316\273ash/CLasH/VHDL/Constants.hs" @@ -3,6 +3,20 @@ module CLasH.VHDL.Constants where -- VHDL Imports import qualified Language.VHDL.AST as AST +-- | A list of all builtin functions. Partly duplicates the name table +-- in VHDL.Generate, but we can't use that map everywhere due to +-- circular dependencie. +builtinIds = [ exId, replaceId, headId, lastId, tailId, initId, takeId, dropId + , selId, plusgtId, ltplusId, plusplusId, mapId, zipWithId, foldlId + , foldrId, zipId, unzipId, shiftlId, shiftrId, rotlId, rotrId + , concatId, reverseId, iteratenId, iterateId, generatenId, generateId + , emptyId, singletonId, copynId, copyId, lengthTId, nullId + , hwxorId, hwandId, hworId, hwnotId, equalityId, inEqualityId, ltId + , lteqId, gtId, gteqId, boolOrId, boolAndId, plusId, timesId + , negateId, minusId, fromSizedWordId, fromIntegerId, resizeWordId + , resizeIntId, sizedIntId, smallIntegerId, fstId, sndId, blockRAMId + , splitId, minimumId + ] -------------- -- Identifiers -------------- @@ -376,4 +390,4 @@ stringTM = AST.unsafeVHDLBasicId "string" -- | tup VHDLName suffix tupVHDLSuffix :: AST.VHDLId -> AST.Suffix -tupVHDLSuffix id = AST.SSimple id \ No newline at end of file +tupVHDLSuffix id = AST.SSimple id diff --git "a/c\316\273ash/CLasH/VHDL/Generate.hs" "b/c\316\273ash/CLasH/VHDL/Generate.hs" index a9947a2..61e95b4 100644 --- "a/c\316\273ash/CLasH/VHDL/Generate.hs" +++ "b/c\316\273ash/CLasH/VHDL/Generate.hs" @@ -1554,7 +1554,8 @@ type BuiltinBuilder = type NameTable = Map.Map String (Int, BuiltinBuilder ) -- | The builtin functions we support. Maps a name to an argument count and a --- builder function. +-- builder function. If you add a name to this map, don't forget to add +-- it to VHDL.Constants/builtinIds as well. globalNameTable :: NameTable globalNameTable = Map.fromList [ (exId , (2, genFCall True ) ) -- 2.30.2