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, shiftlId, shiftrId, 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
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
160 -- | shiftr function identifier
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
245 lengthTId = "lengthT"
256 -- Equality Operations
260 inEqualityId :: String
281 -- Numeric Operations
283 -- | plus operation identifier
287 -- | times operation identifier
291 -- | negate operation identifier
295 -- | minus operation identifier
299 -- | convert sizedword to ranged
300 fromSizedWordId :: String
301 fromSizedWordId = "fromSizedWord"
303 toIntegerId :: String
304 toIntegerId = "to_integer"
306 fromIntegerId :: String
307 fromIntegerId = "fromInteger"
310 toSignedId = "to_signed"
312 toUnsignedId :: String
313 toUnsignedId = "to_unsigned"
318 resizeWordId :: String
319 resizeWordId = "resizeWord"
321 resizeIntId :: String
322 resizeIntId = "resizeInt"
324 smallIntegerId :: String
325 smallIntegerId = "smallInteger"
328 sizedIntId = "SizedInt"
334 blockRAMId = "blockRAM"
336 -- | output file identifier (from std.textio)
337 showIdString :: String
338 showIdString = "show"
341 showId = AST.unsafeVHDLExtId showIdString
343 -- | write function identifier (from std.textio)
344 writeId :: AST.VHDLId
345 writeId = AST.unsafeVHDLBasicId "write"
347 -- | output file identifier (from std.textio)
348 outputId :: AST.VHDLId
349 outputId = AST.unsafeVHDLBasicId "output"
355 -- | The Bit type mark
356 bitTM :: AST.TypeMark
357 bitTM = AST.unsafeVHDLBasicId "Bit"
359 -- | Stardard logic type mark
360 std_logicTM :: AST.TypeMark
361 std_logicTM = AST.unsafeVHDLBasicId "std_logic"
363 -- | boolean type mark
364 booleanTM :: AST.TypeMark
365 booleanTM = AST.unsafeVHDLBasicId "boolean"
367 -- | fsvec_index AST. TypeMark
368 tfvec_indexTM :: AST.TypeMark
369 tfvec_indexTM = AST.unsafeVHDLBasicId "tfvec_index"
371 -- | natural AST. TypeMark
372 naturalTM :: AST.TypeMark
373 naturalTM = AST.unsafeVHDLBasicId "natural"
375 -- | integer TypeMark
376 integerTM :: AST.TypeMark
377 integerTM = AST.unsafeVHDLBasicId "integer"
380 signedTM :: AST.TypeMark
381 signedTM = AST.unsafeVHDLBasicId "signed"
383 -- | unsigned TypeMark
384 unsignedTM :: AST.TypeMark
385 unsignedTM = AST.unsafeVHDLBasicId "unsigned"
388 stringTM :: AST.TypeMark
389 stringTM = AST.unsafeVHDLBasicId "string"
391 -- | tup VHDLName suffix
392 tupVHDLSuffix :: AST.VHDLId -> AST.Suffix
393 tupVHDLSuffix id = AST.SSimple id