Fix builtin functions (!),take and RangedWord
[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 -- Numeric Operations
233
234 -- | plus operation identifier
235 plusId :: String
236 plusId = "+"
237
238 -- | times operation identifier
239 timesId :: String
240 timesId = "*"
241
242 -- | negate operation identifier
243 negateId :: String
244 negateId = "negate"
245
246 -- | minus operation identifier
247 minusId :: String
248 minusId = "-"
249
250 -- | convert sizedword to ranged
251 fromSizedWordId :: String
252 fromSizedWordId = "fromSizedWord"
253
254 toIntegerId :: String
255 toIntegerId = "to_integer"
256
257 fromIntegerId :: String
258 fromIntegerId = "fromInteger"
259
260 toSignedId :: String
261 toSignedId = "to_signed"
262
263 toUnsignedId :: String
264 toUnsignedId = "to_unsigned"
265
266 resizeId :: String
267 resizeId = "resize"
268
269 sizedIntId :: String
270 sizedIntId = "SizedInt"
271
272 tfvecId :: String
273 tfvecId = "TFVec"
274
275 -- | output file identifier (from std.textio)
276 showIdString :: String
277 showIdString = "show"
278
279 showId :: AST.VHDLId
280 showId = AST.unsafeVHDLExtId showIdString
281
282 -- | write function identifier (from std.textio)
283 writeId :: AST.VHDLId
284 writeId = AST.unsafeVHDLBasicId "write"
285
286 -- | output file identifier (from std.textio)
287 outputId :: AST.VHDLId
288 outputId = AST.unsafeVHDLBasicId "output"
289
290 ------------------
291 -- VHDL type marks
292 ------------------
293
294 -- | The Bit type mark
295 bitTM :: AST.TypeMark
296 bitTM = AST.unsafeVHDLBasicId "Bit"
297
298 -- | Stardard logic type mark
299 std_logicTM :: AST.TypeMark
300 std_logicTM = AST.unsafeVHDLBasicId "std_logic"
301
302 -- | boolean type mark
303 booleanTM :: AST.TypeMark
304 booleanTM = AST.unsafeVHDLBasicId "boolean"
305
306 -- | fsvec_index AST. TypeMark
307 tfvec_indexTM :: AST.TypeMark
308 tfvec_indexTM = AST.unsafeVHDLBasicId "tfvec_index"
309
310 -- | natural AST. TypeMark
311 naturalTM :: AST.TypeMark
312 naturalTM = AST.unsafeVHDLBasicId "natural"
313
314 -- | integer TypeMark
315 integerTM :: AST.TypeMark
316 integerTM = AST.unsafeVHDLBasicId "integer"
317
318 -- | signed TypeMark
319 signedTM :: AST.TypeMark
320 signedTM = AST.unsafeVHDLBasicId "signed"
321
322 -- | unsigned TypeMark
323 unsignedTM :: AST.TypeMark
324 unsignedTM = AST.unsafeVHDLBasicId "unsigned"
325
326 -- | string TypeMark
327 stringTM :: AST.TypeMark
328 stringTM = AST.unsafeVHDLBasicId "string"
329
330 -- | tup VHDLName suffix
331 tupVHDLSuffix :: AST.VHDLId -> AST.Suffix
332 tupVHDLSuffix id = AST.SSimple id