rggen-systemrdl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,514 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemRDL
5
+ module Converter
6
+ class Field < Base
7
+ private
8
+
9
+ def layer_name
10
+ :bit_field
11
+ end
12
+
13
+ def unsupported_properties
14
+ [:resetsignal, :wel, :swmod, :anded, :ored, :xored, :hwenable, :hwmask, :paritycheck]
15
+ end
16
+
17
+ def convert_rdl_model(rdl_model, _root_data, input_data)
18
+ check_precedence(rdl_model, input_data)
19
+ convert_name(rdl_model, input_data)
20
+ convert_comment(rdl_model, input_data)
21
+ convert_bit_assignment(rdl_model, input_data)
22
+ convert_initial_value(rdl_model, input_data)
23
+ convert_type(rdl_model, input_data)
24
+ end
25
+
26
+ def check_precedence(rdl_model, input_data)
27
+ return if input_data.configuration.ignore_precedence?
28
+
29
+ precedence = rdl_model.property(:precedence)
30
+ return if precedence.value == :hw
31
+
32
+ error 'sw precedence is not supported', precedence.token_range
33
+ end
34
+
35
+ def convert_bit_assignment(rdl_model, input_data)
36
+ lsb = from_property(rdl_model, :lsb)
37
+ width = from_property(rdl_model, :width)
38
+ input_data[:bit_assignment] = { lsb:, width: }
39
+ end
40
+
41
+ def convert_initial_value(rdl_model, input_data)
42
+ reset = rdl_model.property(:reset)
43
+
44
+ reset.value? ||
45
+ (error 'reset given as a reference is not supported', reset.token_range)
46
+
47
+ input_data[:initial_value] = from_property_value(reset) if reset.value
48
+ end
49
+
50
+ def convert_type(rdl_model, input_data)
51
+ return if [
52
+ :convert_rw, :convert_rof, :convert_ro_ext, :convert_ro_ref, :convert_wo, :convert_rohw,
53
+ :convert_rwhw, :convert_rc, :convert_rs, :convert_wrc, :convert_wrs, :convert_w0c,
54
+ :convert_w1c, :convert_w0s, :convert_w1s, :convert_w0t, :convert_w1t, :convert_wc,
55
+ :convert_woc, :convert_ws, :convert_wos, :convert_w0crs, :convert_w1crs, :convert_wcrs,
56
+ :convert_w0src, :convert_w1src, :convert_wsrc, :convert_rwl, :convert_rwe, :convert_rwc,
57
+ :convert_rws, :convert_rwtrg, :convert_rotrg_ext, :convert_rotrg_ref, :convert_wotrg,
58
+ :convert_w1trg, :convert_w1, :convert_wo1
59
+ ].any? { |converter| __send__(converter, rdl_model, input_data) }
60
+
61
+ error 'no corresponding bit field type', rdl_model.token_range
62
+ end
63
+
64
+ def convert_rw(rdl_model, input_data)
65
+ return unless only_set?(rdl_model, :sw, :hw)
66
+
67
+ sw = rdl_model.sw
68
+ hw = rdl_model.hw
69
+ return unless sw == :rw && (hw in :na | :r)
70
+
71
+ input_data[:type] = to_input_value(:rw, nil)
72
+ end
73
+
74
+ def convert_rof(rdl_model, input_data)
75
+ return unless only_set?(rdl_model, :sw, :hw)
76
+
77
+ sw = rdl_model.sw
78
+ hw = rdl_model.hw
79
+ reset = rdl_model.property(:reset)
80
+ return unless sw == :r && hw == :na && reset
81
+
82
+ input_data[:type] = :rof
83
+ end
84
+
85
+ def convert_ro_ext(rdl_model, input_data)
86
+ return unless only_set?(rdl_model, :sw, :hw)
87
+
88
+ sw = rdl_model.sw
89
+ hw = rdl_model.hw
90
+ return unless sw == :r && (hw in :rw | :w)
91
+
92
+ input_data[:type] = to_input_value(:ro, nil)
93
+ end
94
+
95
+ def convert_ro_ref(rdl_model, input_data)
96
+ return unless only_set?(rdl_model, :sw, :hw, :next)
97
+
98
+ sw = rdl_model.sw
99
+ hw = rdl_model.hw
100
+ ref = rdl_model.property(:next)
101
+ return unless sw == :r && (hw in :na | :r) && ref.value
102
+
103
+ input_data[:type] = to_input_value(:ro, nil)
104
+ input_data[:reference] = from_property_value(ref)
105
+ end
106
+
107
+ def convert_wo(rdl_model, input_data)
108
+ return unless only_set?(rdl_model, :sw, :hw)
109
+
110
+ sw = rdl_model.sw
111
+ hw = rdl_model.hw
112
+ return unless sw == :w && (hw in :na | :r)
113
+
114
+ input_data[:type] = :wo
115
+ end
116
+
117
+ def convert_rohw(rdl_model, input_data)
118
+ return unless only_set?(rdl_model, :sw, :hw, :we)
119
+
120
+ sw = rdl_model.sw
121
+ hw = rdl_model.hw
122
+ we = rdl_model.property(:we)
123
+ return unless sw == :r && (hw in :rw | :w) && we.value
124
+
125
+ input_data[:reference] = from_property_value(we) if we.instance_ref?
126
+ input_data[:type] = to_input_value(:rohw, nil)
127
+ end
128
+
129
+ def convert_rwhw(rdl_model, input_data)
130
+ return unless only_set?(rdl_model, :sw, :hw, :we)
131
+
132
+ sw = rdl_model.sw
133
+ hw = rdl_model.hw
134
+ we = rdl_model.property(:we)
135
+ return unless sw == :rw && (hw in :rw | :w) && we.value
136
+
137
+ input_data[:reference] = from_property_value(we) if we.instance_ref?
138
+ input_data[:type] = to_input_value(:rwhw, nil)
139
+ end
140
+
141
+ def convert_rc(rdl_model, input_data)
142
+ return unless only_set?(rdl_model, :sw, :hw, :rclr, :onread, :hwset)
143
+
144
+ sw = rdl_model.sw
145
+ hw = rdl_model.hw
146
+ rclr = rdl_model.rclr || rdl_model.onread == :rclr
147
+ hwset = set_true?(rdl_model, :hwset)
148
+ return unless sw == :r && (hw in :na | :r) && rclr && hwset
149
+
150
+ input_data[:type] = to_input_value(:rc, nil)
151
+ end
152
+
153
+ def convert_rs(rdl_model, input_data)
154
+ return unless only_set?(rdl_model, :sw, :hw, :rset, :onread, :hwclr)
155
+
156
+ sw = rdl_model.sw
157
+ hw = rdl_model.hw
158
+ rset = rdl_model.rset || rdl_model.onread == :rset
159
+ hwclr = set_true?(rdl_model, :hwclr)
160
+ return unless sw == :r && (hw in :na | :r) && rset && hwclr
161
+
162
+ input_data[:type] = to_input_value(:rs, nil)
163
+ end
164
+
165
+ def convert_wrc(rdl_model, input_data)
166
+ return unless only_set?(rdl_model, :sw, :hw, :rclr, :onread)
167
+
168
+ sw = rdl_model.sw
169
+ hw = rdl_model.hw
170
+ rclr = rdl_model.rclr || rdl_model.onread == :rclr
171
+ return unless sw == :rw && (hw in :na | :r) && rclr
172
+
173
+ input_data[:type] = to_input_value(:wrc, nil)
174
+ end
175
+
176
+ def convert_wrs(rdl_model, input_data)
177
+ return unless only_set?(rdl_model, :sw, :hw, :rset, :onread)
178
+
179
+ sw = rdl_model.sw
180
+ hw = rdl_model.hw
181
+ rset = rdl_model.rset || rdl_model.onread == :rset
182
+ return unless sw == :rw && (hw in :na | :r) && rset
183
+
184
+ input_data[:type] = to_input_value(:wrs, nil)
185
+ end
186
+
187
+ def convert_w0c(rdl_model, input_data)
188
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :hwset)
189
+
190
+ sw = rdl_model.sw
191
+ hw = rdl_model.hw
192
+ wzc = rdl_model.onwrite == :wzc
193
+ hwset = set_true?(rdl_model, :hwset)
194
+ return unless sw == :rw && (hw in :na | :r) && wzc && hwset
195
+
196
+ input_data[:type] = to_input_value(:w0c, nil)
197
+ end
198
+
199
+ def convert_w1c(rdl_model, input_data)
200
+ return unless only_set?(rdl_model, :sw, :hw, :woclr, :onwrite, :hwset)
201
+
202
+ sw = rdl_model.sw
203
+ hw = rdl_model.hw
204
+ woclr = rdl_model.woclr || rdl_model.onwrite == :woclr
205
+ hwset = set_true?(rdl_model, :hwset)
206
+ return unless sw == :rw && (hw in :na | :r) && woclr && hwset
207
+
208
+ input_data[:type] = to_input_value(:w1c, nil)
209
+ end
210
+
211
+ def convert_w0s(rdl_model, input_data)
212
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :hwclr)
213
+
214
+ sw = rdl_model.sw
215
+ hw = rdl_model.hw
216
+ wzs = rdl_model.onwrite == :wzs
217
+ hwclr = set_true?(rdl_model, :hwclr)
218
+ return unless sw == :rw && (hw in :na | :r) && wzs && hwclr
219
+
220
+ input_data[:type] = to_input_value(:w0s, nil)
221
+ end
222
+
223
+ def convert_w1s(rdl_model, input_data)
224
+ return unless only_set?(rdl_model, :sw, :hw, :woset, :onwrite, :hwclr)
225
+
226
+ sw = rdl_model.sw
227
+ hw = rdl_model.hw
228
+ woset = rdl_model.woset || rdl_model.onwrite == :woset
229
+ hwclr = set_true?(rdl_model, :hwclr)
230
+ return unless sw == :rw && (hw in :na | :r) && woset && hwclr
231
+
232
+ input_data[:type] = to_input_value(:w1s, nil)
233
+ end
234
+
235
+ def convert_w0t(rdl_model, input_data)
236
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite)
237
+
238
+ sw = rdl_model.sw
239
+ hw = rdl_model.hw
240
+ wzt = rdl_model.onwrite == :wzt
241
+ return unless sw == :rw && (hw in :na | :r) && wzt
242
+
243
+ input_data[:type] = to_input_value(:w0t, nil)
244
+ end
245
+
246
+ def convert_w1t(rdl_model, input_data)
247
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite)
248
+
249
+ sw = rdl_model.sw
250
+ hw = rdl_model.hw
251
+ wot = rdl_model.onwrite == :wot
252
+ return unless sw == :rw && (hw in :na | :r) && wot
253
+
254
+ input_data[:type] = to_input_value(:w1t, nil)
255
+ end
256
+
257
+ def convert_wc(rdl_model, input_data)
258
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :hwset)
259
+
260
+ sw = rdl_model.sw
261
+ hw = rdl_model.hw
262
+ wclr = rdl_model.onwrite == :wclr
263
+ hwset = set_true?(rdl_model, :hwset)
264
+ return unless sw == :rw && (hw in :na | :r) && wclr && hwset
265
+
266
+ input_data[:type] = to_input_value(:wc, nil)
267
+ end
268
+
269
+ def convert_woc(rdl_model, input_data)
270
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :hwset)
271
+
272
+ sw = rdl_model.sw
273
+ hw = rdl_model.hw
274
+ wclr = rdl_model.onwrite == :wclr
275
+ hwset = set_true?(rdl_model, :hwset)
276
+ return unless sw == :w && (hw in :na | :r) && wclr && hwset
277
+
278
+ input_data[:type] = to_input_value(:woc, nil)
279
+ end
280
+
281
+ def convert_ws(rdl_model, input_data)
282
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :hwclr)
283
+
284
+ sw = rdl_model.sw
285
+ hw = rdl_model.hw
286
+ wset = rdl_model.onwrite == :wset
287
+ hwclr = set_true?(rdl_model, :hwclr)
288
+ return unless sw == :rw && (hw in :na | :r) && wset && hwclr
289
+
290
+ input_data[:type] = to_input_value(:ws, nil)
291
+ end
292
+
293
+ def convert_wos(rdl_model, input_data)
294
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :hwclr)
295
+
296
+ sw = rdl_model.sw
297
+ hw = rdl_model.hw
298
+ wset = rdl_model.onwrite == :wset
299
+ hwclr = set_true?(rdl_model, :hwclr)
300
+ return unless sw == :w && (hw in :na | :r) && wset && hwclr
301
+
302
+ input_data[:type] = to_input_value(:wos, nil)
303
+ end
304
+
305
+ def convert_w0crs(rdl_model, input_data)
306
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :rset, :onread)
307
+
308
+ sw = rdl_model.sw
309
+ hw = rdl_model.hw
310
+ wzc = rdl_model.onwrite == :wzc
311
+ rset = rdl_model.rset || rdl_model.onread == :rset
312
+ return unless sw == :rw && (hw in :na | :r) && wzc && rset
313
+
314
+ input_data[:type] = to_input_value(:w0crs, nil)
315
+ end
316
+
317
+ def convert_w1crs(rdl_model, input_data)
318
+ return unless only_set?(rdl_model, :sw, :hw, :woclr, :onwrite, :rset, :onread)
319
+
320
+ sw = rdl_model.sw
321
+ hw = rdl_model.hw
322
+ woclr = rdl_model.woclr || rdl_model.onwrite == :woclr
323
+ rset = rdl_model.rset || rdl_model.onread == :rset
324
+ return unless sw == :rw && (hw in :na | :r) && woclr && rset
325
+
326
+ input_data[:type] = to_input_value(:w1crs, nil)
327
+ end
328
+
329
+ def convert_wcrs(rdl_model, input_data)
330
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :rset, :onread)
331
+
332
+ sw = rdl_model.sw
333
+ hw = rdl_model.hw
334
+ wclr = rdl_model.onwrite == :wclr
335
+ rset = rdl_model.rset || rdl_model.onread == :rset
336
+ return unless sw == :rw && (hw in :na | :r) && wclr && rset
337
+
338
+ input_data[:type] = to_input_value(:wcrs, nil)
339
+ end
340
+
341
+ def convert_w0src(rdl_model, input_data)
342
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :rclr, :onread)
343
+
344
+ sw = rdl_model.sw
345
+ hw = rdl_model.hw
346
+ wzs = rdl_model.onwrite == :wzs
347
+ rclr = rdl_model.rclr || rdl_model.onread == :rclr
348
+ return unless sw == :rw && (hw in :na | :r) && wzs && rclr
349
+
350
+ input_data[:type] = to_input_value(:w0src, nil)
351
+ end
352
+
353
+ def convert_w1src(rdl_model, input_data)
354
+ return unless only_set?(rdl_model, :sw, :hw, :woset, :onwrite, :rclr, :onread)
355
+
356
+ sw = rdl_model.sw
357
+ hw = rdl_model.hw
358
+ woset = rdl_model.woset || rdl_model.onwrite == :woset
359
+ rclr = rdl_model.rclr || rdl_model.onread == :rclr
360
+ return unless sw == :rw && (hw in :na | :r) && woset && rclr
361
+
362
+ input_data[:type] = to_input_value(:w1src, nil)
363
+ end
364
+
365
+ def convert_wsrc(rdl_model, input_data)
366
+ return unless only_set?(rdl_model, :sw, :hw, :onwrite, :rclr, :onread)
367
+
368
+ sw = rdl_model.sw
369
+ hw = rdl_model.hw
370
+ wset = rdl_model.onwrite == :wset
371
+ rclr = rdl_model.rclr || rdl_model.onread == :rclr
372
+ return unless sw == :rw && (hw in :na | :r) && wset && rclr
373
+
374
+ input_data[:type] = to_input_value(:wsrc, nil)
375
+ end
376
+
377
+ def convert_rwl(rdl_model, input_data)
378
+ return unless only_set?(rdl_model, :sw, :hw, :swwel)
379
+
380
+ sw = rdl_model.sw
381
+ hw = rdl_model.hw
382
+ swwel = rdl_model.property(:swwel)
383
+ return unless sw == :rw && (hw in :na | :r) && swwel.value
384
+
385
+ input_data[:reference] = from_property_value(swwel) if swwel.instance_ref?
386
+ input_data[:type] = to_input_value(:rwl, nil)
387
+ end
388
+
389
+ def convert_rwe(rdl_model, input_data)
390
+ return unless only_set?(rdl_model, :sw, :hw, :swwe)
391
+
392
+ sw = rdl_model.sw
393
+ hw = rdl_model.hw
394
+ swwe = rdl_model.property(:swwe)
395
+ return unless sw == :rw && (hw in :na | :r) && swwe.value
396
+
397
+ input_data[:reference] = from_property_value(swwe) if swwe.instance_ref?
398
+ input_data[:type] = to_input_value(:rwe, nil)
399
+ end
400
+
401
+ def convert_rwc(rdl_model, input_data)
402
+ return unless only_set?(rdl_model, :sw, :hw, :hwclr)
403
+
404
+ sw = rdl_model.sw
405
+ hw = rdl_model.hw
406
+ hwclr = rdl_model.property(:hwclr)
407
+ return unless sw == :rw && (hw in :na | :r) && hwclr.value
408
+
409
+ input_data[:reference] = from_property_value(hwclr) if hwclr.instance_ref?
410
+ input_data[:type] = to_input_value(:rwc, nil)
411
+ end
412
+
413
+ def convert_rws(rdl_model, input_data)
414
+ return unless only_set?(rdl_model, :sw, :hw, :hwset)
415
+
416
+ sw = rdl_model.sw
417
+ hw = rdl_model.hw
418
+ hwset = rdl_model.property(:hwset)
419
+ return unless sw == :rw && (hw in :na | :r) && hwset.value
420
+
421
+ input_data[:reference] = from_property_value(hwset) if hwset.instance_ref?
422
+ input_data[:type] = to_input_value(:rws, nil)
423
+ end
424
+
425
+ def convert_rwtrg(rdl_model, input_data)
426
+ return unless only_set?(rdl_model, :sw, :hw, :swacc)
427
+
428
+ sw = rdl_model.sw
429
+ hw = rdl_model.hw
430
+ swacc = rdl_model.swacc
431
+ return unless sw == :rw && (hw in :na | :r) && swacc
432
+
433
+ input_data[:type] = to_input_value(:rwtrg, nil)
434
+ end
435
+
436
+ def convert_rotrg_ext(rdl_model, input_data)
437
+ return unless only_set?(rdl_model, :sw, :hw, :swacc)
438
+
439
+ sw = rdl_model.sw
440
+ hw = rdl_model.hw
441
+ swacc = rdl_model.swacc
442
+ return unless sw == :r && (hw in :rw | :w) && swacc
443
+
444
+ input_data[:type] = to_input_value(:rotrg, nil)
445
+ end
446
+
447
+ def convert_rotrg_ref(rdl_model, input_data)
448
+ return unless only_set?(rdl_model, :sw, :hw, :next, :swacc)
449
+
450
+ sw = rdl_model.sw
451
+ hw = rdl_model.hw
452
+ ref = rdl_model.property(:next)
453
+ swacc = rdl_model.swacc
454
+ return unless sw == :r && (hw in :na | :r) && ref.value && swacc
455
+
456
+ input_data[:reference] = from_property_value(ref)
457
+ input_data[:type] = to_input_value(:rotrg, nil)
458
+ end
459
+
460
+ def convert_wotrg(rdl_model, input_data)
461
+ return unless only_set?(rdl_model, :sw, :hw, :swacc)
462
+
463
+ sw = rdl_model.sw
464
+ hw = rdl_model.hw
465
+ swacc = rdl_model.swacc
466
+ return unless sw == :w && (hw in :na | :r) && swacc
467
+
468
+ input_data[:type] = to_input_value(:wotrg, nil)
469
+ end
470
+
471
+ def convert_w1trg(rdl_model, input_data)
472
+ return unless only_set?(rdl_model, :sw, :hw, :singlepulse)
473
+
474
+ sw = rdl_model.sw
475
+ hw = rdl_model.hw
476
+ singlepulse = rdl_model.singlepulse
477
+ return unless sw == :rw && (hw in :na | :r) && singlepulse
478
+
479
+ input_data[:type] = to_input_value(:w1trg, nil)
480
+ end
481
+
482
+ def convert_w1(rdl_model, input_data)
483
+ return unless only_set?(rdl_model, :sw, :hw)
484
+
485
+ sw = rdl_model.sw
486
+ hw = rdl_model.hw
487
+ return unless sw == :rw1 && (hw in :na | :r)
488
+
489
+ input_data[:type] = to_input_value(:w1, nil)
490
+ end
491
+
492
+ def convert_wo1(rdl_model, input_data)
493
+ return unless only_set?(rdl_model, :sw, :hw)
494
+
495
+ sw = rdl_model.sw
496
+ hw = rdl_model.hw
497
+ return unless sw == :w1 && (hw in :na | :r)
498
+
499
+ input_data[:type] = to_input_value(:wo1, nil)
500
+ end
501
+
502
+ def only_set?(rdl_model, *allowed_properties)
503
+ properties = [
504
+ :sw, :hw, :next, :onread, :rclr, :rset, :onwrite, :woset, :woclr,
505
+ :swwe, :swwel, :swacc, :singlepulse, :we, :hwclr, :hwset
506
+ ]
507
+ (properties - allowed_properties).none? do |property|
508
+ rdl_model.property(property).value
509
+ end
510
+ end
511
+ end
512
+ end
513
+ end
514
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemRDL
5
+ module Converter
6
+ class Mem < Base
7
+ private
8
+
9
+ def support_external?
10
+ true
11
+ end
12
+
13
+ def external?(_rdl_model)
14
+ true
15
+ end
16
+
17
+ def region_only?
18
+ true
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemRDL
5
+ module Converter
6
+ class Reg < Base
7
+ private
8
+
9
+ def external?(ral_model)
10
+ ral_model.external
11
+ end
12
+
13
+ def layer_name
14
+ :register
15
+ end
16
+
17
+ def unsupported_properties
18
+ [:shared]
19
+ end
20
+
21
+ def convert_rdl_model(rdl_model, _root_data, input_data)
22
+ convert_name(rdl_model, input_data)
23
+ convert_comment(rdl_model, input_data)
24
+ convert_offset_address(rdl_model, input_data)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemRDL
5
+ module Converter
6
+ class RegFile < Base
7
+ private
8
+
9
+ def external?(rdl_model)
10
+ rdl_model.external
11
+ end
12
+
13
+ def layer_name
14
+ :register_file
15
+ end
16
+
17
+ def unsupported_properties
18
+ [:sharedextbus]
19
+ end
20
+
21
+ def convert_rdl_model(rdl_model, _root_data, input_data)
22
+ convert_name(rdl_model, input_data)
23
+ convert_comment(rdl_model, input_data)
24
+ convert_offset_address(rdl_model, input_data)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ RgGen.define_simple_feature(:global, :ignore_precedence) do
4
+ configuration do
5
+ property :ignore_precedence?, default: false
6
+
7
+ input_pattern [{ true => truthy_pattern, false => falsey_pattern }],
8
+ match_automatically: false
9
+
10
+ ignore_empty_value false
11
+
12
+ build do |value|
13
+ @ignore_precedence =
14
+ if [true, false].any? { |bool| value == bool }
15
+ value.value
16
+ elsif match_pattern(value)
17
+ match_index
18
+ else
19
+ error "cannot convert #{value.inspect} into boolean"
20
+ end
21
+ end
22
+
23
+ printable :ignore_precedence do
24
+ ignore_precedence?
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemRDL
5
+ class Loader < Core::RegisterMap::Loader
6
+ support_types [:rdl]
7
+
8
+ private
9
+
10
+ def read_file(file)
11
+ ::SystemRDL.compile(file)
12
+ end
13
+
14
+ def format_data(rdl_models, input_data, _layer, _file)
15
+ rdl_models.each do |rdl_model|
16
+ Converter::AddrMap.convert(rdl_model, input_data, input_data)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RgGen
4
+ module SystemRDL
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'systemrdl'
4
+
5
+ require_relative 'systemrdl/version'
6
+ require_relative 'systemrdl/converter/base'
7
+ require_relative 'systemrdl/converter/addrmap'
8
+ require_relative 'systemrdl/converter/regfile'
9
+ require_relative 'systemrdl/converter/reg'
10
+ require_relative 'systemrdl/converter/field'
11
+ require_relative 'systemrdl/converter/mem'
12
+ require_relative 'systemrdl/loader'
13
+
14
+ RgGen.setup_plugin :'rggen-systemrdl' do |plugin|
15
+ plugin.version RgGen::SystemRDL::VERSION
16
+ plugin.files ['systemrdl/global/ignore_precedence']
17
+ plugin.setup_loader :register_map, :systemrdl do |entry|
18
+ entry.register_loaders [RgGen::SystemRDL::Loader]
19
+ end
20
+ end