Add builtin blockRAM primitive
[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 boolOrId :: String
246 boolOrId = "||"
247
248 boolAndId :: String
249 boolAndId = "&&"
250
251 -- Numeric Operations
252
253 -- | plus operation identifier
254 plusId :: String
255 plusId = "+"
256
257 -- | times operation identifier
258 timesId :: String
259 timesId = "*"
260
261 -- | negate operation identifier
262 negateId :: String
263 negateId = "negate"
264
265 -- | minus operation identifier
266 minusId :: String
267 minusId = "-"
268
269 -- | convert sizedword to ranged
270 fromSizedWordId :: String
271 fromSizedWordId = "fromSizedWord"
272
273 toIntegerId :: String
274 toIntegerId = "to_integer"
275
276 fromIntegerId :: String
277 fromIntegerId = "fromInteger"
278
279 toSignedId :: String
280 toSignedId = "to_signed"
281
282 toUnsignedId :: String
283 toUnsignedId = "to_unsigned"
284
285 resizeId :: String
286 resizeId = "resize"
287
288 smallIntegerId :: String
289 smallIntegerId = "smallInteger"
290
291 sizedIntId :: String
292 sizedIntId = "SizedInt"
293
294 tfvecId :: String
295 tfvecId = "TFVec"
296
297 blockRAMId :: String
298 blockRAMId = "blockRAM"
299
300 -- | output file identifier (from std.textio)
301 showIdString :: String
302 showIdString = "show"
303
304 showId :: AST.VHDLId
305 showId = AST.unsafeVHDLExtId showIdString
306
307 -- | write function identifier (from std.textio)
308 writeId :: AST.VHDLId
309 writeId = AST.unsafeVHDLBasicId "write"
310
311 -- | output file identifier (from std.textio)
312 outputId :: AST.VHDLId
313 outputId = AST.unsafeVHDLBasicId "output"
314
315 ------------------
316 -- VHDL type marks
317 ------------------
318
319 -- | The Bit type mark
320 bitTM :: AST.TypeMark
321 bitTM = AST.unsafeVHDLBasicId "Bit"
322
323 -- | Stardard logic type mark
324 std_logicTM :: AST.TypeMark
325 std_logicTM = AST.unsafeVHDLBasicId "std_logic"
326
327 -- | boolean type mark
328 booleanTM :: AST.TypeMark
329 booleanTM = AST.unsafeVHDLBasicId "boolean"
330
331 -- | fsvec_index AST. TypeMark
332 tfvec_indexTM :: AST.TypeMark
333 tfvec_indexTM = AST.unsafeVHDLBasicId "tfvec_index"
334
335 -- | natural AST. TypeMark
336 naturalTM :: AST.TypeMark
337 naturalTM = AST.unsafeVHDLBasicId "natural"
338
339 -- | integer TypeMark
340 integerTM :: AST.TypeMark
341 integerTM = AST.unsafeVHDLBasicId "integer"
342
343 -- | signed TypeMark
344 signedTM :: AST.TypeMark
345 signedTM = AST.unsafeVHDLBasicId "signed"
346
347 -- | unsigned TypeMark
348 unsignedTM :: AST.TypeMark
349 unsignedTM = AST.unsafeVHDLBasicId "unsigned"
350
351 -- | string TypeMark
352 stringTM :: AST.TypeMark
353 stringTM = AST.unsafeVHDLBasicId "string"
354
355 -- | tup VHDLName suffix
356 tupVHDLSuffix :: AST.VHDLId -> AST.Suffix
357 tupVHDLSuffix id = AST.SSimple id