Fix bug with generating head and tail functions. Update builtin resize function
[matthijs/master-project/cλash.git] / cλash / CLasH / VHDL / Constants.hs
1 module CLasH.VHDL.Constants where
2   
3 import qualified Language.VHDL.AST as AST
4
5 --------------
6 -- Identifiers
7 --------------
8
9 -- | reset and clock signal identifiers in String form
10 resetStr, clockStr :: String
11 resetStr = "resetn"
12 clockStr = "clock"
13
14 -- | reset and clock signal identifiers in basic AST.VHDLId form
15 resetId, clockId :: AST.VHDLId
16 resetId = AST.unsafeVHDLBasicId resetStr
17 clockId = AST.unsafeVHDLBasicId clockStr
18
19 integerId :: AST.VHDLId
20 integerId = AST.unsafeVHDLBasicId "integer"
21
22 -- | \"types\" identifier
23 typesId :: AST.VHDLId
24 typesId = AST.unsafeVHDLBasicId "types"
25
26 -- | work identifier
27 workId :: AST.VHDLId
28 workId = AST.unsafeVHDLBasicId "work"
29
30 -- | std identifier
31 stdId :: AST.VHDLId
32 stdId = AST.unsafeVHDLBasicId "std"
33
34
35 -- | textio identifier
36 textioId :: AST.VHDLId
37 textioId = AST.unsafeVHDLBasicId "textio"
38
39 -- | range attribute identifier
40 rangeId :: AST.VHDLId
41 rangeId = AST.unsafeVHDLBasicId "range"
42
43
44 -- | high attribute identifier
45 highId :: AST.VHDLId
46 highId = AST.unsafeVHDLBasicId "high"
47
48 -- | range attribute identifier
49 imageId :: AST.VHDLId
50 imageId = AST.unsafeVHDLBasicId "image"
51
52 -- | event attribute identifie
53 eventId :: AST.VHDLId
54 eventId = AST.unsafeVHDLBasicId "event"
55
56
57 -- | default function identifier
58 defaultId :: AST.VHDLId
59 defaultId = AST.unsafeVHDLBasicId "default"
60
61 -- FSVec function identifiers
62
63 -- | ex (operator ! in original Haskell source) function identifier
64 exId :: String
65 exId = "!"
66
67 -- | sel (function select in original Haskell source) function identifier
68 selId :: String
69 selId = "select"
70
71
72 -- | ltplus (function (<+) in original Haskell source) function identifier
73 ltplusId :: String
74 ltplusId = "<+"
75
76
77 -- | plusplus (function (++) in original Haskell source) function identifier
78 plusplusId :: String
79 plusplusId = "++"
80
81
82 -- | empty function identifier
83 emptyId :: String
84 emptyId = "empty"
85
86 -- | plusgt (function (+>) in original Haskell source) function identifier
87 plusgtId :: String
88 plusgtId = "+>"
89
90 -- | singleton function identifier
91 singletonId :: String
92 singletonId = "singleton"
93
94 -- | length function identifier
95 lengthId :: String
96 lengthId = "length"
97
98
99 -- | isnull (function null in original Haskell source) function identifier
100 nullId :: String
101 nullId = "null"
102
103
104 -- | replace function identifier
105 replaceId :: String
106 replaceId = "replace"
107
108
109 -- | head function identifier
110 headId :: String
111 headId = "head"
112
113
114 -- | last function identifier
115 lastId :: String
116 lastId = "last"
117
118
119 -- | init function identifier
120 initId :: String
121 initId = "init"
122
123
124 -- | tail function identifier
125 tailId :: String
126 tailId = "tail"
127
128 -- | minimum ftp function identifier
129 minimumId :: String
130 minimumId = "minimum"
131
132 -- | take function identifier
133 takeId :: String
134 takeId = "take"
135
136
137 -- | drop function identifier
138 dropId :: String
139 dropId = "drop"
140
141 -- | shiftl function identifier
142 shiftlId :: String
143 shiftlId = "shiftl"
144
145 -- | shiftr function identifier
146 shiftrId :: String
147 shiftrId = "shiftr"
148
149 -- | rotl function identifier
150 rotlId :: String
151 rotlId = "rotl"
152
153 -- | reverse function identifier
154 rotrId :: String
155 rotrId = "rotr"
156
157 -- | concatenate the vectors in a vector
158 concatId :: String
159 concatId = "concat"
160
161 -- | reverse function identifier
162 reverseId :: String
163 reverseId = "reverse"
164
165 -- | iterate function identifier
166 iterateId :: String
167 iterateId = "iterate"
168
169 -- | iteraten function identifier
170 iteratenId :: String
171 iteratenId = "iteraten"
172
173 -- | iterate function identifier
174 generateId :: String
175 generateId = "generate"
176
177 -- | iteraten function identifier
178 generatenId :: String
179 generatenId = "generaten"
180
181 -- | copy function identifier
182 copyId :: String
183 copyId = "copy"
184
185 -- | copyn function identifier
186 copynId :: String
187 copynId = "copyn"
188
189 -- | map function identifier
190 mapId :: String
191 mapId = "map"
192
193 -- | zipwith function identifier
194 zipWithId :: String
195 zipWithId = "zipWith"
196
197 -- | foldl function identifier
198 foldlId :: String
199 foldlId = "foldl"
200
201 -- | foldr function identifier
202 foldrId :: String
203 foldrId = "foldr"
204
205 -- | zip function identifier
206 zipId :: String
207 zipId = "zip"
208
209 -- | unzip function identifier
210 unzipId :: String
211 unzipId = "unzip"
212
213 -- | hwxor function identifier
214 hwxorId :: String
215 hwxorId = "hwxor"
216
217 -- | hwor function identifier
218 hworId :: String
219 hworId = "hwor"
220
221 -- | hwnot function identifier
222 hwnotId :: String
223 hwnotId = "hwnot"
224
225 -- | hwand function identifier
226 hwandId :: String
227 hwandId = "hwand"
228
229 lengthTId :: String
230 lengthTId = "lengthT"
231
232 fstId :: String
233 fstId = "fst"
234
235 sndId :: String
236 sndId = "snd"
237
238 -- Equality Operations
239 equalityId :: String
240 equalityId = "=="
241
242 inEqualityId :: String
243 inEqualityId = "/="
244
245 gtId :: String
246 gtId = ">"
247
248 ltId :: String
249 ltId = "<"
250
251 gteqId :: String
252 gteqId = ">="
253
254 lteqId :: String
255 lteqId = "<="
256
257 boolOrId :: String
258 boolOrId = "||"
259
260 boolAndId :: String
261 boolAndId = "&&"
262
263 -- Numeric Operations
264
265 -- | plus operation identifier
266 plusId :: String
267 plusId = "+"
268
269 -- | times operation identifier
270 timesId :: String
271 timesId = "*"
272
273 -- | negate operation identifier
274 negateId :: String
275 negateId = "negate"
276
277 -- | minus operation identifier
278 minusId :: String
279 minusId = "-"
280
281 -- | convert sizedword to ranged
282 fromSizedWordId :: String
283 fromSizedWordId = "fromSizedWord"
284
285 toIntegerId :: String
286 toIntegerId = "to_integer"
287
288 fromIntegerId :: String
289 fromIntegerId = "fromInteger"
290
291 toSignedId :: String
292 toSignedId = "to_signed"
293
294 toUnsignedId :: String
295 toUnsignedId = "to_unsigned"
296
297 resizeId :: String
298 resizeId = "resize"
299
300 resizeWordId :: String
301 resizeWordId = "resizeWord"
302
303 resizeIntId :: String
304 resizeIntId = "resizeInt"
305
306 smallIntegerId :: String
307 smallIntegerId = "smallInteger"
308
309 sizedIntId :: String
310 sizedIntId = "SizedInt"
311
312 tfvecId :: String
313 tfvecId = "TFVec"
314
315 blockRAMId :: String
316 blockRAMId = "blockRAM"
317
318 -- | output file identifier (from std.textio)
319 showIdString :: String
320 showIdString = "show"
321
322 showId :: AST.VHDLId
323 showId = AST.unsafeVHDLExtId showIdString
324
325 -- | write function identifier (from std.textio)
326 writeId :: AST.VHDLId
327 writeId = AST.unsafeVHDLBasicId "write"
328
329 -- | output file identifier (from std.textio)
330 outputId :: AST.VHDLId
331 outputId = AST.unsafeVHDLBasicId "output"
332
333 ------------------
334 -- VHDL type marks
335 ------------------
336
337 -- | The Bit type mark
338 bitTM :: AST.TypeMark
339 bitTM = AST.unsafeVHDLBasicId "Bit"
340
341 -- | Stardard logic type mark
342 std_logicTM :: AST.TypeMark
343 std_logicTM = AST.unsafeVHDLBasicId "std_logic"
344
345 -- | boolean type mark
346 booleanTM :: AST.TypeMark
347 booleanTM = AST.unsafeVHDLBasicId "boolean"
348
349 -- | fsvec_index AST. TypeMark
350 tfvec_indexTM :: AST.TypeMark
351 tfvec_indexTM = AST.unsafeVHDLBasicId "tfvec_index"
352
353 -- | natural AST. TypeMark
354 naturalTM :: AST.TypeMark
355 naturalTM = AST.unsafeVHDLBasicId "natural"
356
357 -- | integer TypeMark
358 integerTM :: AST.TypeMark
359 integerTM = AST.unsafeVHDLBasicId "integer"
360
361 -- | signed TypeMark
362 signedTM :: AST.TypeMark
363 signedTM = AST.unsafeVHDLBasicId "signed"
364
365 -- | unsigned TypeMark
366 unsignedTM :: AST.TypeMark
367 unsignedTM = AST.unsafeVHDLBasicId "unsigned"
368
369 -- | string TypeMark
370 stringTM :: AST.TypeMark
371 stringTM = AST.unsafeVHDLBasicId "string"
372
373 -- | tup VHDLName suffix
374 tupVHDLSuffix :: AST.VHDLId -> AST.Suffix
375 tupVHDLSuffix id = AST.SSimple id