HDLRuby 2.6.22 → 2.6.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1568bd314caee471d78b83b882b7c89ad778642a4a026de691209318bf3f5a00
4
- data.tar.gz: 6d1829e1f8d04fb8592d68faf1b12affccf487a94a86275f932bef8676c542a6
3
+ metadata.gz: 2d8c97794e72e7b03ad7d6db03c24ff4fb77748c3340bc9b9857a64537118e8f
4
+ data.tar.gz: 8077bcb0c9ce65c3372943ffcdeb2fd756fcd6969e94e135bb32a53b3de1e650
5
5
  SHA512:
6
- metadata.gz: ded7ab60f18f80344d244274c354e85eda76150804bdb31598d801d803c33e0d63cc4786becdff7a3bff63a93b98d3837256638fe76ed993384998f56484846c
7
- data.tar.gz: 52c1fabe48cacabad8692f7eacd00c3ced295e2963ec29c3f5235cf27ff99a8826b12e2d525bc2d4b86703967dcbe2fe10bdb47c20127f84c04ea8875ae39277
6
+ metadata.gz: 104fae34f93944ecc476026b0e8c97b548220e92b7e14727f66af0dc8e6e3655b9dee20b1057f177263ad8947fd2a289333b7aa4378e9baaf16dac57cb41b988
7
+ data.tar.gz: 47c8c77471d8aff9cc4e601f403d3f32f254658f81884075cdc25e9c4ea422cbd3ef645664fcc3524f2cfb632c2a7c3f11d1cff20451a81e17422e3fab0f4130
@@ -0,0 +1,14 @@
1
+
2
+
3
+ # A benchmark for testing conversion of strings to values.
4
+ system :with_str2value_bench do
5
+ [8].inner :val
6
+ [64].inner :val64
7
+
8
+ timed do
9
+ val <= "01010011".to_value
10
+ !10.ns
11
+ val64 <= ("01010011" * 8).to_value
12
+ !10.ns
13
+ end
14
+ end
@@ -0,0 +1,90 @@
1
+
2
+ system :four2eight do
3
+ [4].input :four
4
+ output :o0, :o1, :o2, :o3, :o4, :o5, :o6, :o7
5
+
6
+ o0 <= four[0]; o1 <= four[1]; o2 <= four[2]; o3 <= four[3]
7
+ o4 <= four[0]; o5 <= four[1]; o6 <= four[2]; o7 <= four[3]
8
+ end
9
+
10
+ system :four2sixfour do
11
+ [4].input :four
12
+ output :o00, :o01, :o02, :o03, :o04, :o05, :o06, :o07,
13
+ :o08, :o09, :o0A, :o0B, :o0C, :o0D, :o0E, :o0F,
14
+ :o10, :o11, :o12, :o13, :o14, :o15, :o16, :o17,
15
+ :o18, :o19, :o1A, :o1B, :o1C, :o1D, :o1E, :o1F,
16
+ :o20, :o21, :o22, :o23, :o24, :o25, :o26, :o27,
17
+ :o28, :o29, :o2A, :o2B, :o2C, :o2D, :o2E, :o2F,
18
+ :o30, :o31, :o32, :o33, :o34, :o35, :o36, :o37,
19
+ :o38, :o39, :o3A, :o3B, :o3C, :o3D, :o3E, :o3F
20
+
21
+
22
+ o00 <= four[0]; o01 <= four[1]; o02 <= four[2]; o03 <= four[3]
23
+ o04 <= four[0]; o05 <= four[1]; o06 <= four[2]; o07 <= four[3]
24
+ o08 <= four[0]; o09 <= four[1]; o0A <= four[2]; o0B <= four[3]
25
+ o0C <= four[0]; o0D <= four[1]; o0E <= four[2]; o0F <= four[3]
26
+ o10 <= four[0]; o11 <= four[1]; o12 <= four[2]; o13 <= four[3]
27
+ o14 <= four[0]; o15 <= four[1]; o16 <= four[2]; o17 <= four[3]
28
+ o18 <= four[0]; o19 <= four[1]; o1A <= four[2]; o1B <= four[3]
29
+ o1C <= four[0]; o1D <= four[1]; o1E <= four[2]; o1F <= four[3]
30
+ o20 <= four[0]; o21 <= four[1]; o22 <= four[2]; o23 <= four[3]
31
+ o24 <= four[0]; o25 <= four[1]; o26 <= four[2]; o27 <= four[3]
32
+ o28 <= four[0]; o29 <= four[1]; o2A <= four[2]; o2B <= four[3]
33
+ o2C <= four[0]; o2D <= four[1]; o2E <= four[2]; o2F <= four[3]
34
+ o30 <= four[0]; o31 <= four[1]; o32 <= four[2]; o33 <= four[3]
35
+ o34 <= four[0]; o35 <= four[1]; o36 <= four[2]; o37 <= four[3]
36
+ o38 <= four[0]; o39 <= four[1]; o3A <= four[2]; o3B <= four[3]
37
+ o3C <= four[0]; o3D <= four[1]; o3E <= four[2]; o3F <= four[3]
38
+ end
39
+
40
+
41
+
42
+ # A benchmark for testing some enumarable properties of expression (to_a).
43
+ system :with_to_a_bench do
44
+ [4].inner :four
45
+ [8].inner :val, :res, :eight
46
+ [64].inner :val64, :res64, :sixfour
47
+
48
+ vals = val.to_a
49
+ val64s = val64.to_a
50
+
51
+ four2eight(:my_four2eight).(four,*(eight.to_a.reverse))
52
+ four2sixfour(:my_four2sixfour).(four,*(sixfour.to_a.reverse))
53
+
54
+ timed do
55
+ val <= _01101010
56
+ res <= vals.reverse
57
+ !10.ns
58
+ val64 <= _0110101001101010011010100110101001101010011010100110101001101010
59
+ res64 <= val64s.reverse
60
+ !10.ns
61
+ val <= _00000000
62
+ val64 <= _0000000000000000000000000000000000000000000000000000000000000000
63
+ !10.ns
64
+ vals.each.with_index do |v,i|
65
+ v <= (i/2) & _1
66
+ end
67
+ res <= val
68
+ !10.ns
69
+ val64s.each.with_index do |v,i|
70
+ v <= (i/2) & _1
71
+ end
72
+ res64 <= val64
73
+ !10.ns
74
+ val <= _01010011
75
+ !10.ns
76
+ 8.times do |i|
77
+ val64s[i] <= val[i]
78
+ val64s[i+32] <= val[i]
79
+ val64s[i+56] <= val[i]
80
+ end
81
+ res64 <= val64
82
+ !10.ns
83
+ four <= _0000
84
+ !10.ns
85
+ four <= _0001
86
+ !10.ns
87
+ four <= _1100
88
+ !10.ns
89
+ end
90
+ end
@@ -56,9 +56,9 @@ module HDLRuby::Low
56
56
  # Extracts the expressions from the casts.
57
57
  def casts_without_expression!
58
58
  # Apply on the left value.
59
- self.set_left!(self.left.casts_without_expression)
59
+ self.set_left!(self.left.casts_without_expression!)
60
60
  # Apply on the right value.
61
- self.set_right!(self.right.casts_without_expression)
61
+ self.set_right!(self.right.casts_without_expression!)
62
62
  return self
63
63
  end
64
64
  end
@@ -71,7 +71,7 @@ module HDLRuby::Low
71
71
  # Extracts the expressions from the casts.
72
72
  def casts_without_expression!
73
73
  # Apply on the arguments.
74
- self.map_args!(&:casts_without_expression)
74
+ self.map_args!(&:casts_without_expression!)
75
75
  return self
76
76
  end
77
77
  end
@@ -84,12 +84,12 @@ module HDLRuby::Low
84
84
  # Extracts the expressions from the casts.
85
85
  def casts_without_expression!
86
86
  # Apply on the condition.
87
- self.set_condition!(self.condition.casts_without_expression)
87
+ self.set_condition!(self.condition.casts_without_expression!)
88
88
  # Apply on the yes.
89
89
  self.yes.casts_without_expression!
90
90
  # Apply on the noifs.
91
91
  @noifs.map! do |cond,stmnt|
92
- [cond.casts_without_expression,stmnt.casts_without_expression!]
92
+ [cond.casts_without_expression!,stmnt.casts_without_expression!]
93
93
  end
94
94
  # Apply on the no if any.
95
95
  self.no.casts_without_expression! if self.no
@@ -104,7 +104,7 @@ module HDLRuby::Low
104
104
  # Extracts the expressions from the casts.
105
105
  def casts_without_expression!
106
106
  # Apply on the match.
107
- self.set_match!(self.match.casts_without_expression)
107
+ self.set_match!(self.match.casts_without_expression!)
108
108
  # Apply on the statement.
109
109
  self.statement.casts_without_expression!
110
110
  return self
@@ -120,7 +120,7 @@ module HDLRuby::Low
120
120
  def casts_without_expression!
121
121
  # No need to apply on the value!
122
122
  # Apply on the value.
123
- self.set_value!(self.value.casts_without_expression)
123
+ self.set_value!(self.value.casts_without_expression!)
124
124
  # Apply on the whens.
125
125
  self.each_when(&:casts_without_expression!)
126
126
  # Apply on the default if any.
@@ -169,9 +169,10 @@ module HDLRuby::Low
169
169
  # expressions from cast.
170
170
  class Value
171
171
  # Extracts the expressions from the casts.
172
- def casts_without_expression
173
- # Simple clones.
174
- return self.clone
172
+ def casts_without_expression!
173
+ # # Simple clones.
174
+ # return self.clone
175
+ return self
175
176
  end
176
177
  end
177
178
 
@@ -180,9 +181,10 @@ module HDLRuby::Low
180
181
  # expressions from cast.
181
182
  class Cast
182
183
  # Extracts the expressions from the casts.
183
- def casts_without_expression
184
+ def casts_without_expression!
184
185
  # Recurse on the child.
185
- nchild = self.child.casts_without_expression
186
+ nchild = self.child.casts_without_expression!
187
+ nchild.parent = nil
186
188
  # Process the cast.
187
189
  unless (nchild.is_a?(Ref)) then
188
190
  # Need to extract the child.
@@ -221,10 +223,11 @@ module HDLRuby::Low
221
223
  class Unary
222
224
 
223
225
  # Extracts the expressions from the casts.
224
- def casts_without_expression
225
- # Recurse on the sub node.
226
- return Unary.new(self.type,self.operator,
227
- self.child.casts_without_expression)
226
+ def casts_without_expression!
227
+ # # Recurse on the sub node.
228
+ # return Unary.new(self.type,self.operator,
229
+ # self.child.casts_without_expression)
230
+ self.set_child!(self.child.casts_without_expression!)
228
231
  return self
229
232
  end
230
233
  end
@@ -235,11 +238,14 @@ module HDLRuby::Low
235
238
  class Binary
236
239
 
237
240
  # Extracts the expressions from the casts.
238
- def casts_without_expression
239
- # Recurse on the sub nodes.
240
- return Binary.new(self.type,self.operator,
241
- self.left.casts_without_expression,
242
- self.right.casts_without_expression)
241
+ def casts_without_expression!
242
+ # # Recurse on the sub nodes.
243
+ # return Binary.new(self.type,self.operator,
244
+ # self.left.casts_without_expression,
245
+ # self.right.casts_without_expression)
246
+ self.set_left!(self.left.casts_without_expression!)
247
+ self.set_right!(self.right.casts_without_expression!)
248
+ return self
243
249
  end
244
250
  end
245
251
 
@@ -250,13 +256,15 @@ module HDLRuby::Low
250
256
  class Select
251
257
 
252
258
  # Extracts the expressions from the casts.
253
- def casts_without_expression
259
+ def casts_without_expression!
254
260
  # Recurse on the sub node.
255
- return Select.new(self.type,"?",
256
- self.select.casts_without_expression,
257
- *self.each_choice.map do |choice|
258
- choice.casts_without_expression
259
- end )
261
+ # return Select.new(self.type,"?",
262
+ # self.select.casts_without_expression,
263
+ # *self.each_choice.map do |choice|
264
+ # choice.casts_without_expression
265
+ # end )
266
+ self.set_select!(self.select.casts_without_expression!)
267
+ sef.map_choices! { |choice| choice.casts_without_expression! }
260
268
  return self
261
269
  end
262
270
  end
@@ -266,11 +274,13 @@ module HDLRuby::Low
266
274
  # in assignments to select operators.
267
275
  class Concat
268
276
  # Extracts the expressions from the casts.
269
- def casts_without_expression
277
+ def casts_without_expression!
270
278
  # Recurse on the sub expressions.
271
- return Concat.new(self.type,self.each_expression.map do |expr|
272
- expr.casts_without_expression
273
- end )
279
+ # return Concat.new(self.type,self.each_expression.map do |expr|
280
+ # expr.casts_without_expression
281
+ # end )
282
+ self.map_expressions! {|expr| expr.casts_without_expression! }
283
+ return self
274
284
  end
275
285
  end
276
286
 
@@ -279,11 +289,13 @@ module HDLRuby::Low
279
289
  # in assignments to select operators.
280
290
  class RefConcat
281
291
  # Extracts the expressions from the casts.
282
- def casts_without_expression
283
- # Recurse on the sub references.
284
- return RefConcat.new(self.type,self.each_expression.map do |expr|
285
- expr.casts_without_expression
286
- end )
292
+ def casts_without_expression!
293
+ # # Recurse on the sub references.
294
+ # return RefConcat.new(self.type,self.each_expression.map do |expr|
295
+ # expr.casts_without_expression
296
+ # end )
297
+ self.map_expressions! {|expr| expr.casts_without_expression! }
298
+ return self
287
299
  end
288
300
  end
289
301
 
@@ -292,11 +304,14 @@ module HDLRuby::Low
292
304
  # in assignments to select operators.
293
305
  class RefIndex
294
306
  # Extracts the expressions from the casts.
295
- def casts_without_expression
307
+ def casts_without_expression!
296
308
  # Recurse on the sub references.
297
- return RefIndex.new(self.type,
298
- self.ref.casts_without_expression,
299
- self.index.casts_without_expression)
309
+ # return RefIndex.new(self.type,
310
+ # self.ref.casts_without_expression,
311
+ # self.index.casts_without_expression)
312
+ self.set_ref!(self.ref.casts_without_expression!)
313
+ self.set_index!(self.index.casts_without_expression!)
314
+ return self
300
315
  end
301
316
  end
302
317
 
@@ -305,12 +320,16 @@ module HDLRuby::Low
305
320
  # in assignments to select operators.
306
321
  class RefRange
307
322
  # Extracts the expressions from the casts.
308
- def casts_without_expression
323
+ def casts_without_expression!
309
324
  # Recurse on the sub references.
310
- return RefRange.new(self.type,
311
- self.ref.casts_without_expression,
312
- self.range.first.casts_without_expression ..
313
- self.range.last.casts_without_expression)
325
+ # return RefRange.new(self.type,
326
+ # self.ref.casts_without_expression,
327
+ # self.range.first.casts_without_expression ..
328
+ # self.range.last.casts_without_expression)
329
+ self.set_ref!(self.ref.casts_without_expression!)
330
+ self.set_range!(self.range.first.casts_without_expression! ..
331
+ self.range.last.casts_without_expression!)
332
+ return self
314
333
  end
315
334
  end
316
335
 
@@ -319,11 +338,13 @@ module HDLRuby::Low
319
338
  # in assignments to select operators.
320
339
  class RefName
321
340
  # Extracts the expressions from the casts.
322
- def casts_without_expression
341
+ def casts_without_expression!
323
342
  # Recurse on the sub references.
324
- return RefName.new(self.type,
325
- self.ref.casts_without_expression,
326
- self.name)
343
+ # return RefName.new(self.type,
344
+ # self.ref.casts_without_expression,
345
+ # self.name)
346
+ self.set_ref!(self.ref.casts_without_expression!)
347
+ return self
327
348
  end
328
349
  end
329
350
 
@@ -332,9 +353,10 @@ module HDLRuby::Low
332
353
  # in assignments to select operators.
333
354
  class RefThis
334
355
  # Extracts the expressions from the casts.
335
- def casts_without_expression
336
- # Simply clone.
337
- return self.clone
356
+ def casts_without_expression!
357
+ # # Simply clone.
358
+ # return self.clone
359
+ return self
338
360
  end
339
361
  end
340
362
 
@@ -344,9 +366,10 @@ module HDLRuby::Low
344
366
  class StringE
345
367
 
346
368
  # Extracts the expressions from the casts.
347
- def casts_without_expression
348
- return StringE.new(self.content,
349
- *self.each_arg.map(&:cast_without_expression))
369
+ def casts_without_expression!
370
+ # return StringE.new(self.content,
371
+ # *self.each_arg.map(&:casts_without_expression))
372
+ self.map_args! {|arg| arg.casts_without_expression! }
350
373
  return self
351
374
  end
352
375
  end
@@ -1959,4 +1959,25 @@ module HDLRuby::Low
1959
1959
  # Nothing to do.
1960
1960
  end
1961
1961
  end
1962
+
1963
+ ##
1964
+ # Describes a string.
1965
+ #
1966
+ # NOTE: This is not synthesizable!
1967
+ class StringE
1968
+
1969
+ # Maps on the arguments.
1970
+ def map_args!(&ruby_block)
1971
+ @args.map! do |arg|
1972
+ arg = ruby_block.call(arg)
1973
+ arg.parent = self unless arg.parent
1974
+ arg
1975
+ end
1976
+ end
1977
+
1978
+ # Maps on the children.
1979
+ def map_nodes!(&ruby_block)
1980
+ self.map_args!(&ruby_block)
1981
+ end
1982
+ end
1962
1983
  end
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.6.22"
2
+ VERSION = "2.6.23"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.22
4
+ version: 2.6.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-24 00:00:00.000000000 Z
11
+ date: 2021-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -151,6 +151,8 @@ files:
151
151
  - lib/HDLRuby/hdr_samples/with_multi_channels.rb
152
152
  - lib/HDLRuby/hdr_samples/with_reconf.rb
153
153
  - lib/HDLRuby/hdr_samples/with_reduce.rb
154
+ - lib/HDLRuby/hdr_samples/with_str2value.rb
155
+ - lib/HDLRuby/hdr_samples/with_to_a.rb
154
156
  - lib/HDLRuby/hdr_samples/with_to_array.rb
155
157
  - lib/HDLRuby/hdrcc.rb
156
158
  - lib/HDLRuby/high_samples/_adder_fault.rb