HDLRuby 2.3.7 → 2.3.8
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/hdr_samples/with_fixpoint.rb +9 -0
- data/lib/HDLRuby/hruby_low.rb +93 -0
- data/lib/HDLRuby/hruby_low_mutable.rb +90 -2
- data/lib/HDLRuby/std/linear.rb +16 -8
- data/lib/HDLRuby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 164191b6cbfda40e60bc6b253c95a0ff511164007c83adf53c7f86383b404464
|
4
|
+
data.tar.gz: 5344dd9f624089cab1488d9e10b67e542cb83639db81e397c0d2241c67a43527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e9b00b3fad458789078bcaca6d8d45e7ac5877ff14a3971ce2ddac186ed15a1ad2aa440d3c5619c66f324e9f6dbeda5c8bcf2aa5de3389aa12d631abbd780a4
|
7
|
+
data.tar.gz: '08dc450e1e3807d85f8ffb22888c037b081bed44dab318fac5fb33611f706c58191a2b06379b0798b61bbf3578d0e058b144ee8995e4212250826366bd306e9e'
|
@@ -9,6 +9,8 @@ system :fix_test do
|
|
9
9
|
|
10
10
|
# Declare three 4-bit integer part 4-bit fractional part
|
11
11
|
bit[3..0,3..0].inner :x,:y,:z
|
12
|
+
# Declare three 8-bit integer part 8-bit fractional part
|
13
|
+
signed[3..0,3..0].inner :a,:b,:c,:d
|
12
14
|
|
13
15
|
# Performs calculation between then
|
14
16
|
timed do
|
@@ -22,5 +24,12 @@ system :fix_test do
|
|
22
24
|
!10.ns
|
23
25
|
z <= z / x
|
24
26
|
!10.ns
|
27
|
+
a <= _00010000
|
28
|
+
b <= _00001111
|
29
|
+
!10.ns
|
30
|
+
c <= a * b
|
31
|
+
d <= 0
|
32
|
+
!10.ns
|
33
|
+
d <= d + c
|
25
34
|
end
|
26
35
|
end
|
data/lib/HDLRuby/hruby_low.rb
CHANGED
@@ -2633,6 +2633,11 @@ module HDLRuby::Low
|
|
2633
2633
|
def parent_system
|
2634
2634
|
return self.top_scope.parent
|
2635
2635
|
end
|
2636
|
+
|
2637
|
+
# Tell if the statement includes a signal whose name is one of +names+.
|
2638
|
+
def use_name?(*names)
|
2639
|
+
# By default, nothing to do.
|
2640
|
+
end
|
2636
2641
|
end
|
2637
2642
|
|
2638
2643
|
|
@@ -2747,6 +2752,11 @@ module HDLRuby::Low
|
|
2747
2752
|
# A ruby block?
|
2748
2753
|
# Nothing to do.
|
2749
2754
|
end
|
2755
|
+
|
2756
|
+
# Tell if the statement includes a signal whose name is one of +names+.
|
2757
|
+
def use_name?(*names)
|
2758
|
+
return @left.use_name?(*names) || @right.use_name?(*names)
|
2759
|
+
end
|
2750
2760
|
end
|
2751
2761
|
|
2752
2762
|
|
@@ -2925,6 +2935,12 @@ module HDLRuby::Low
|
|
2925
2935
|
@no.each_block_deep(&ruby_block) if @no
|
2926
2936
|
end
|
2927
2937
|
|
2938
|
+
# Tell if the statement includes a signal whose name is one of +names+.
|
2939
|
+
# NOTE: for the if check only the condition.
|
2940
|
+
def use_name?(*names)
|
2941
|
+
return @condition.use_name?(*name)
|
2942
|
+
end
|
2943
|
+
|
2928
2944
|
# Clones the If (deeply)
|
2929
2945
|
def clone
|
2930
2946
|
# Duplicate the if.
|
@@ -3038,6 +3054,12 @@ module HDLRuby::Low
|
|
3038
3054
|
def top_block
|
3039
3055
|
return self.parent.is_a?(Behavior) ? self : self.parent.top_block
|
3040
3056
|
end
|
3057
|
+
|
3058
|
+
# Tell if the statement includes a signal whose name is one of +names+.
|
3059
|
+
# NOTE: for the when check only the match.
|
3060
|
+
def use_name?(*names)
|
3061
|
+
return @match.use_name?(*name)
|
3062
|
+
end
|
3041
3063
|
end
|
3042
3064
|
|
3043
3065
|
|
@@ -3186,6 +3208,12 @@ module HDLRuby::Low
|
|
3186
3208
|
@default.each_statement_deep(&ruby_block) if @default
|
3187
3209
|
end
|
3188
3210
|
|
3211
|
+
# Tell if the statement includes a signal whose name is one of +names+.
|
3212
|
+
# NOTE: for the case check only the value.
|
3213
|
+
def use_name?(*names)
|
3214
|
+
return @value.use_name?(*name)
|
3215
|
+
end
|
3216
|
+
|
3189
3217
|
# Clones the Case (deeply)
|
3190
3218
|
def clone
|
3191
3219
|
# Clone the default if any.
|
@@ -3838,6 +3866,12 @@ module HDLRuby::Low
|
|
3838
3866
|
end
|
3839
3867
|
end
|
3840
3868
|
|
3869
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
3870
|
+
def use_name?(*names)
|
3871
|
+
# By default nothing.
|
3872
|
+
return false
|
3873
|
+
end
|
3874
|
+
|
3841
3875
|
# Clones the expression (deeply)
|
3842
3876
|
def clone
|
3843
3877
|
raise AnyError,
|
@@ -3991,6 +4025,12 @@ module HDLRuby::Low
|
|
3991
4025
|
@child.each_ref_deep(&ruby_block)
|
3992
4026
|
end
|
3993
4027
|
|
4028
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4029
|
+
def use_name?(*names)
|
4030
|
+
# Recurse on the child.
|
4031
|
+
return @child.use_name?(*names)
|
4032
|
+
end
|
4033
|
+
|
3994
4034
|
# Clones the value (deeply)
|
3995
4035
|
def clone
|
3996
4036
|
return Cast.new(@type,@child.clone)
|
@@ -4101,6 +4141,12 @@ module HDLRuby::Low
|
|
4101
4141
|
@child.each_ref_deep(&ruby_block)
|
4102
4142
|
end
|
4103
4143
|
|
4144
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4145
|
+
def use_name?(*names)
|
4146
|
+
# Recurse on the child.
|
4147
|
+
return @child.use_name?(*names)
|
4148
|
+
end
|
4149
|
+
|
4104
4150
|
# Clones the unary operator (deeply)
|
4105
4151
|
def clone
|
4106
4152
|
return Unary.new(@type,self.operator,@child.clone)
|
@@ -4187,6 +4233,12 @@ module HDLRuby::Low
|
|
4187
4233
|
@right.each_ref_deep(&ruby_block)
|
4188
4234
|
end
|
4189
4235
|
|
4236
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4237
|
+
def use_name?(*names)
|
4238
|
+
# Recurse on the left and the right.
|
4239
|
+
return @left.use_name?(*names) || @right.use_name?(*names)
|
4240
|
+
end
|
4241
|
+
|
4190
4242
|
# Clones the binary operator (deeply)
|
4191
4243
|
def clone
|
4192
4244
|
return Binary.new(@type, self.operator,
|
@@ -4311,6 +4363,14 @@ module HDLRuby::Low
|
|
4311
4363
|
end
|
4312
4364
|
end
|
4313
4365
|
|
4366
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4367
|
+
def use_name?(*names)
|
4368
|
+
# Recurse on the select.
|
4369
|
+
return true if @select.use_name?(*names)
|
4370
|
+
# Recurse on the choices.
|
4371
|
+
return @choices.include? { |choice| choice.use_name?(*names) }
|
4372
|
+
end
|
4373
|
+
|
4314
4374
|
# Clones the select (deeply)
|
4315
4375
|
def clone
|
4316
4376
|
return Select.new(@type, self.operator, @select.clone,
|
@@ -4390,6 +4450,12 @@ module HDLRuby::Low
|
|
4390
4450
|
end
|
4391
4451
|
end
|
4392
4452
|
|
4453
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4454
|
+
def use_name?(*names)
|
4455
|
+
# Recurse on the expressions.
|
4456
|
+
return @expressions.include? { |expr| expr.use_name?(*names) }
|
4457
|
+
end
|
4458
|
+
|
4393
4459
|
# Clones the concatenated expression (deeply)
|
4394
4460
|
def clone
|
4395
4461
|
return Concat.new(@type,
|
@@ -4532,6 +4598,12 @@ module HDLRuby::Low
|
|
4532
4598
|
end
|
4533
4599
|
end
|
4534
4600
|
|
4601
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4602
|
+
def use_name?(*names)
|
4603
|
+
# Recurse on the references.
|
4604
|
+
return @refs.include? { |expr| expr.use_name?(*names) }
|
4605
|
+
end
|
4606
|
+
|
4535
4607
|
# Clones the concatenated references (deeply)
|
4536
4608
|
def clone
|
4537
4609
|
return RefConcat.new(@type, @refs.map { |ref| ref.clone } )
|
@@ -4615,6 +4687,12 @@ module HDLRuby::Low
|
|
4615
4687
|
@ref.each_node_deep(&ruby_block)
|
4616
4688
|
end
|
4617
4689
|
|
4690
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4691
|
+
def use_name?(*names)
|
4692
|
+
# Recurse on the index and the reference.
|
4693
|
+
return @index.use_name?(names) || @ref.use_name?(*names)
|
4694
|
+
end
|
4695
|
+
|
4618
4696
|
# Clones the indexed references (deeply)
|
4619
4697
|
def clone
|
4620
4698
|
return RefIndex.new(@type, @ref.clone, @index.clone)
|
@@ -4710,6 +4788,13 @@ module HDLRuby::Low
|
|
4710
4788
|
@ref.each_node_deep(&ruby_block)
|
4711
4789
|
end
|
4712
4790
|
|
4791
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4792
|
+
def use_name?(*names)
|
4793
|
+
# Recurse on the range and the reference.
|
4794
|
+
return @range.first.use_name?(names) ||
|
4795
|
+
@range.last.use_name?(names) || @ref.use_name?(*names)
|
4796
|
+
end
|
4797
|
+
|
4713
4798
|
# Clones the range references (deeply)
|
4714
4799
|
def clone
|
4715
4800
|
return RefRange.new(@type, @ref.clone,
|
@@ -4797,6 +4882,14 @@ module HDLRuby::Low
|
|
4797
4882
|
@ref.each_node_deep(&ruby_block)
|
4798
4883
|
end
|
4799
4884
|
|
4885
|
+
# Tell if the expression includes a signal whose name is one of +names+.
|
4886
|
+
def use_name?(*names)
|
4887
|
+
# Is the named used here?
|
4888
|
+
return true if names.include?(@name)
|
4889
|
+
# No, recurse the reference.
|
4890
|
+
return @ref.use_name?(*names)
|
4891
|
+
end
|
4892
|
+
|
4800
4893
|
# Clones the name references (deeply)
|
4801
4894
|
def clone
|
4802
4895
|
return RefName.new(@type, @ref.clone, @name)
|
@@ -156,7 +156,7 @@ module HDLRuby::Low
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
# Deletes
|
159
|
+
# Deletes a type.
|
160
160
|
def delete_type!(type)
|
161
161
|
if @types.key?(type.name) then
|
162
162
|
# The type is present, delete it.
|
@@ -167,7 +167,7 @@ module HDLRuby::Low
|
|
167
167
|
type
|
168
168
|
end
|
169
169
|
|
170
|
-
# Deletes
|
170
|
+
# Deletes a systemT.
|
171
171
|
def delete_systemT!(systemT)
|
172
172
|
if @systemTs.key?(systemT.name) then
|
173
173
|
# The systemT is present, delete it.
|
@@ -230,6 +230,33 @@ module HDLRuby::Low
|
|
230
230
|
behavior.parent = nil
|
231
231
|
end
|
232
232
|
end
|
233
|
+
|
234
|
+
# Deletes the elements related to one of +names+: either they have
|
235
|
+
# one of the names or they use an element with these names.
|
236
|
+
# NOTE: only delete actual instantiated elements, types or
|
237
|
+
# systemTs are left as is.
|
238
|
+
def delete_related!(*names)
|
239
|
+
# Delete the sub scopes whose name are in names.
|
240
|
+
@scopes.delete_if { |scope| names.include?(scope.name) }
|
241
|
+
# Delete the inner signals whose name are in names.
|
242
|
+
@inners.delete_if { |sig| names.include?(sig.name) }
|
243
|
+
# Delete the connections that contain signals whose name are
|
244
|
+
# in names.
|
245
|
+
@connections.delete_if { |connection| connection.use_name?(*names) }
|
246
|
+
# Delete the behaviors whose block name or events' name are in
|
247
|
+
# names.
|
248
|
+
@behaviors.delete_if do |behavior|
|
249
|
+
names.include?(behavior.block.name) or
|
250
|
+
behavior.each_event.include? do |event|
|
251
|
+
event.ref.use_name?(*names)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
# Recurse on the sub scopes.
|
256
|
+
@scopes.each { |scope| scope.delete_related!(names) }
|
257
|
+
# Recurse on the behaviors.
|
258
|
+
@behaviors.each { |behavior| behavior.block.delete_related!(names) }
|
259
|
+
end
|
233
260
|
end
|
234
261
|
|
235
262
|
|
@@ -514,6 +541,14 @@ module HDLRuby::Low
|
|
514
541
|
# By default: nothing to do.
|
515
542
|
return {}
|
516
543
|
end
|
544
|
+
|
545
|
+
# Deletes the elements related to one of +names+: either they have
|
546
|
+
# one of the names or they use an element with these names.
|
547
|
+
# NOTE: only delete actual instantiated elements, types or
|
548
|
+
# systemTs are left as is.
|
549
|
+
def delete_related!(*names)
|
550
|
+
# Nothing to do by default.
|
551
|
+
end
|
517
552
|
end
|
518
553
|
|
519
554
|
|
@@ -694,6 +729,21 @@ module HDLRuby::Low
|
|
694
729
|
|
695
730
|
return res
|
696
731
|
end
|
732
|
+
|
733
|
+
# Deletes the elements related to one of +names+: either they have
|
734
|
+
# one of the names or they use an element with these names.
|
735
|
+
# NOTE: only delete actual instantiated elements, types or
|
736
|
+
# systemTs are left as is.
|
737
|
+
def delete_related!(*names)
|
738
|
+
# Delete the noifs if their condition uses one of names.
|
739
|
+
@noifs.delete_if { |noif| noif[0].use_names?(names) }
|
740
|
+
# Recurse on the yes.
|
741
|
+
@yes.delete_related!(*names)
|
742
|
+
# Recurse on the no.
|
743
|
+
@no.delete_related!(*names)
|
744
|
+
# Recruse one the no ifs statements.
|
745
|
+
@noifs.each { |noif| noif[1].delete_related!(*names) }
|
746
|
+
end
|
697
747
|
end
|
698
748
|
|
699
749
|
##
|
@@ -758,6 +808,15 @@ module HDLRuby::Low
|
|
758
808
|
|
759
809
|
return res
|
760
810
|
end
|
811
|
+
|
812
|
+
# Deletes the elements related to one of +names+: either they have
|
813
|
+
# one of the names or they use an element with these names.
|
814
|
+
# NOTE: only delete actual instantiated elements, types or
|
815
|
+
# systemTs are left as is.
|
816
|
+
def delete_related!(*names)
|
817
|
+
# Recurse on the statement.
|
818
|
+
@statement.delete_related!(*names)
|
819
|
+
end
|
761
820
|
end
|
762
821
|
|
763
822
|
|
@@ -833,6 +892,18 @@ module HDLRuby::Low
|
|
833
892
|
|
834
893
|
return res
|
835
894
|
end
|
895
|
+
|
896
|
+
# Deletes the elements related to one of +names+: either they have
|
897
|
+
# one of the names or they use an element with these names.
|
898
|
+
# NOTE: only delete actual instantiated elements, types or
|
899
|
+
# systemTs are left as is.
|
900
|
+
def delete_related!(*names)
|
901
|
+
# Delete the whens whose match contains a signal whoses name is
|
902
|
+
# in names.
|
903
|
+
@whens.delete_if { |w| w.match.use_name?(*names) }
|
904
|
+
# Recurse on the whens.
|
905
|
+
@whens.each { |w| w.delete_related!(*names) }
|
906
|
+
end
|
836
907
|
end
|
837
908
|
|
838
909
|
|
@@ -1091,8 +1162,25 @@ module HDLRuby::Low
|
|
1091
1162
|
end
|
1092
1163
|
end
|
1093
1164
|
end
|
1165
|
+
|
1166
|
+
# Deletes the elements related to one of +names+: either they have
|
1167
|
+
# one of the names or they use an element with these names.
|
1168
|
+
# NOTE: only delete actual instantiated elements, types or
|
1169
|
+
# systemTs are left as is.
|
1170
|
+
def delete_related!(*names)
|
1171
|
+
# Delete the inner signals whose name are in names.
|
1172
|
+
@inners.delete_if { |sig| names.include?(sig.name) }
|
1173
|
+
# Recurse on the statements.
|
1174
|
+
@statements.each do |statement|
|
1175
|
+
statement.delete_related!(*names)
|
1176
|
+
end
|
1177
|
+
# Delete the statements that contain signals whose name are
|
1178
|
+
# in names.
|
1179
|
+
@statements.delete_if { |statement| statement.use_name?(*names) }
|
1180
|
+
end
|
1094
1181
|
end
|
1095
1182
|
|
1183
|
+
|
1096
1184
|
# Describes a timed block.
|
1097
1185
|
#
|
1098
1186
|
# NOTE:
|
data/lib/HDLRuby/std/linear.rb
CHANGED
@@ -214,6 +214,14 @@ module HDLRuby::High::Std
|
|
214
214
|
par(ev) do
|
215
215
|
ack <= 0
|
216
216
|
run <= 0
|
217
|
+
hif(~run) do
|
218
|
+
rvok <= 0
|
219
|
+
lefts.each_with_index do |left,i|
|
220
|
+
lvoks[i] <= 0
|
221
|
+
# accs[i].write(0)
|
222
|
+
avs[i] <= 0
|
223
|
+
end
|
224
|
+
end
|
217
225
|
hif(req | run) do
|
218
226
|
run <= 1
|
219
227
|
# Computation request.
|
@@ -232,14 +240,14 @@ module HDLRuby::High::Std
|
|
232
240
|
end
|
233
241
|
end
|
234
242
|
end
|
235
|
-
helse do
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
end
|
243
|
+
# helse do
|
244
|
+
# rvok <= 0
|
245
|
+
# lefts.each_with_index do |left,i|
|
246
|
+
# lvoks[i] <= 0
|
247
|
+
# # accs[i].write(0)
|
248
|
+
# avs[i] <= 0
|
249
|
+
# end
|
250
|
+
# end
|
243
251
|
end
|
244
252
|
end
|
245
253
|
|
data/lib/HDLRuby/version.rb
CHANGED
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.3.
|
4
|
+
version: 2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|