HDLRuby 2.11.11 → 2.11.12
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/README.md +55 -18
- data/ext/hruby_sim/hruby_rcsim_build.c +27 -0
- data/ext/hruby_sim/hruby_sim.h +3 -0
- data/ext/hruby_sim/hruby_sim_core.c +17 -5
- data/ext/hruby_sim/hruby_sim_stack_calc.c +1 -1
- data/ext/hruby_sim/hruby_sim_tree_calc.c +8 -1
- data/ext/hruby_sim/hruby_sim_vcd.c +24 -7
- data/ext/hruby_sim/hruby_sim_vizualize.c +9 -1
- data/lib/HDLRuby/hdr_samples/constant_in_function.rb +3 -1
- data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +3 -1
- data/lib/HDLRuby/hdr_samples/huge_rom.rb +1 -1
- data/lib/HDLRuby/hdr_samples/mei8.rb +11 -11
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +11 -11
- data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +4 -4
- data/lib/HDLRuby/hdr_samples/rom_nest.rb +1 -1
- data/lib/HDLRuby/hdr_samples/ruby_fir_hw.rb +4 -4
- data/lib/HDLRuby/hdr_samples/struct.rb +44 -10
- data/lib/HDLRuby/hdr_samples/with_bram.rb +45 -0
- data/lib/HDLRuby/hdr_samples/with_casts.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_concat.rb +6 -6
- data/lib/HDLRuby/hdr_samples/with_connector_memory.rb +2 -2
- data/lib/HDLRuby/hdr_samples/with_def.rb +10 -3
- data/lib/HDLRuby/hdr_samples/with_define_operator.rb +44 -0
- data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +12 -12
- data/lib/HDLRuby/hdr_samples/with_init.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_leftright.rb +21 -0
- data/lib/HDLRuby/hdr_samples/with_reduce.rb +13 -13
- data/lib/HDLRuby/hdr_samples/with_ref_array.rb +6 -6
- data/lib/HDLRuby/hdr_samples/with_subsums.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_terminate.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_to_a.rb +10 -10
- data/lib/HDLRuby/hdr_samples/with_values.rb +3 -3
- data/lib/HDLRuby/hdrcc.rb +14 -1
- data/lib/HDLRuby/hruby_bstr.rb +10 -5
- data/lib/HDLRuby/hruby_high.rb +114 -27
- data/lib/HDLRuby/hruby_low.rb +187 -16
- data/lib/HDLRuby/hruby_low2c.rb +71 -11
- data/lib/HDLRuby/hruby_low2vhd.rb +2 -1
- data/lib/HDLRuby/hruby_low_fix_types.rb +1 -0
- data/lib/HDLRuby/hruby_low_mutable.rb +30 -1
- data/lib/HDLRuby/hruby_low_resolve.rb +15 -2
- data/lib/HDLRuby/hruby_low_without_concat.rb +28 -8
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +14 -4
- data/lib/HDLRuby/hruby_low_without_select.rb +2 -2
- data/lib/HDLRuby/hruby_low_without_subsignals.rb +279 -0
- data/lib/HDLRuby/hruby_rcsim.rb +80 -71
- data/lib/HDLRuby/hruby_rsim.rb +132 -7
- data/lib/HDLRuby/hruby_rsim_vcd.rb +99 -27
- data/lib/HDLRuby/hruby_values.rb +35 -31
- data/lib/HDLRuby/std/bram.rb +22 -0
- data/lib/HDLRuby/std/fixpoint.rb +2 -2
- data/lib/HDLRuby/std/fsm.rb +20 -3
- data/lib/HDLRuby/std/function_generator.rb +2 -2
- data/lib/HDLRuby/version.rb +1 -1
- metadata +7 -3
- data/lib/HDLRuby/hdr_samples/sumprod.rb +0 -29
data/lib/HDLRuby/hruby_low2c.rb
CHANGED
@@ -641,12 +641,10 @@ module HDLRuby::Low
|
|
641
641
|
# +level+ is the hierachical level of the object.
|
642
642
|
# def to_c(level = 0)
|
643
643
|
def to_c(res,level = 0)
|
644
|
-
#
|
645
|
-
# "\"#{key.to_s}\",#{type.to_c(level+1)}"
|
646
|
-
# end})"
|
647
|
-
|
648
|
-
"\"#{key.to_s}\",#{type.to_c("",level+1)}"
|
649
|
-
end})"
|
644
|
+
# res << "get_type_struct(#{self.each.map do |key,type|
|
645
|
+
# "\"#{key.to_s}\",#{type.to_c("",level+1)}"
|
646
|
+
# end.join(",")})"
|
647
|
+
self.to_vector.to_c(res,level)
|
650
648
|
return res
|
651
649
|
end
|
652
650
|
end
|
@@ -897,8 +895,17 @@ module HDLRuby::Low
|
|
897
895
|
# +level+ is the hierachical level of the object.
|
898
896
|
# def to_c(level = 0)
|
899
897
|
def to_c(res,level = 0)
|
898
|
+
# First generate the sub signals if any.
|
899
|
+
if self.each_signal.any? then
|
900
|
+
self.each_signal do |signal|
|
901
|
+
signal.to_c(res,level)
|
902
|
+
end
|
903
|
+
# return res
|
904
|
+
end
|
900
905
|
|
901
|
-
#
|
906
|
+
# No sub signals, generate for the current one.
|
907
|
+
|
908
|
+
# puts "Signal.to_c with signal #{self.name} and c_name: #{Low2C.obj_name(self)}"
|
902
909
|
# Declare the global variable holding the signal.
|
903
910
|
res << "SignalI "
|
904
911
|
self.to_c_signal(res,level+1)
|
@@ -943,6 +950,22 @@ module HDLRuby::Low
|
|
943
950
|
res << "signalI->type = "
|
944
951
|
self.type.to_c(res,level+2)
|
945
952
|
res << ";\n"
|
953
|
+
|
954
|
+
# Generate and set the sub signals if any.
|
955
|
+
res << " " * (level+1)*3
|
956
|
+
num_sig = self.each_signal.to_a.size
|
957
|
+
res << "signalI->num_signals = #{num_sig};\n"
|
958
|
+
if num_sig > 0 then
|
959
|
+
res << " " * (level+1)*3
|
960
|
+
res << "signalI->signals = calloc(sizeof(SignalI),#{num_sig});\n"
|
961
|
+
self.each_signal.with_index do |sig,i|
|
962
|
+
res << " " * (level+1)*3
|
963
|
+
res << "#{Low2C.obj_name(sig)} = #{Low2C.make_name(sig)}();\n"
|
964
|
+
res << " " * (level+1)*3
|
965
|
+
res << "signalI->signals[#{i}] = #{Low2C.obj_name(sig)};\n"
|
966
|
+
end
|
967
|
+
end
|
968
|
+
|
946
969
|
# Set the current and the next value.
|
947
970
|
res << " " * (level+1)*3
|
948
971
|
res << "signalI->c_value = make_value(signalI->type,0);\n"
|
@@ -1000,6 +1023,15 @@ module HDLRuby::Low
|
|
1000
1023
|
## Generates the content of the h file.
|
1001
1024
|
# def to_ch
|
1002
1025
|
def to_ch(res)
|
1026
|
+
# First generate the sub signals if any.
|
1027
|
+
if self.each_signal.any? then
|
1028
|
+
self.each_signal do |signal|
|
1029
|
+
signal.to_ch(res)
|
1030
|
+
end
|
1031
|
+
# return res
|
1032
|
+
end
|
1033
|
+
|
1034
|
+
# No sub sub signal, generate for the current signal.
|
1003
1035
|
# res = ""
|
1004
1036
|
# puts "to_ch for SignalI: #{self.to_c_signal()}"
|
1005
1037
|
# Declare the global variable holding the signal.
|
@@ -2205,7 +2237,7 @@ module HDLRuby::Low
|
|
2205
2237
|
res << "value->data_int = #{self.content}LLU;\n"
|
2206
2238
|
else
|
2207
2239
|
res << "value->data_int = "
|
2208
|
-
res << "#{self.content &
|
2240
|
+
res << "#{self.content & 0xFFFF_FFFF_FFFF_FFFF}LLU;\n"
|
2209
2241
|
end
|
2210
2242
|
# Close the value.
|
2211
2243
|
res << " " * (level+1)*3
|
@@ -2697,7 +2729,7 @@ module HDLRuby::Low
|
|
2697
2729
|
end
|
2698
2730
|
# Compute the resulting concatenation.
|
2699
2731
|
res << (" " * ((level+1)*3))
|
2700
|
-
# puts "self.type.direction=#{self.type.direction}\n"
|
2732
|
+
# puts "self.type=#{self.type} self.type.direction=#{self.type.direction}\n"
|
2701
2733
|
res << "sconcat(#{expressions.size},"
|
2702
2734
|
res << (self.type.direction == :little ? "1" : "0")
|
2703
2735
|
res << ");\n"
|
@@ -3054,14 +3086,42 @@ module HDLRuby::Low
|
|
3054
3086
|
res << "->" << (left ? "f_value" : "c_value")
|
3055
3087
|
res << ");\n"
|
3056
3088
|
return res
|
3089
|
+
# sig = self.resolve
|
3090
|
+
# if sig.each_signal.any? then
|
3091
|
+
# # Save the value pool state.
|
3092
|
+
# res << (" " * (level*3)) << "PV;\n"
|
3093
|
+
# # There are sub signals, get and concat their values.
|
3094
|
+
# subs = sig.each_signal.to_a
|
3095
|
+
# subs.each do |sub|
|
3096
|
+
# res << (" " * (level*3))
|
3097
|
+
# res << "push("
|
3098
|
+
# sub.to_c_signal(res,level+1)
|
3099
|
+
# res << "->" << (left ? "f_value" : "c_value")
|
3100
|
+
# res << ");\n"
|
3101
|
+
# end
|
3102
|
+
# # Compute the resulting concatenation.
|
3103
|
+
# res << (" " * ((level+1)*3))
|
3104
|
+
# res << "sconcat(#{subs.size},"
|
3105
|
+
# res << (sig.type.direction == :little ? "1" : "0")
|
3106
|
+
# res << ");\n"
|
3107
|
+
# # Restore the value pool state.
|
3108
|
+
# res << (" " * (level*3)) << "RV;\n"
|
3109
|
+
# else
|
3110
|
+
# # There is no sub signals, get the signal value.
|
3111
|
+
# res << (" " * (level*3))
|
3112
|
+
# res << "push("
|
3113
|
+
# sig.to_c_signal(res,level+1)
|
3114
|
+
# res << "->" << (left ? "f_value" : "c_value")
|
3115
|
+
# res << ");\n"
|
3116
|
+
# end
|
3117
|
+
# return res
|
3057
3118
|
end
|
3058
3119
|
|
3059
3120
|
# Generates the C text for reference as left value to a signal.
|
3060
3121
|
# +level+ is the hierarchical level of the object.
|
3061
3122
|
# def to_c_signal(level = 0)
|
3062
3123
|
def to_c_signal(res,level = 0)
|
3063
|
-
# puts "to_c_signal with self=#{self.name}
|
3064
|
-
# return "#{self.resolve.to_c_signal(level+1)}"
|
3124
|
+
# puts "to_c_signal with self=#{self.name}"
|
3065
3125
|
self.resolve.to_c_signal(res,level+1)
|
3066
3126
|
return res
|
3067
3127
|
end
|
@@ -807,7 +807,8 @@ module HDLRuby::Low
|
|
807
807
|
res << " " * (level*3)
|
808
808
|
res << "begin\n"
|
809
809
|
# Generate the edges if any.
|
810
|
-
if self.each_event.find {|event| event.type != :change} then
|
810
|
+
# if self.each_event.find {|event| event.type != :change} then
|
811
|
+
if self.each_event.find {|event| event.type != :anyedge} then
|
811
812
|
# Generate the edge test.
|
812
813
|
level = level + 1
|
813
814
|
res << " " * (level*3)
|
@@ -600,6 +600,9 @@ module HDLRuby::Low
|
|
600
600
|
right.parent = self unless right.parent
|
601
601
|
end
|
602
602
|
|
603
|
+
alias_method :map_expressions!, :map_nodes!
|
604
|
+
|
605
|
+
|
603
606
|
# Replaces sub expressions using +node2rep+ table indicating the
|
604
607
|
# node to replace and the corresponding replacement.
|
605
608
|
# Returns the actually replaced nodes and their corresponding
|
@@ -908,6 +911,10 @@ module HDLRuby::Low
|
|
908
911
|
# Sets the default.
|
909
912
|
def set_default!(default)
|
910
913
|
# Checks and set the default case if any.
|
914
|
+
if self.default then
|
915
|
+
# There is a default first detach it.
|
916
|
+
@default = nil
|
917
|
+
end
|
911
918
|
self.default = default
|
912
919
|
end
|
913
920
|
|
@@ -1172,7 +1179,11 @@ module HDLRuby::Low
|
|
1172
1179
|
raise AnyError, "Invalid type for a statement: #{stmnt.class}"
|
1173
1180
|
end
|
1174
1181
|
idx = @statements.index(org)
|
1175
|
-
@statements[idx] = stmnt if idx
|
1182
|
+
# @statements[idx] = stmnt if idx
|
1183
|
+
if idx then
|
1184
|
+
@statements[idx] = stmnt
|
1185
|
+
stmnt.parent = self unless stmnt.parent
|
1186
|
+
end
|
1176
1187
|
end
|
1177
1188
|
|
1178
1189
|
# Maps on the statements.
|
@@ -1403,6 +1414,8 @@ module HDLRuby::Low
|
|
1403
1414
|
@child.parent = self unless @child.parent
|
1404
1415
|
end
|
1405
1416
|
|
1417
|
+
alias_method :map_expressions!, :map_nodes!
|
1418
|
+
|
1406
1419
|
# Replaces sub expressions using +node2rep+ table indicating the
|
1407
1420
|
# node to replace and the corresponding replacement.
|
1408
1421
|
# Returns the actually replaced nodes and their corresponding
|
@@ -1507,6 +1520,8 @@ module HDLRuby::Low
|
|
1507
1520
|
@right.parent = self unless @right.parent
|
1508
1521
|
end
|
1509
1522
|
|
1523
|
+
alias_method :map_expressions!, :map_nodes!
|
1524
|
+
|
1510
1525
|
# Replaces sub expressions using +node2rep+ table indicating the
|
1511
1526
|
# node to replace and the corresponding replacement.
|
1512
1527
|
# Returns the actually replaced nodes and their corresponding
|
@@ -1590,6 +1605,8 @@ module HDLRuby::Low
|
|
1590
1605
|
map_choices!(&ruby_block)
|
1591
1606
|
end
|
1592
1607
|
|
1608
|
+
alias_method :map_expressions!, :map_nodes!
|
1609
|
+
|
1593
1610
|
# Replaces sub expressions using +node2rep+ table indicating the
|
1594
1611
|
# node to replace and the corresponding replacement.
|
1595
1612
|
# Returns the actually replaced nodes and their corresponding
|
@@ -1707,6 +1724,8 @@ module HDLRuby::Low
|
|
1707
1724
|
def map_nodes!(&ruby_block)
|
1708
1725
|
# Nothing to do.
|
1709
1726
|
end
|
1727
|
+
|
1728
|
+
alias_method :map_expressions!, :map_nodes!
|
1710
1729
|
end
|
1711
1730
|
|
1712
1731
|
|
@@ -1775,6 +1794,8 @@ module HDLRuby::Low
|
|
1775
1794
|
@ref.parent = self unless @ref.parent
|
1776
1795
|
end
|
1777
1796
|
|
1797
|
+
alias_method :map_expressions!, :map_nodes!
|
1798
|
+
|
1778
1799
|
# Replaces sub expressions using +node2rep+ table indicating the
|
1779
1800
|
# node to replace and the corresponding replacement.
|
1780
1801
|
# Returns the actually replaced nodes and their corresponding
|
@@ -1856,6 +1877,8 @@ module HDLRuby::Low
|
|
1856
1877
|
@ref.parent = self unless @ref.parent
|
1857
1878
|
end
|
1858
1879
|
|
1880
|
+
alias_method :map_expressions!, :map_nodes!
|
1881
|
+
|
1859
1882
|
# Replaces sub expressions using +node2rep+ table indicating the
|
1860
1883
|
# node to replace and the corresponding replacement.
|
1861
1884
|
# Returns the actually replaced nodes and their corresponding
|
@@ -1934,6 +1957,8 @@ module HDLRuby::Low
|
|
1934
1957
|
@ref.parent = self unless @ref.parent
|
1935
1958
|
end
|
1936
1959
|
|
1960
|
+
alias_method :map_expressions!, :map_nodes!
|
1961
|
+
|
1937
1962
|
# Replaces sub expressions using +node2rep+ table indicating the
|
1938
1963
|
# node to replace and the corresponding replacement.
|
1939
1964
|
# Returns the actually replaced nodes and their corresponding
|
@@ -1970,6 +1995,8 @@ module HDLRuby::Low
|
|
1970
1995
|
def map_nodes!(&ruby_block)
|
1971
1996
|
# Nothing to do.
|
1972
1997
|
end
|
1998
|
+
|
1999
|
+
alias_method :map_expressions!, :map_nodes!
|
1973
2000
|
end
|
1974
2001
|
|
1975
2002
|
##
|
@@ -1991,5 +2018,7 @@ module HDLRuby::Low
|
|
1991
2018
|
def map_nodes!(&ruby_block)
|
1992
2019
|
self.map_args!(&ruby_block)
|
1993
2020
|
end
|
2021
|
+
|
2022
|
+
alias_method :map_expressions!, :map_nodes!
|
1994
2023
|
end
|
1995
2024
|
end
|
@@ -109,6 +109,20 @@ module HDLRuby::Low
|
|
109
109
|
end
|
110
110
|
|
111
111
|
|
112
|
+
##
|
113
|
+
# Extends SignalI with the capability of finding one of its inner object
|
114
|
+
# by name.
|
115
|
+
class SignalI
|
116
|
+
|
117
|
+
## Find an inner object by +name+.
|
118
|
+
# NOTE: return nil if not found.
|
119
|
+
def get_by_name(name)
|
120
|
+
return self.get_signal(name)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
|
112
126
|
##
|
113
127
|
# Extends RefIndex with the capability of finding the object it
|
114
128
|
# refered to.
|
@@ -219,10 +233,9 @@ module HDLRuby::Low
|
|
219
233
|
# corresponding object.
|
220
234
|
# NOTE: return nil if could not resolve.
|
221
235
|
def resolve
|
222
|
-
# puts "Resolve with #{self} and name=#{self.name}"
|
236
|
+
# puts "Resolve with #{self} and name=#{self.name} and ref=#{self.ref.class}"
|
223
237
|
# First resolve the sub reference if possible.
|
224
238
|
if self.ref.is_a?(RefName) then
|
225
|
-
# puts "ref name=#{self.ref.name}"
|
226
239
|
obj = self.ref.resolve
|
227
240
|
# puts "obj=#{obj}"
|
228
241
|
# Look into the object for the name.
|
@@ -33,6 +33,7 @@ module HDLRuby::Low
|
|
33
33
|
|
34
34
|
end
|
35
35
|
|
36
|
+
|
36
37
|
## Extends the Scope class with functionality for breaking assingments
|
37
38
|
# to concats.
|
38
39
|
class Scope
|
@@ -42,7 +43,8 @@ module HDLRuby::Low
|
|
42
43
|
self.each_scope(&:break_concat_assigns!)
|
43
44
|
# Recurse on the statements.
|
44
45
|
self.each_behavior do |behavior|
|
45
|
-
behavior.block.each_block_deep(&:break_concat_assigns!)
|
46
|
+
# behavior.block.each_block_deep(&:break_concat_assigns!)
|
47
|
+
behavior.break_concat_assigns!
|
46
48
|
end
|
47
49
|
# Work on the connections.
|
48
50
|
self.each_connection.to_a.each do |connection|
|
@@ -100,6 +102,18 @@ module HDLRuby::Low
|
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
105
|
+
## Extends the Behavior class with functionality for breaking assingments
|
106
|
+
# to concats.
|
107
|
+
class Behavior
|
108
|
+
# Breaks the assignments to concats.
|
109
|
+
def break_concat_assigns!
|
110
|
+
# Recruse on the block.
|
111
|
+
self.block.each_block_deep(&:break_concat_assigns!)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
|
103
117
|
## Extends the Block class with functionality for breaking assingments
|
104
118
|
# to concats.
|
105
119
|
class Block
|
@@ -107,18 +121,23 @@ module HDLRuby::Low
|
|
107
121
|
#
|
108
122
|
# NOTE: work on the direct sub statement only, not deeply.
|
109
123
|
def break_concat_assigns!
|
124
|
+
# puts "breack_concat_assigns! with block=#{self} with #{self.each_statement.count} statements"
|
110
125
|
# Check each transmit.
|
111
|
-
self.each_statement.
|
126
|
+
self.each_statement.to_a.each_with_index do |stmnt|
|
127
|
+
# puts "stmnt=#{stmnt}"
|
112
128
|
if stmnt.is_a?(Transmit) then
|
113
129
|
# Transmit, breaking may be necessary.
|
114
130
|
nstmnt = stmnt.break_concat_assigns
|
115
131
|
if nstmnt.is_a?(Block) then
|
116
132
|
# The transmit has been broken, remove the former
|
117
133
|
# version and add the generated block as a behavior.
|
118
|
-
self.set_statement!(i,nstmnt)
|
134
|
+
# self.set_statement!(i,nstmnt)
|
135
|
+
self.replace_statement!(stmnt,nstmnt)
|
136
|
+
# puts "nstmnt.parent=#{nstmnt.parent}"
|
119
137
|
end
|
120
138
|
end
|
121
139
|
end
|
140
|
+
return self
|
122
141
|
end
|
123
142
|
end
|
124
143
|
|
@@ -144,11 +163,12 @@ module HDLRuby::Low
|
|
144
163
|
top_scope = top_block.top_scope
|
145
164
|
aux = top_scope.add_inner(
|
146
165
|
SignalI.new(HDLRuby.uniq_name,self.right.type) )
|
147
|
-
# puts "new signal: #{aux.name}"
|
148
166
|
aux = RefName.new(aux.type,RefThis.new,aux.name)
|
149
167
|
# Is a default value required to avoid latch generation?
|
150
|
-
unless top_block.
|
151
|
-
|
168
|
+
unless top_block.is_a?(TimeBlock) ||
|
169
|
+
top_block.parent.each_event.
|
170
|
+
# find {|ev| ev.type!=:change} then
|
171
|
+
find {|ev| ev.type!=:anyedge} then
|
152
172
|
# Yes, generate it.
|
153
173
|
top_block.insert_statement!(0,
|
154
174
|
Transmit.new(aux.clone,Value.new(aux.type,0)))
|
@@ -204,8 +224,8 @@ module HDLRuby::Low
|
|
204
224
|
end
|
205
225
|
pos += ref.type.width
|
206
226
|
end
|
207
|
-
# puts "Resulting block=#{block.to_vhdl}"
|
208
227
|
# Return the resulting block
|
228
|
+
# puts "new block=#{block}"
|
209
229
|
return block
|
210
230
|
end
|
211
231
|
end
|
@@ -229,7 +249,7 @@ module HDLRuby::Low
|
|
229
249
|
if node.is_a?(RefConcat) then
|
230
250
|
# Yes, must break. Create the resulting sequential
|
231
251
|
# block that will contain the new assignements.
|
232
|
-
block = Block.new(:
|
252
|
+
block = Block.new(:par)
|
233
253
|
# Create an intermediate signal for storing the
|
234
254
|
# right value. Put it in the top scope.
|
235
255
|
top_scope = self.top_scope
|
@@ -122,6 +122,9 @@ module HDLRuby::Low
|
|
122
122
|
def to_seq!
|
123
123
|
if self.mode == :par then
|
124
124
|
# Need to convert.
|
125
|
+
# Get which module is it.
|
126
|
+
modul = self.is_a?(HDLRuby::High::Block) ? HDLRuby::High :
|
127
|
+
HDLRuby::Low
|
125
128
|
# First recurse on the sub blocks.
|
126
129
|
self.each_statement(&:to_seq!)
|
127
130
|
# Now replace each left value by a new signal for
|
@@ -130,16 +133,23 @@ module HDLRuby::Low
|
|
130
133
|
self.each_statement do |statement|
|
131
134
|
left = statement.left
|
132
135
|
if statement.is_a?(Transmit) then
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
+
if modul == HDLRuby::High then
|
137
|
+
sig = modul::SignalI.new(HDLRuby.uniq_name,left.type,:inner)
|
138
|
+
self.add_inner(sig)
|
139
|
+
puts "sig.parent=#{sig.parent}"
|
140
|
+
diff = modul::RefObject.new(modul::RefThis.new,sig)
|
141
|
+
else
|
142
|
+
sig = modul::SignalI.new(HDLRuby.uniq_name,left.type)
|
143
|
+
self.add_inner(sig)
|
144
|
+
diff = modul::RefName.new(left.type,modul::RefThis.new,sig.name)
|
145
|
+
end
|
136
146
|
differeds << [left,diff]
|
137
147
|
statement.set_left!(diff)
|
138
148
|
end
|
139
149
|
end
|
140
150
|
# Adds the differed assignments.
|
141
151
|
differeds.each do |left,diff|
|
142
|
-
self.add_statement(Transmit.new(left.clone,diff.clone))
|
152
|
+
self.add_statement(modul::Transmit.new(left.clone,diff.clone))
|
143
153
|
end
|
144
154
|
# Change the mode.
|
145
155
|
self.set_mode!(:seq)
|
@@ -82,7 +82,7 @@ module HDLRuby::Low
|
|
82
82
|
selects = connection.extract_selects!
|
83
83
|
if selects.any? then
|
84
84
|
# Selects have been extract, replace the connection
|
85
|
-
#
|
85
|
+
# by a behavior.
|
86
86
|
# Generate the block with cases.
|
87
87
|
blk = LowWithoutSelect.selects2block(selects)
|
88
88
|
# Add a transmit replacing the connection.
|
@@ -214,7 +214,7 @@ module HDLRuby::Low
|
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
|
-
## Extends the
|
217
|
+
## Extends the Case class with functionality for converting select
|
218
218
|
# expressions to case statements.
|
219
219
|
class Case
|
220
220
|
|