Quick hack implementation of FSVec literals, needs to be fixed
[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
129 -- | take function identifier
130 takeId :: String
131 takeId = "take"
132
133
134 -- | drop function identifier
135 dropId :: String
136 dropId = "drop"
137
138 -- | shiftl function identifier
139 shiftlId :: String
140 shiftlId = "shiftl"
141
142 -- | shiftr function identifier
143 shiftrId :: String
144 shiftrId = "shiftr"
145
146 -- | rotl function identifier
147 rotlId :: String
148 rotlId = "rotl"
149
150 -- | reverse function identifier
151 rotrId :: String
152 rotrId = "rotr"
153
154 -- | concatenate the vectors in a vector
155 concatId :: String
156 concatId = "concat"
157
158 -- | reverse function identifier
159 reverseId :: String
160 reverseId = "reverse"
161
162 -- | iterate function identifier
163 iterateId :: String
164 iterateId = "iterate"
165
166 -- | iteraten function identifier
167 iteratenId :: String
168 iteratenId = "iteraten"
169
170 -- | iterate function identifier
171 generateId :: String
172 generateId = "generate"
173
174 -- | iteraten function identifier
175 generatenId :: String
176 generatenId = "generaten"
177
178 -- | copy function identifier
179 copyId :: String
180 copyId = "copy"
181
182 -- | copyn function identifier
183 copynId :: String
184 copynId = "copyn"
185
186 -- | map function identifier
187 mapId :: String
188 mapId = "map"
189
190 -- | zipwith function identifier
191 zipWithId :: String
192 zipWithId = "zipWith"
193
194 -- | foldl function identifier
195 foldlId :: String
196 foldlId = "foldl"
197
198 -- | foldr function identifier
199 foldrId :: String
200 foldrId = "foldr"
201
202 -- | zip function identifier
203 zipId :: String
204 zipId = "zip"
205
206 -- | unzip function identifier
207 unzipId :: String
208 unzipId = "unzip"
209
210 -- | hwxor function identifier
211 hwxorId :: String
212 hwxorId = "hwxor"
213
214 -- | hwor function identifier
215 hworId :: String
216 hworId = "hwor"
217
218 -- | hwnot function identifier
219 hwnotId :: String
220 hwnotId = "hwnot"
221
222 -- | hwand function identifier
223 hwandId :: String
224 hwandId = "hwand"
225
226 lengthTId :: String
227 lengthTId = "lengthT"
228
229 -- Numeric Operations
230
231 -- | plus operation identifier
232 plusId :: String
233 plusId = "+"
234
235 -- | times operation identifier
236 timesId :: String
237 timesId = "*"
238
239 -- | negate operation identifier
240 negateId :: String
241 negateId = "negate"
242
243 -- | minus operation identifier
244 minusId :: String
245 minusId = "-"
246
247 -- | convert sizedword to ranged
248 fromSizedWordId :: String
249 fromSizedWordId = "fromSizedWord"
250
251 toIntegerId :: String
252 toIntegerId = "to_integer"
253
254 fromIntegerId :: String
255 fromIntegerId = "fromInteger"
256
257 toSignedId :: String
258 toSignedId = "to_signed"
259
260 toUnsignedId :: String
261 toUnsignedId = "to_unsigned"
262
263 resizeId :: String
264 resizeId = "resize"
265
266 sizedIntId :: String
267 sizedIntId = "SizedInt"
268
269 tfvecId :: String
270 tfvecId = "TFVec"
271
272 -- | output file identifier (from std.textio)
273 showIdString :: String
274 showIdString = "show"
275
276 showId :: AST.VHDLId
277 showId = AST.unsafeVHDLExtId showIdString
278
279 -- | write function identifier (from std.textio)
280 writeId :: AST.VHDLId
281 writeId = AST.unsafeVHDLBasicId "write"
282
283 -- | output file identifier (from std.textio)
284 outputId :: AST.VHDLId
285 outputId = AST.unsafeVHDLBasicId "output"
286
287 ------------------
288 -- VHDL type marks
289 ------------------
290
291 -- | The Bit type mark
292 bitTM :: AST.TypeMark
293 bitTM = AST.unsafeVHDLBasicId "Bit"
294
295 -- | Stardard logic type mark
296 std_logicTM :: AST.TypeMark
297 std_logicTM = AST.unsafeVHDLBasicId "std_logic"
298
299 -- | boolean type mark
300 booleanTM :: AST.TypeMark
301 booleanTM = AST.unsafeVHDLBasicId "boolean"
302
303 -- | fsvec_index AST. TypeMark
304 tfvec_indexTM :: AST.TypeMark
305 tfvec_indexTM = AST.unsafeVHDLBasicId "tfvec_index"
306
307 -- | natural AST. TypeMark
308 naturalTM :: AST.TypeMark
309 naturalTM = AST.unsafeVHDLBasicId "natural"
310
311 -- | integer TypeMark
312 integerTM :: AST.TypeMark
313 integerTM = AST.unsafeVHDLBasicId "integer"
314
315 -- | signed TypeMark
316 signedTM :: AST.TypeMark
317 signedTM = AST.unsafeVHDLBasicId "signed"
318
319 -- | unsigned TypeMark
320 unsignedTM :: AST.TypeMark
321 unsignedTM = AST.unsafeVHDLBasicId "unsigned"
322
323 -- | string TypeMark
324 stringTM :: AST.TypeMark
325 stringTM = AST.unsafeVHDLBasicId "string"
326
327 -- | tup VHDLName suffix
328 tupVHDLSuffix :: AST.VHDLId -> AST.Suffix
329 tupVHDLSuffix id = AST.SSimple id