HDLRuby 2.4.26 → 2.5.1
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.
- checksums.yaml +4 -4
- data/lib/HDLRuby/drivers/xcd.rb +79 -0
- data/lib/HDLRuby/drivers/xcd/dummy.xcd +4 -0
- data/lib/HDLRuby/hdr_samples/dff_properties.rb +19 -0
- data/lib/HDLRuby/hdr_samples/dff_unit.rb +54 -0
- data/lib/HDLRuby/hdr_samples/seqpar_bench.rb +59 -0
- data/lib/HDLRuby/hdrcc.rb +104 -22
- data/lib/HDLRuby/hruby_decorator.rb +248 -0
- data/lib/HDLRuby/hruby_high.rb +256 -67
- data/lib/HDLRuby/hruby_low.rb +511 -0
- data/lib/HDLRuby/hruby_low2c.rb +67 -0
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +151 -0
- data/lib/HDLRuby/hruby_unit.rb +43 -0
- data/lib/HDLRuby/hruby_verilog.rb +260 -130
- data/lib/HDLRuby/std/linear.rb +5 -11
- data/lib/HDLRuby/template_expander.rb +61 -0
- data/lib/HDLRuby/version.rb +1 -1
- metadata +11 -2
data/lib/HDLRuby/hruby_low.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "HDLRuby/hruby_bstr"
|
2
2
|
require "HDLRuby/hruby_error"
|
3
|
+
require "HDLRuby/hruby_decorator"
|
3
4
|
require 'forwardable'
|
4
5
|
|
5
6
|
|
@@ -34,6 +35,9 @@ module HDLRuby::Low
|
|
34
35
|
alias_method :each, :each_value
|
35
36
|
end
|
36
37
|
|
38
|
+
|
39
|
+
Hdecorator = HDLRuby::Hdecorator
|
40
|
+
|
37
41
|
##
|
38
42
|
# Gives parent definition and access properties to an hardware object.
|
39
43
|
module Hparent
|
@@ -62,6 +66,7 @@ module HDLRuby::Low
|
|
62
66
|
end
|
63
67
|
|
64
68
|
|
69
|
+
|
65
70
|
##
|
66
71
|
# Describes a system type.
|
67
72
|
#
|
@@ -113,6 +118,9 @@ module HDLRuby::Low
|
|
113
118
|
end
|
114
119
|
end
|
115
120
|
|
121
|
+
# Add decorator capability (modifies intialize to put after).
|
122
|
+
include Hdecorator
|
123
|
+
|
116
124
|
# Comparison for hash: structural comparison.
|
117
125
|
def eql?(obj)
|
118
126
|
return false unless obj.is_a?(SystemT)
|
@@ -376,8 +384,28 @@ module HDLRuby::Low
|
|
376
384
|
# end
|
377
385
|
# signal
|
378
386
|
# end
|
387
|
+
|
388
|
+
# Iterates over each object deeply.
|
389
|
+
#
|
390
|
+
# Returns an enumerator if no ruby block is given.
|
391
|
+
def each_deep(&ruby_block)
|
392
|
+
# No ruby block? Return an enumerator.
|
393
|
+
return to_enum(:each_deep) unless ruby_block
|
394
|
+
# A ruby block? First apply it to current.
|
395
|
+
ruby_block.call(self)
|
396
|
+
# Then apply on each signal.
|
397
|
+
self.each_signal do |signal|
|
398
|
+
signal.each_deep(&ruby_block)
|
399
|
+
end
|
400
|
+
# Then apply on each scope.
|
401
|
+
self.each_scope do |scope|
|
402
|
+
scope.each_deep(&ruby_block)
|
403
|
+
end
|
404
|
+
end
|
379
405
|
|
380
406
|
# Iterates over the systemT deeply if any.
|
407
|
+
#
|
408
|
+
# Returns an enumerator if no ruby block is given.
|
381
409
|
def each_systemT_deep(&ruby_block)
|
382
410
|
# No ruby block? Return an enumerator.
|
383
411
|
return to_enum(:each_systemT_deep) unless ruby_block
|
@@ -427,6 +455,9 @@ module HDLRuby::Low
|
|
427
455
|
@behaviors = []
|
428
456
|
end
|
429
457
|
|
458
|
+
# Add decorator capability (modifies intialize to put after).
|
459
|
+
include Hdecorator
|
460
|
+
|
430
461
|
# Comparison for hash: structural comparison.
|
431
462
|
def eql?(obj)
|
432
463
|
return false unless obj.is_a?(Scope)
|
@@ -1117,6 +1148,50 @@ module HDLRuby::Low
|
|
1117
1148
|
# systemI.each_sensitive_deep(&ruby_block)
|
1118
1149
|
# end
|
1119
1150
|
# end
|
1151
|
+
|
1152
|
+
# Iterates over each object deeply.
|
1153
|
+
#
|
1154
|
+
# Returns an enumerator if no ruby block is given.
|
1155
|
+
def each_deep(&ruby_block)
|
1156
|
+
# No ruby block? Return an enumerator.
|
1157
|
+
return to_enum(:each_deep) unless ruby_block
|
1158
|
+
# A ruby block? First apply it to current.
|
1159
|
+
ruby_block.call(self)
|
1160
|
+
# The apply on each type.
|
1161
|
+
self.each_type do |type|
|
1162
|
+
type.each_deep(&ruby_block)
|
1163
|
+
end
|
1164
|
+
# Then apply on each systemT.
|
1165
|
+
self.each_systemT do |systemT|
|
1166
|
+
systemT.each_deep(&ruby_block)
|
1167
|
+
end
|
1168
|
+
# Then apply on each scope.
|
1169
|
+
self.each_scope do |scope|
|
1170
|
+
scope.each_deep(&ruby_block)
|
1171
|
+
end
|
1172
|
+
# Then apply on each inner signal.
|
1173
|
+
self.each_inner do |inner|
|
1174
|
+
inner.each_deep(&ruby_block)
|
1175
|
+
end
|
1176
|
+
# Then apply on each systemI.
|
1177
|
+
self.each_systemI do |systemI|
|
1178
|
+
systemI.each_deep(&ruby_block)
|
1179
|
+
end
|
1180
|
+
# Then apply on each code.
|
1181
|
+
self.each_code do |code|
|
1182
|
+
code.each_deep(&ruby_block)
|
1183
|
+
end
|
1184
|
+
# Then apply on each connection.
|
1185
|
+
self.each_connection do |connection|
|
1186
|
+
connection.each_deep(&ruby_block)
|
1187
|
+
end
|
1188
|
+
# Then apply on each behavior.
|
1189
|
+
self.each_behavior do |behavior|
|
1190
|
+
behavior.each_deep(&ruby_block)
|
1191
|
+
end
|
1192
|
+
end
|
1193
|
+
|
1194
|
+
|
1120
1195
|
|
1121
1196
|
# Gets the top scope, i.e. the first scope of the current system.
|
1122
1197
|
def top_scope
|
@@ -1146,6 +1221,9 @@ module HDLRuby::Low
|
|
1146
1221
|
@name = name.to_sym
|
1147
1222
|
end
|
1148
1223
|
|
1224
|
+
# Add decorator capability (modifies intialize to put after).
|
1225
|
+
include Hdecorator
|
1226
|
+
|
1149
1227
|
# Comparison for hash: structural comparison.
|
1150
1228
|
def eql?(obj)
|
1151
1229
|
return false unless obj.is_a?(Type)
|
@@ -1256,6 +1334,7 @@ module HDLRuby::Low
|
|
1256
1334
|
ruby_block.call(self)
|
1257
1335
|
# And that's all by default.
|
1258
1336
|
end
|
1337
|
+
alias_method :each_deep, :each_type_deep
|
1259
1338
|
|
1260
1339
|
# Converts to a bit vector.
|
1261
1340
|
def to_vector
|
@@ -1452,6 +1531,8 @@ module HDLRuby::Low
|
|
1452
1531
|
@def.each_type_deep(&ruby_block)
|
1453
1532
|
end
|
1454
1533
|
|
1534
|
+
alias_method :each_deep, :each_type_deep
|
1535
|
+
|
1455
1536
|
# Moved to constructor
|
1456
1537
|
# # Delegate the type methods to the ref.
|
1457
1538
|
# def_delegators :@def,
|
@@ -1601,6 +1682,8 @@ module HDLRuby::Low
|
|
1601
1682
|
# And recurse on the base.
|
1602
1683
|
@base.each_type_deep(&ruby_block)
|
1603
1684
|
end
|
1685
|
+
|
1686
|
+
alias_method :each_deep, :each_type_deep
|
1604
1687
|
end
|
1605
1688
|
|
1606
1689
|
|
@@ -1756,6 +1839,8 @@ module HDLRuby::Low
|
|
1756
1839
|
@types.each { |type| type.each_type_deep(&ruby_block) }
|
1757
1840
|
end
|
1758
1841
|
|
1842
|
+
alias_method :each_deep, :each_type_deep
|
1843
|
+
|
1759
1844
|
# Tell if the tuple is regular, i.e., all its sub types are equivalent.
|
1760
1845
|
#
|
1761
1846
|
# NOTE: empty tuples are assumed not to be regular.
|
@@ -1927,6 +2012,8 @@ module HDLRuby::Low
|
|
1927
2012
|
@types.each_value { |type| type.each_type_deep(&ruby_block) }
|
1928
2013
|
end
|
1929
2014
|
|
2015
|
+
alias_method :each_deep, :each_type_deep
|
2016
|
+
|
1930
2017
|
# Gets the bitwidth of the type, nil for undefined.
|
1931
2018
|
#
|
1932
2019
|
# NOTE: must be redefined for specific types.
|
@@ -2012,6 +2099,9 @@ module HDLRuby::Low
|
|
2012
2099
|
# @block = block
|
2013
2100
|
end
|
2014
2101
|
|
2102
|
+
# Add decorator capability (modifies intialize to put after).
|
2103
|
+
include Hdecorator
|
2104
|
+
|
2015
2105
|
# Sets the block if not already set.
|
2016
2106
|
def block=(block)
|
2017
2107
|
# Check the block.
|
@@ -2134,6 +2224,22 @@ module HDLRuby::Low
|
|
2134
2224
|
@block.reverse_each_statement(&ruby_block)
|
2135
2225
|
end
|
2136
2226
|
|
2227
|
+
# Iterates over each object deeply.
|
2228
|
+
#
|
2229
|
+
# Returns an enumerator if no ruby block is given.
|
2230
|
+
def each_deep(&ruby_block)
|
2231
|
+
# No ruby block? Return an enumerator.
|
2232
|
+
return to_enum(:each_deep) unless ruby_block
|
2233
|
+
# A ruby block? First apply it to current.
|
2234
|
+
ruby_block.call(self)
|
2235
|
+
# Then apply on each event.
|
2236
|
+
self.each_event do |event|
|
2237
|
+
event.each_deep(&ruby_block)
|
2238
|
+
end
|
2239
|
+
# Then apply on the block.
|
2240
|
+
self.block.each_deep(&ruby_block)
|
2241
|
+
end
|
2242
|
+
|
2137
2243
|
# Returns the last statement.
|
2138
2244
|
def last_statement
|
2139
2245
|
@block.last_statement
|
@@ -2217,6 +2323,9 @@ module HDLRuby::Low
|
|
2217
2323
|
ref.parent = self
|
2218
2324
|
end
|
2219
2325
|
|
2326
|
+
# Add decorator capability (modifies intialize to put after).
|
2327
|
+
include Hdecorator
|
2328
|
+
|
2220
2329
|
# Comparison for hash: structural comparison.
|
2221
2330
|
def eql?(obj)
|
2222
2331
|
return false unless obj.is_a?(Event)
|
@@ -2236,6 +2345,20 @@ module HDLRuby::Low
|
|
2236
2345
|
def on_edge?
|
2237
2346
|
return (@type == :posedge or @type == :negedge)
|
2238
2347
|
end
|
2348
|
+
|
2349
|
+
# Iterates over each object deeply.
|
2350
|
+
#
|
2351
|
+
# Returns an enumerator if no ruby block is given.
|
2352
|
+
def each_deep(&ruby_block)
|
2353
|
+
# No ruby block? Return an enumerator.
|
2354
|
+
return to_enum(:each_deep) unless ruby_block
|
2355
|
+
# A ruby block? First apply it to current.
|
2356
|
+
ruby_block.call(self)
|
2357
|
+
# Then apply on the type.
|
2358
|
+
self.type.each_deep(&ruby_block)
|
2359
|
+
# Then apply on the reference.
|
2360
|
+
self.ref.each_deep(&ruby_block)
|
2361
|
+
end
|
2239
2362
|
end
|
2240
2363
|
|
2241
2364
|
|
@@ -2278,6 +2401,23 @@ module HDLRuby::Low
|
|
2278
2401
|
end
|
2279
2402
|
end
|
2280
2403
|
|
2404
|
+
# Add decorator capability (modifies intialize to put after).
|
2405
|
+
include Hdecorator
|
2406
|
+
|
2407
|
+
# Iterates over each object deeply.
|
2408
|
+
#
|
2409
|
+
# Returns an enumerator if no ruby block is given.
|
2410
|
+
def each_deep(&ruby_block)
|
2411
|
+
# No ruby block? Return an enumerator.
|
2412
|
+
return to_enum(:each_deep) unless ruby_block
|
2413
|
+
# A ruby block? First apply it to current.
|
2414
|
+
ruby_block.call(self)
|
2415
|
+
# Then apply on the type.
|
2416
|
+
self.type.each_deep(&ruby_block)
|
2417
|
+
# Then apply on the value.
|
2418
|
+
self.value.each_deep(&ruby_block) if self.value
|
2419
|
+
end
|
2420
|
+
|
2281
2421
|
# Comparison for hash: structural comparison.
|
2282
2422
|
def eql?(obj)
|
2283
2423
|
return false unless obj.is_a?(SignalI)
|
@@ -2341,6 +2481,22 @@ module HDLRuby::Low
|
|
2341
2481
|
@systemTs = [ @systemT ]
|
2342
2482
|
end
|
2343
2483
|
|
2484
|
+
# Add decorator capability (modifies intialize to put after).
|
2485
|
+
include Hdecorator
|
2486
|
+
|
2487
|
+
# Iterates over each object deeply.
|
2488
|
+
#
|
2489
|
+
# Returns an enumerator if no ruby block is given.
|
2490
|
+
def each_deep(&ruby_block)
|
2491
|
+
# No ruby block? Return an enumerator.
|
2492
|
+
return to_enum(:each_deep) unless ruby_block
|
2493
|
+
# A ruby block? First apply it to current.
|
2494
|
+
ruby_block.call(self)
|
2495
|
+
|
2496
|
+
# Do not recurse on the systemTs since necesarily processed
|
2497
|
+
# before!
|
2498
|
+
end
|
2499
|
+
|
2344
2500
|
# Comparison for hash: structural comparison.
|
2345
2501
|
def eql?(obj)
|
2346
2502
|
return false unless obj.is_a?(SystemI)
|
@@ -2457,6 +2613,9 @@ module HDLRuby::Low
|
|
2457
2613
|
lumps.each { |lump| self.add_lump(lump) }
|
2458
2614
|
end
|
2459
2615
|
|
2616
|
+
# Add decorator capability (modifies intialize to put after).
|
2617
|
+
include Hdecorator
|
2618
|
+
|
2460
2619
|
# Adds a +lump+ of code, it is ment to become an expression or
|
2461
2620
|
# some text.
|
2462
2621
|
def add_lump(lump)
|
@@ -2476,6 +2635,16 @@ module HDLRuby::Low
|
|
2476
2635
|
# A ruby block? Apply it on each lump.
|
2477
2636
|
@lumps.each(&ruby_block)
|
2478
2637
|
end
|
2638
|
+
|
2639
|
+
# Iterates over each object deeply.
|
2640
|
+
#
|
2641
|
+
# Returns an enumerator if no ruby block is given.
|
2642
|
+
def each_deep(&ruby_block)
|
2643
|
+
# No ruby block? Return an enumerator.
|
2644
|
+
return to_enum(:each_deep) unless ruby_block
|
2645
|
+
# A ruby block? First apply it to current.
|
2646
|
+
ruby_block.call(self)
|
2647
|
+
end
|
2479
2648
|
end
|
2480
2649
|
|
2481
2650
|
|
@@ -2493,6 +2662,9 @@ module HDLRuby::Low
|
|
2493
2662
|
@chunks = HashName.new
|
2494
2663
|
end
|
2495
2664
|
|
2665
|
+
# Add decorator capability (modifies intialize to put after).
|
2666
|
+
include Hdecorator
|
2667
|
+
|
2496
2668
|
# Adds a +chunk+ to the sensitivity list.
|
2497
2669
|
def add_chunk(chunk)
|
2498
2670
|
# Check and add the chunk.
|
@@ -2555,6 +2727,24 @@ module HDLRuby::Low
|
|
2555
2727
|
return false
|
2556
2728
|
end
|
2557
2729
|
|
2730
|
+
# Iterates over each object deeply.
|
2731
|
+
#
|
2732
|
+
# Returns an enumerator if no ruby block is given.
|
2733
|
+
def each_deep(&ruby_block)
|
2734
|
+
# No ruby block? Return an enumerator.
|
2735
|
+
return to_enum(:each_deep) unless ruby_block
|
2736
|
+
# A ruby block? First apply it to current.
|
2737
|
+
ruby_block.call(self)
|
2738
|
+
# Then apply on each chunk.
|
2739
|
+
self.each_chunk do |chunk|
|
2740
|
+
chunk.each_deep(&ruby_block)
|
2741
|
+
end
|
2742
|
+
# Then apply on each event.
|
2743
|
+
self.each_event do |event|
|
2744
|
+
event.each_deep(&ruby_block)
|
2745
|
+
end
|
2746
|
+
end
|
2747
|
+
|
2558
2748
|
# Comparison for hash: structural comparison.
|
2559
2749
|
def eql?(obj)
|
2560
2750
|
return false unless obj.is_a?(Code)
|
@@ -2584,6 +2774,7 @@ module HDLRuby::Low
|
|
2584
2774
|
# NOTE: this is an abstract class which is not to be used directly.
|
2585
2775
|
class Statement
|
2586
2776
|
include Hparent
|
2777
|
+
include Hdecorator
|
2587
2778
|
|
2588
2779
|
# Clones (deeply)
|
2589
2780
|
def clone
|
@@ -2591,6 +2782,14 @@ module HDLRuby::Low
|
|
2591
2782
|
"Internal error: clone is not defined for class: #{self.class}"
|
2592
2783
|
end
|
2593
2784
|
|
2785
|
+
# Iterates over each object deeply.
|
2786
|
+
#
|
2787
|
+
# Returns an enumerator if no ruby block is given.
|
2788
|
+
def each_deep(&ruby_block)
|
2789
|
+
raise AnyError,
|
2790
|
+
"Internal error: each_deep is not defined for class: #{self.class}"
|
2791
|
+
end
|
2792
|
+
|
2594
2793
|
# Comparison for hash: structural comparison.
|
2595
2794
|
def eql?(obj)
|
2596
2795
|
raise AnyError,
|
@@ -2692,6 +2891,7 @@ module HDLRuby::Low
|
|
2692
2891
|
raise AnyError,
|
2693
2892
|
"Invalid class for a reference (left value): #{left.class}"
|
2694
2893
|
end
|
2894
|
+
super()
|
2695
2895
|
@left = left
|
2696
2896
|
# and set its parent.
|
2697
2897
|
left.parent = self
|
@@ -2704,6 +2904,20 @@ module HDLRuby::Low
|
|
2704
2904
|
right.parent = self
|
2705
2905
|
end
|
2706
2906
|
|
2907
|
+
# Iterates over each object deeply.
|
2908
|
+
#
|
2909
|
+
# Returns an enumerator if no ruby block is given.
|
2910
|
+
def each_deep(&ruby_block)
|
2911
|
+
# No ruby block? Return an enumerator.
|
2912
|
+
return to_enum(:each_deep) unless ruby_block
|
2913
|
+
# A ruby block? First apply it to current.
|
2914
|
+
ruby_block.call(self)
|
2915
|
+
# Then apply on the left.
|
2916
|
+
self.left.each_deep(&ruby_block)
|
2917
|
+
# Then apply on the right.
|
2918
|
+
self.right.each_deep(&ruby_block)
|
2919
|
+
end
|
2920
|
+
|
2707
2921
|
# Comparison for hash: structural comparison.
|
2708
2922
|
def eql?(obj)
|
2709
2923
|
return false unless obj.is_a?(Transmit)
|
@@ -2793,6 +3007,7 @@ module HDLRuby::Low
|
|
2793
3007
|
raise AnyError,
|
2794
3008
|
"Invalid class for a condition: #{condition.class}"
|
2795
3009
|
end
|
3010
|
+
super()
|
2796
3011
|
@condition = condition
|
2797
3012
|
# And set its parent.
|
2798
3013
|
condition.parent = self
|
@@ -2815,6 +3030,27 @@ module HDLRuby::Low
|
|
2815
3030
|
@noifs = []
|
2816
3031
|
end
|
2817
3032
|
|
3033
|
+
# Iterates over each object deeply.
|
3034
|
+
#
|
3035
|
+
# Returns an enumerator if no ruby block is given.
|
3036
|
+
def each_deep(&ruby_block)
|
3037
|
+
# No ruby block? Return an enumerator.
|
3038
|
+
return to_enum(:each_deep) unless ruby_block
|
3039
|
+
# A ruby block? First apply it to current.
|
3040
|
+
ruby_block.call(self)
|
3041
|
+
# Then apply on the condition.
|
3042
|
+
self.condition.each_deep(&ruby_block)
|
3043
|
+
# Then apply on the yes.
|
3044
|
+
self.yes.each_deep(&ruby_block)
|
3045
|
+
# The apply on the no.
|
3046
|
+
self.no.each_deep(&ruby_block)
|
3047
|
+
# Then apply on the alternate ifs.
|
3048
|
+
self.each_noif do |cond,stmnt|
|
3049
|
+
cond.each_deep(&ruby_block)
|
3050
|
+
stmnt.each_deep(&ruby_block)
|
3051
|
+
end
|
3052
|
+
end
|
3053
|
+
|
2818
3054
|
# Comparison for hash: structural comparison.
|
2819
3055
|
def eql?(obj)
|
2820
3056
|
return false unless obj.is_a?(If)
|
@@ -3000,6 +3236,23 @@ module HDLRuby::Low
|
|
3000
3236
|
match.parent = statement.parent = self
|
3001
3237
|
end
|
3002
3238
|
|
3239
|
+
# Add decorator capability (modifies intialize to put after).
|
3240
|
+
include Hdecorator
|
3241
|
+
|
3242
|
+
# Iterates over each object deeply.
|
3243
|
+
#
|
3244
|
+
# Returns an enumerator if no ruby block is given.
|
3245
|
+
def each_deep(&ruby_block)
|
3246
|
+
# No ruby block? Return an enumerator.
|
3247
|
+
return to_enum(:each_deep) unless ruby_block
|
3248
|
+
# A ruby block? First apply it to current.
|
3249
|
+
ruby_block.call(self)
|
3250
|
+
# Then apply on the match.
|
3251
|
+
self.match.each_deep(&ruby_block)
|
3252
|
+
# Then apply on the statement.
|
3253
|
+
self.statement.each_deep(&ruby_block)
|
3254
|
+
end
|
3255
|
+
|
3003
3256
|
# Comparison for hash: structural comparison.
|
3004
3257
|
def eql?(obj)
|
3005
3258
|
return false unless obj.is_a?(When)
|
@@ -3096,6 +3349,7 @@ module HDLRuby::Low
|
|
3096
3349
|
unless value.is_a?(Expression)
|
3097
3350
|
raise AnyError, "Invalid class for a value: #{value.class}"
|
3098
3351
|
end
|
3352
|
+
super()
|
3099
3353
|
@value = value
|
3100
3354
|
# And set its parent.
|
3101
3355
|
value.parent = self
|
@@ -3106,6 +3360,22 @@ module HDLRuby::Low
|
|
3106
3360
|
whens.each { |w| self.add_when(w) }
|
3107
3361
|
end
|
3108
3362
|
|
3363
|
+
# Iterates over each object deeply.
|
3364
|
+
#
|
3365
|
+
# Returns an enumerator if no ruby block is given.
|
3366
|
+
def each_deep(&ruby_block)
|
3367
|
+
# No ruby block? Return an enumerator.
|
3368
|
+
return to_enum(:each_deep) unless ruby_block
|
3369
|
+
# A ruby block? First apply it to current.
|
3370
|
+
ruby_block.call(self)
|
3371
|
+
# Then apply on the value.
|
3372
|
+
self.value.each_deep(&ruby_block)
|
3373
|
+
# Then apply on the whens.
|
3374
|
+
self.each_when do |w|
|
3375
|
+
w.each_deep(&ruby_block)
|
3376
|
+
end
|
3377
|
+
end
|
3378
|
+
|
3109
3379
|
# Comparison for hash: structural comparison.
|
3110
3380
|
def eql?(obj)
|
3111
3381
|
return false unless obj.is_a?(Case)
|
@@ -3266,6 +3536,21 @@ module HDLRuby::Low
|
|
3266
3536
|
@unit = unit.to_sym
|
3267
3537
|
end
|
3268
3538
|
|
3539
|
+
# Add decorator capability (modifies intialize to put after).
|
3540
|
+
include Hdecorator
|
3541
|
+
|
3542
|
+
# Iterates over each object deeply.
|
3543
|
+
#
|
3544
|
+
# Returns an enumerator if no ruby block is given.
|
3545
|
+
def each_deep(&ruby_block)
|
3546
|
+
# No ruby block? Return an enumerator.
|
3547
|
+
return to_enum(:each_deep) unless ruby_block
|
3548
|
+
# A ruby block? First apply it to current.
|
3549
|
+
ruby_block.call(self)
|
3550
|
+
# Then apply on the value.
|
3551
|
+
self.value.each_deep(&ruby_block)
|
3552
|
+
end
|
3553
|
+
|
3269
3554
|
# Comparison for hash: structural comparison.
|
3270
3555
|
def eql?(obj)
|
3271
3556
|
return false unless obj.is_a?(Delay)
|
@@ -3298,6 +3583,7 @@ module HDLRuby::Low
|
|
3298
3583
|
unless delay.is_a?(Delay)
|
3299
3584
|
raise AnyError, "Invalid class for a delay: #{delay.class}."
|
3300
3585
|
end
|
3586
|
+
super()
|
3301
3587
|
@delay = delay
|
3302
3588
|
# And set its parent.
|
3303
3589
|
delay.parent = self
|
@@ -3310,6 +3596,18 @@ module HDLRuby::Low
|
|
3310
3596
|
return true
|
3311
3597
|
end
|
3312
3598
|
|
3599
|
+
# Iterates over each object deeply.
|
3600
|
+
#
|
3601
|
+
# Returns an enumerator if no ruby block is given.
|
3602
|
+
def each_deep(&ruby_block)
|
3603
|
+
# No ruby block? Return an enumerator.
|
3604
|
+
return to_enum(:each_deep) unless ruby_block
|
3605
|
+
# A ruby block? First apply it to current.
|
3606
|
+
ruby_block.call(self)
|
3607
|
+
# Then apply on the delay.
|
3608
|
+
self.delay.each_deep(&ruby_block)
|
3609
|
+
end
|
3610
|
+
|
3313
3611
|
# Hash function.
|
3314
3612
|
def hash
|
3315
3613
|
return [@delay].hash
|
@@ -3381,6 +3679,7 @@ module HDLRuby::Low
|
|
3381
3679
|
raise AnyError,
|
3382
3680
|
"Invalid class for a statement: #{statement.class}."
|
3383
3681
|
end
|
3682
|
+
super()
|
3384
3683
|
@statement = statement
|
3385
3684
|
# And set its parent.
|
3386
3685
|
statement.parent = self
|
@@ -3394,6 +3693,20 @@ module HDLRuby::Low
|
|
3394
3693
|
delay.parent = self
|
3395
3694
|
end
|
3396
3695
|
|
3696
|
+
# Iterates over each object deeply.
|
3697
|
+
#
|
3698
|
+
# Returns an enumerator if no ruby block is given.
|
3699
|
+
def each_deep(&ruby_block)
|
3700
|
+
# No ruby block? Return an enumerator.
|
3701
|
+
return to_enum(:each_deep) unless ruby_block
|
3702
|
+
# A ruby block? First apply it to current.
|
3703
|
+
ruby_block.call(self)
|
3704
|
+
# Then apply on the statement.
|
3705
|
+
self.statement.each_deep(&ruby_block)
|
3706
|
+
# Then apply on the delay.
|
3707
|
+
self.delay.each_deep(&ruby_block)
|
3708
|
+
end
|
3709
|
+
|
3397
3710
|
# Comparison for hash: structural comparison.
|
3398
3711
|
def eql?(obj)
|
3399
3712
|
return false unless obj.is_a?(TimeRepeat)
|
@@ -3473,6 +3786,7 @@ module HDLRuby::Low
|
|
3473
3786
|
|
3474
3787
|
# Creates a new +mode+ sort of block with possible +name+.
|
3475
3788
|
def initialize(mode, name = :"")
|
3789
|
+
super()
|
3476
3790
|
# puts "new block with mode=#{mode} and name=#{name}"
|
3477
3791
|
# Check and set the type.
|
3478
3792
|
@mode = mode.to_sym
|
@@ -3485,6 +3799,24 @@ module HDLRuby::Low
|
|
3485
3799
|
@statements = []
|
3486
3800
|
end
|
3487
3801
|
|
3802
|
+
# Iterates over each object deeply.
|
3803
|
+
#
|
3804
|
+
# Returns an enumerator if no ruby block is given.
|
3805
|
+
def each_deep(&ruby_block)
|
3806
|
+
# No ruby block? Return an enumerator.
|
3807
|
+
return to_enum(:each_deep) unless ruby_block
|
3808
|
+
# A ruby block? First apply it to current.
|
3809
|
+
ruby_block.call(self)
|
3810
|
+
# Then apply on the inners.
|
3811
|
+
self.each_inner do |inner|
|
3812
|
+
inner.each_deep(&ruby_block)
|
3813
|
+
end
|
3814
|
+
# Then apply on the statements.
|
3815
|
+
self.each_statement do |stmnt|
|
3816
|
+
stmnt.each_deep(&ruby_block)
|
3817
|
+
end
|
3818
|
+
end
|
3819
|
+
|
3488
3820
|
# Comparison for hash: structural comparison.
|
3489
3821
|
def eql?(obj)
|
3490
3822
|
return false unless obj.is_a?(Block)
|
@@ -3810,6 +4142,9 @@ module HDLRuby::Low
|
|
3810
4142
|
end
|
3811
4143
|
end
|
3812
4144
|
|
4145
|
+
# Add decorator capability (modifies intialize to put after).
|
4146
|
+
include Hdecorator
|
4147
|
+
|
3813
4148
|
# Comparison for hash: structural comparison.
|
3814
4149
|
def eql?(obj)
|
3815
4150
|
return false unless obj.is_a?(Expression)
|
@@ -3925,6 +4260,22 @@ module HDLRuby::Low
|
|
3925
4260
|
@content = content
|
3926
4261
|
end
|
3927
4262
|
|
4263
|
+
# Iterates over each object deeply.
|
4264
|
+
#
|
4265
|
+
# Returns an enumerator if no ruby block is given.
|
4266
|
+
def each_deep(&ruby_block)
|
4267
|
+
# No ruby block? Return an enumerator.
|
4268
|
+
return to_enum(:each_deep) unless ruby_block
|
4269
|
+
# A ruby block? First apply it to current.
|
4270
|
+
ruby_block.call(self)
|
4271
|
+
# Then apply on the type.
|
4272
|
+
self.type.each_deep(&ruby_block)
|
4273
|
+
# Then apply on the content if possible.
|
4274
|
+
if self.content.respond_to?(:each_deep) then
|
4275
|
+
self.content.each_deep(&ruby_block)
|
4276
|
+
end
|
4277
|
+
end
|
4278
|
+
|
3928
4279
|
# Comparison for hash: structural comparison.
|
3929
4280
|
def eql?(obj)
|
3930
4281
|
# General comparison.
|
@@ -3994,6 +4345,20 @@ module HDLRuby::Low
|
|
3994
4345
|
child.parent = self
|
3995
4346
|
end
|
3996
4347
|
|
4348
|
+
# Iterates over each object deeply.
|
4349
|
+
#
|
4350
|
+
# Returns an enumerator if no ruby block is given.
|
4351
|
+
def each_deep(&ruby_block)
|
4352
|
+
# No ruby block? Return an enumerator.
|
4353
|
+
return to_enum(:each_deep) unless ruby_block
|
4354
|
+
# A ruby block? First apply it to current.
|
4355
|
+
ruby_block.call(self)
|
4356
|
+
# Then apply on the type.
|
4357
|
+
self.type.each_deep(&ruby_block)
|
4358
|
+
# Then apply on the child.
|
4359
|
+
self.child.each_deep(&ruby_block)
|
4360
|
+
end
|
4361
|
+
|
3997
4362
|
# Comparison for hash: structural comparison.
|
3998
4363
|
def eql?(obj)
|
3999
4364
|
# General comparison.
|
@@ -4110,6 +4475,20 @@ module HDLRuby::Low
|
|
4110
4475
|
child.parent = self
|
4111
4476
|
end
|
4112
4477
|
|
4478
|
+
# Iterates over each object deeply.
|
4479
|
+
#
|
4480
|
+
# Returns an enumerator if no ruby block is given.
|
4481
|
+
def each_deep(&ruby_block)
|
4482
|
+
# No ruby block? Return an enumerator.
|
4483
|
+
return to_enum(:each_deep) unless ruby_block
|
4484
|
+
# A ruby block? First apply it to current.
|
4485
|
+
ruby_block.call(self)
|
4486
|
+
# Then apply on the type.
|
4487
|
+
self.type.each_deep(&ruby_block)
|
4488
|
+
# Then apply on the child.
|
4489
|
+
self.child.each_deep(&ruby_block)
|
4490
|
+
end
|
4491
|
+
|
4113
4492
|
# Comparison for hash: structural comparison.
|
4114
4493
|
def eql?(obj)
|
4115
4494
|
# General comparison.
|
@@ -4198,6 +4577,22 @@ module HDLRuby::Low
|
|
4198
4577
|
left.parent = right.parent = self
|
4199
4578
|
end
|
4200
4579
|
|
4580
|
+
# Iterates over each object deeply.
|
4581
|
+
#
|
4582
|
+
# Returns an enumerator if no ruby block is given.
|
4583
|
+
def each_deep(&ruby_block)
|
4584
|
+
# No ruby block? Return an enumerator.
|
4585
|
+
return to_enum(:each_deep) unless ruby_block
|
4586
|
+
# A ruby block? First apply it to current.
|
4587
|
+
ruby_block.call(self)
|
4588
|
+
# Then apply on the type.
|
4589
|
+
self.type.each_deep(&ruby_block)
|
4590
|
+
# Then apply on the left.
|
4591
|
+
self.left.each_deep(&ruby_block)
|
4592
|
+
# Then apply on the right.
|
4593
|
+
self.right.each_deep(&ruby_block)
|
4594
|
+
end
|
4595
|
+
|
4201
4596
|
# Comparison for hash: structural comparison.
|
4202
4597
|
def eql?(obj)
|
4203
4598
|
# General comparison.
|
@@ -4293,6 +4688,24 @@ module HDLRuby::Low
|
|
4293
4688
|
end
|
4294
4689
|
end
|
4295
4690
|
|
4691
|
+
# Iterates over each object deeply.
|
4692
|
+
#
|
4693
|
+
# Returns an enumerator if no ruby block is given.
|
4694
|
+
def each_deep(&ruby_block)
|
4695
|
+
# No ruby block? Return an enumerator.
|
4696
|
+
return to_enum(:each_deep) unless ruby_block
|
4697
|
+
# A ruby block? First apply it to current.
|
4698
|
+
ruby_block.call(self)
|
4699
|
+
# Then apply on the type.
|
4700
|
+
self.type.each_deep(&ruby_block)
|
4701
|
+
# Then apply on the select.
|
4702
|
+
self.select.each_deep(&ruby_block)
|
4703
|
+
# Then apply on the choices.
|
4704
|
+
self.each_choice do |choice|
|
4705
|
+
choice.each_deep(&ruby_block)
|
4706
|
+
end
|
4707
|
+
end
|
4708
|
+
|
4296
4709
|
# Comparison for hash: structural comparison.
|
4297
4710
|
def eql?(obj)
|
4298
4711
|
# General comparison.
|
@@ -4409,6 +4822,22 @@ module HDLRuby::Low
|
|
4409
4822
|
expressions.each { |expression| self.add_expression(expression) }
|
4410
4823
|
end
|
4411
4824
|
|
4825
|
+
# Iterates over each object deeply.
|
4826
|
+
#
|
4827
|
+
# Returns an enumerator if no ruby block is given.
|
4828
|
+
def each_deep(&ruby_block)
|
4829
|
+
# No ruby block? Return an enumerator.
|
4830
|
+
return to_enum(:each_deep) unless ruby_block
|
4831
|
+
# A ruby block? First apply it to current.
|
4832
|
+
ruby_block.call(self)
|
4833
|
+
# Then apply on the type.
|
4834
|
+
self.type.each_deep(&ruby_block)
|
4835
|
+
# Then apply on the expressions.
|
4836
|
+
self.each_expression do |expr|
|
4837
|
+
expr.each_deep(&ruby_block)
|
4838
|
+
end
|
4839
|
+
end
|
4840
|
+
|
4412
4841
|
# Comparison for hash: structural comparison.
|
4413
4842
|
def eql?(obj)
|
4414
4843
|
# General comparison.
|
@@ -4556,6 +4985,22 @@ module HDLRuby::Low
|
|
4556
4985
|
refs.each { |ref| ref.parent = self }
|
4557
4986
|
end
|
4558
4987
|
|
4988
|
+
# Iterates over each object deeply.
|
4989
|
+
#
|
4990
|
+
# Returns an enumerator if no ruby block is given.
|
4991
|
+
def each_deep(&ruby_block)
|
4992
|
+
# No ruby block? Return an enumerator.
|
4993
|
+
return to_enum(:each_deep) unless ruby_block
|
4994
|
+
# A ruby block? First apply it to current.
|
4995
|
+
ruby_block.call(self)
|
4996
|
+
# Then apply on the type.
|
4997
|
+
self.type.each_deep(&ruby_block)
|
4998
|
+
# Then apply on the sub references.
|
4999
|
+
self.each_ref do |ref|
|
5000
|
+
ref.each_deep(&ruby_block)
|
5001
|
+
end
|
5002
|
+
end
|
5003
|
+
|
4559
5004
|
# Comparison for hash: structural comparison.
|
4560
5005
|
def eql?(obj)
|
4561
5006
|
# General comparison.
|
@@ -4657,6 +5102,24 @@ module HDLRuby::Low
|
|
4657
5102
|
index.parent = self
|
4658
5103
|
end
|
4659
5104
|
|
5105
|
+
# Iterates over each object deeply.
|
5106
|
+
#
|
5107
|
+
# Returns an enumerator if no ruby block is given.
|
5108
|
+
def each_deep(&ruby_block)
|
5109
|
+
# No ruby block? Return an enumerator.
|
5110
|
+
return to_enum(:each_deep) unless ruby_block
|
5111
|
+
# A ruby block? First apply it to current.
|
5112
|
+
ruby_block.call(self)
|
5113
|
+
# Then apply on the type.
|
5114
|
+
self.type.each_deep(&ruby_block)
|
5115
|
+
# Then apply on the reference.
|
5116
|
+
self.ref.each_deep(&ruby_block)
|
5117
|
+
# Then apply on the index if possible.
|
5118
|
+
if self.index.respond_to?(:each_deep) then
|
5119
|
+
self.index.each_deep(&ruby_block)
|
5120
|
+
end
|
5121
|
+
end
|
5122
|
+
|
4660
5123
|
# Comparison for hash: structural comparison.
|
4661
5124
|
def eql?(obj)
|
4662
5125
|
# General comparison.
|
@@ -4752,6 +5215,27 @@ module HDLRuby::Low
|
|
4752
5215
|
first.parent = last.parent = self
|
4753
5216
|
end
|
4754
5217
|
|
5218
|
+
# Iterates over each object deeply.
|
5219
|
+
#
|
5220
|
+
# Returns an enumerator if no ruby block is given.
|
5221
|
+
def each_deep(&ruby_block)
|
5222
|
+
# No ruby block? Return an enumerator.
|
5223
|
+
return to_enum(:each_deep) unless ruby_block
|
5224
|
+
# A ruby block? First apply it to current.
|
5225
|
+
ruby_block.call(self)
|
5226
|
+
# Then apply on the type.
|
5227
|
+
self.type.each_deep(&ruby_block)
|
5228
|
+
# Then apply on the reference.
|
5229
|
+
self.ref.each_deep(&ruby_block)
|
5230
|
+
# Then apply on the range if possible.
|
5231
|
+
if self.range.first.respond_to?(:each_deep) then
|
5232
|
+
self.range.first.each_deep(&ruby_block)
|
5233
|
+
end
|
5234
|
+
if self.range.last.respond_to?(:each_deep) then
|
5235
|
+
self.range.last.each_deep(&ruby_block)
|
5236
|
+
end
|
5237
|
+
end
|
5238
|
+
|
4755
5239
|
# Comparison for hash: structural comparison.
|
4756
5240
|
#
|
4757
5241
|
# NOTE: ranges are assumed to be flattened (a range of range is
|
@@ -4843,6 +5327,20 @@ module HDLRuby::Low
|
|
4843
5327
|
@name = name.to_sym
|
4844
5328
|
end
|
4845
5329
|
|
5330
|
+
# Iterates over each object deeply.
|
5331
|
+
#
|
5332
|
+
# Returns an enumerator if no ruby block is given.
|
5333
|
+
def each_deep(&ruby_block)
|
5334
|
+
# No ruby block? Return an enumerator.
|
5335
|
+
return to_enum(:each_deep) unless ruby_block
|
5336
|
+
# A ruby block? First apply it to current.
|
5337
|
+
ruby_block.call(self)
|
5338
|
+
# Then apply on the type.
|
5339
|
+
self.type.each_deep(&ruby_block)
|
5340
|
+
# Then apply on the reference.
|
5341
|
+
self.ref.each_deep(&ruby_block)
|
5342
|
+
end
|
5343
|
+
|
4846
5344
|
# Get the full name of the reference, i.e. including the sub ref
|
4847
5345
|
# names if any.
|
4848
5346
|
def full_name
|
@@ -4918,6 +5416,19 @@ module HDLRuby::Low
|
|
4918
5416
|
#
|
4919
5417
|
# This is the current system.
|
4920
5418
|
class RefThis < Ref
|
5419
|
+
|
5420
|
+
# Iterates over each object deeply.
|
5421
|
+
#
|
5422
|
+
# Returns an enumerator if no ruby block is given.
|
5423
|
+
def each_deep(&ruby_block)
|
5424
|
+
# No ruby block? Return an enumerator.
|
5425
|
+
return to_enum(:each_deep) unless ruby_block
|
5426
|
+
# A ruby block? First apply it to current.
|
5427
|
+
ruby_block.call(self)
|
5428
|
+
# Then apply on the type.
|
5429
|
+
self.type.each_deep(&ruby_block)
|
5430
|
+
end
|
5431
|
+
|
4921
5432
|
# Clones this.
|
4922
5433
|
def clone
|
4923
5434
|
return RefThis.new
|