1 module CLasH.VHDL.Constants where
4 import qualified Language.VHDL.AST as AST
6 -- | A list of all builtin functions. Partly duplicates the name table
7 -- in VHDL.Generate, but we can't use that map everywhere due to
8 -- circular dependencie.
9 builtinIds = [ exId, replaceId, headId, lastId, tailId, initId, takeId, dropId
10 , selId, plusgtId, ltplusId, plusplusId, mapId, zipWithId, foldlId
11 , foldrId, zipId, unzipId, shiftIntoLId, shiftIntoRId, rotlId, rotrId
12 , concatId, reverseId, iteratenId, iterateId, generatenId, generateId
13 , emptyId, singletonId, copynId, copyId, lengthTId, nullId
14 , hwxorId, hwandId, hworId, hwnotId, equalityId, inEqualityId, ltId
15 , lteqId, gtId, gteqId, boolOrId, boolAndId, plusId, timesId
16 , negateId, minusId, fromSizedWordId, fromIntegerId, resizeWordId
17 , resizeIntId, sizedIntId, smallIntegerId, fstId, sndId, blockRAMId
18 , splitId, minimumId, fromRangedWordId, xorId, shiftLId , shiftRId
24 -- | reset and clock signal identifiers in String form
25 resetStr, clockStr :: String
29 -- | reset and clock signal identifiers in basic AST.VHDLId form
30 resetId, clockId :: AST.VHDLId
31 resetId = AST.unsafeVHDLBasicId resetStr
32 clockId = AST.unsafeVHDLBasicId clockStr
34 integerId :: AST.VHDLId
35 integerId = AST.unsafeVHDLBasicId "integer"
37 -- | \"types\" identifier
39 typesId = AST.unsafeVHDLBasicId "types"
43 workId = AST.unsafeVHDLBasicId "work"
47 stdId = AST.unsafeVHDLBasicId "std"
50 -- | textio identifier
51 textioId :: AST.VHDLId
52 textioId = AST.unsafeVHDLBasicId "textio"
54 -- | range attribute identifier
56 rangeId = AST.unsafeVHDLBasicId "range"
59 -- | high attribute identifier
61 highId = AST.unsafeVHDLBasicId "high"
63 -- | range attribute identifier
65 imageId = AST.unsafeVHDLBasicId "image"
67 -- | event attribute identifie
69 eventId = AST.unsafeVHDLBasicId "event"
72 -- | default function identifier
73 defaultId :: AST.VHDLId
74 defaultId = AST.unsafeVHDLBasicId "default"
76 -- FSVec function identifiers
78 -- | ex (operator ! in original Haskell source) function identifier
82 -- | sel (function select in original Haskell source) function identifier
87 -- | ltplus (function (<+) in original Haskell source) function identifier
92 -- | plusplus (function (++) in original Haskell source) function identifier
97 -- | empty function identifier
101 -- | plusgt (function (+>) in original Haskell source) function identifier
105 -- | singleton function identifier
106 singletonId :: String
107 singletonId = "singleton"
109 -- | length function identifier
114 -- | isnull (function null in original Haskell source) function identifier
119 -- | replace function identifier
121 replaceId = "replace"
124 -- | head function identifier
129 -- | last function identifier
134 -- | init function identifier
139 -- | tail function identifier
143 -- | minimum ftp function identifier
145 minimumId = "minimum"
147 -- | take function identifier
152 -- | drop function identifier
156 -- | shiftl function identifier
157 shiftIntoLId :: String
158 shiftIntoLId = "shiftIntoL"
160 -- | shiftr function identifier
161 shiftIntoRId :: String
162 shiftIntoRId = "shiftIntoR"
164 -- | rotl function identifier
168 -- | reverse function identifier
172 -- | concatenate the vectors in a vector
176 -- | reverse function identifier
178 reverseId = "reverse"
180 -- | iterate function identifier
182 iterateId = "iterate"
184 -- | iteraten function identifier
186 iteratenId = "iteraten"
188 -- | iterate function identifier
190 generateId = "generate"
192 -- | iteraten function identifier
193 generatenId :: String
194 generatenId = "generaten"
196 -- | copy function identifier
200 -- | copyn function identifier
204 -- | map function identifier
208 -- | zipwith function identifier
210 zipWithId = "zipWith"
212 -- | foldl function identifier
216 -- | foldr function identifier
220 -- | zip function identifier
224 -- | unzip function identifier
228 -- | hwxor function identifier
232 -- | hwor function identifier
236 -- | hwnot function identifier
240 -- | hwand function identifier
254 lengthTId = "lengthT"
265 -- Equality Operations
269 inEqualityId :: String
293 -- Numeric Operations
295 -- | plus operation identifier
299 -- | times operation identifier
303 -- | negate operation identifier
307 -- | minus operation identifier
311 -- | convert sizedword to ranged
312 fromSizedWordId :: String
313 fromSizedWordId = "fromUnsigned"
315 fromRangedWordId :: String
316 fromRangedWordId = "fromIndex"
318 toIntegerId :: String
319 toIntegerId = "to_integer"
321 fromIntegerId :: String
322 fromIntegerId = "fromInteger"
325 toSignedId = "to_signed"
327 toUnsignedId :: String
328 toUnsignedId = "to_unsigned"
333 resizeWordId :: String
334 resizeWordId = "resizeWord"
336 resizeIntId :: String
337 resizeIntId = "resizeInt"
339 smallIntegerId :: String
340 smallIntegerId = "smallInteger"
343 sizedIntId = "Signed"
349 blockRAMId = "blockRAM"
351 -- | output file identifier (from std.textio)
352 showIdString :: String
353 showIdString = "show"
356 showId = AST.unsafeVHDLExtId showIdString
358 -- | write function identifier (from std.textio)
359 writeId :: AST.VHDLId
360 writeId = AST.unsafeVHDLBasicId "write"
362 -- | output file identifier (from std.textio)
363 outputId :: AST.VHDLId
364 outputId = AST.unsafeVHDLBasicId "output"
370 -- | The Bit type mark
371 bitTM :: AST.TypeMark
372 bitTM = AST.unsafeVHDLBasicId "Bit"
374 -- | Stardard logic type mark
375 std_logicTM :: AST.TypeMark
376 std_logicTM = AST.unsafeVHDLBasicId "std_logic"
378 -- | boolean type mark
379 booleanTM :: AST.TypeMark
380 booleanTM = AST.unsafeVHDLBasicId "boolean"
382 -- | fsvec_index AST. TypeMark
383 tfvec_indexTM :: AST.TypeMark
384 tfvec_indexTM = AST.unsafeVHDLBasicId "tfvec_index"
386 -- | natural AST. TypeMark
387 naturalTM :: AST.TypeMark
388 naturalTM = AST.unsafeVHDLBasicId "natural"
390 -- | integer TypeMark
391 integerTM :: AST.TypeMark
392 integerTM = AST.unsafeVHDLBasicId "integer"
395 signedTM :: AST.TypeMark
396 signedTM = AST.unsafeVHDLBasicId "signed"
398 -- | unsigned TypeMark
399 unsignedTM :: AST.TypeMark
400 unsignedTM = AST.unsafeVHDLBasicId "unsigned"
403 stringTM :: AST.TypeMark
404 stringTM = AST.unsafeVHDLBasicId "string"
406 -- | tup VHDLName suffix
407 tupVHDLSuffix :: AST.VHDLId -> AST.Suffix
408 tupVHDLSuffix id = AST.SSimple id