HDLRuby 2.6.24 → 2.6.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HDLRuby/hdr_samples/case_bench.rb +30 -0
- data/lib/HDLRuby/hdr_samples/constant_in_function.rb +1 -1
- data/lib/HDLRuby/hdr_samples/if_bench.rb +24 -0
- data/lib/HDLRuby/hdr_samples/index_bench.rb +37 -0
- data/lib/HDLRuby/hdr_samples/range_bench.rb +47 -0
- data/lib/HDLRuby/hdr_samples/with_casts.rb +30 -0
- data/lib/HDLRuby/hdr_samples/with_concat.rb +26 -0
- data/lib/HDLRuby/hdrcc.rb +38 -25
- data/lib/HDLRuby/hruby_high.rb +6 -0
- data/lib/HDLRuby/hruby_low.rb +11 -0
- data/lib/HDLRuby/hruby_low2c.rb +1338 -549
- data/lib/HDLRuby/hruby_low_casts_without_expression.rb +1 -1
- data/lib/HDLRuby/hruby_low_mutable.rb +12 -0
- data/lib/HDLRuby/hruby_low_with_port.rb +21 -6
- data/lib/HDLRuby/hruby_low_without_namespace.rb +4 -2
- data/lib/HDLRuby/hruby_tools.rb +8 -1
- data/lib/HDLRuby/hruby_verilog.rb +218 -149
- data/lib/HDLRuby/sim/hruby_sim.h +109 -0
- data/lib/HDLRuby/sim/hruby_sim_calc.c +38 -9
- data/lib/HDLRuby/sim/hruby_sim_stack_calc.c +203 -0
- data/lib/HDLRuby/sim/hruby_sim_stack_calc.c.sav +100 -0
- data/lib/HDLRuby/sim/hruby_value_pool.c +36 -0
- data/lib/HDLRuby/version.rb +1 -1
- metadata +10 -2
@@ -264,7 +264,7 @@ module HDLRuby::Low
|
|
264
264
|
# choice.casts_without_expression
|
265
265
|
# end )
|
266
266
|
self.set_select!(self.select.casts_without_expression!)
|
267
|
-
|
267
|
+
self.map_choices! { |choice| choice.casts_without_expression! }
|
268
268
|
return self
|
269
269
|
end
|
270
270
|
end
|
@@ -221,6 +221,12 @@ module HDLRuby::Low
|
|
221
221
|
connection
|
222
222
|
end
|
223
223
|
|
224
|
+
# Deletes all the connections.
|
225
|
+
def delete_all_conncetions!
|
226
|
+
@connections.each { |cnx| cnx.parent = nil }
|
227
|
+
@connections = []
|
228
|
+
end
|
229
|
+
|
224
230
|
# Deletes a behavior.
|
225
231
|
def delete_behavior!(behavior)
|
226
232
|
if @behaviors.include?(behavior) then
|
@@ -231,6 +237,12 @@ module HDLRuby::Low
|
|
231
237
|
end
|
232
238
|
end
|
233
239
|
|
240
|
+
# Deletes all the behaviors.
|
241
|
+
def delete_all_behaviors!
|
242
|
+
@behaviors.each { |beh| beh.parent = nil }
|
243
|
+
@behaviors = []
|
244
|
+
end
|
245
|
+
|
234
246
|
# Deletes the elements related to one of +names+: either they have
|
235
247
|
# one of the names or they use an element with these names.
|
236
248
|
# NOTE: only delete actual instantiated elements, types or
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
require "HDLRuby/hruby_error"
|
2
4
|
require "HDLRuby/hruby_low_mutable"
|
3
5
|
require "HDLRuby/hruby_low2sym"
|
@@ -88,14 +90,19 @@ module HDLRuby::Low
|
|
88
90
|
# self.each_scope(&:with_port!)
|
89
91
|
# Gather the references to instance ports.
|
90
92
|
# Also remember if the references were left values or not.
|
93
|
+
# And remember where the node was.
|
91
94
|
refs = []
|
92
95
|
ref_sym2leftvalue = {}
|
96
|
+
# ref_parents = Set.new
|
97
|
+
ref_parents = []
|
93
98
|
self.each_block_deep do |block|
|
94
99
|
block.each_node_deep do |node|
|
95
100
|
if instance_port?(node) then
|
96
101
|
# puts "port for node: #{node.ref.name}.#{node.name}"
|
97
102
|
refs << node
|
98
103
|
ref_sym2leftvalue[node.to_sym] = node.leftvalue?
|
104
|
+
ref_parents << node.parent
|
105
|
+
# ref_parents[node.parent] = node
|
99
106
|
end
|
100
107
|
end
|
101
108
|
end
|
@@ -106,6 +113,8 @@ module HDLRuby::Low
|
|
106
113
|
# puts "leftvalue? #{node.leftvalue?}"
|
107
114
|
refs << node
|
108
115
|
ref_sym2leftvalue[node.to_sym] = node.leftvalue?
|
116
|
+
ref_parents << node.parent
|
117
|
+
# ref_parents[node.parent] = node
|
109
118
|
end
|
110
119
|
end
|
111
120
|
end
|
@@ -117,17 +126,23 @@ module HDLRuby::Low
|
|
117
126
|
# Replace the references by their corresponding port wires.
|
118
127
|
self.each_block_deep do |block|
|
119
128
|
block.each_node_deep do |node|
|
120
|
-
node
|
121
|
-
|
122
|
-
|
129
|
+
if ref_parents.include?(node) then
|
130
|
+
node.map_nodes! do |expr|
|
131
|
+
next expr unless instance_port?(expr)
|
132
|
+
portw = ref_sym2portw[expr.to_sym]
|
133
|
+
portw ? portw2ref(portw) : expr
|
134
|
+
end
|
123
135
|
end
|
124
136
|
end
|
125
137
|
end
|
126
138
|
self.each_connection do |connection|
|
127
139
|
connection.each_node_deep do |node|
|
128
|
-
node
|
129
|
-
|
130
|
-
|
140
|
+
if ref_parents.include?(node) then
|
141
|
+
node.map_nodes! do |expr|
|
142
|
+
next expr unless instance_port?(expr)
|
143
|
+
portw = ref_sym2portw[expr.to_sym]
|
144
|
+
portw ? portw2ref(portw) : expr
|
145
|
+
end
|
131
146
|
end
|
132
147
|
end
|
133
148
|
end
|
@@ -133,7 +133,8 @@ module HDLRuby::Low
|
|
133
133
|
# Get the behaviors.
|
134
134
|
behs = self.each_behavior.to_a
|
135
135
|
# Remove them from the scope.
|
136
|
-
behs.each { |beh| self.delete_behavior!(beh) }
|
136
|
+
# behs.each { |beh| self.delete_behavior!(beh) }
|
137
|
+
self.delete_all_behaviors!
|
137
138
|
# Return the behaviors.
|
138
139
|
return behs
|
139
140
|
end
|
@@ -145,7 +146,8 @@ module HDLRuby::Low
|
|
145
146
|
# Get the connections.
|
146
147
|
cnxs = self.each_connection.to_a
|
147
148
|
# Remove them from the scope.
|
148
|
-
cnxs.each { |
|
149
|
+
# cnxs.each { |cnx| self.delete_connection!(cnx) }
|
150
|
+
cnxs.delete_all_connections!
|
149
151
|
# Return the connections.
|
150
152
|
return cnxs
|
151
153
|
end
|
data/lib/HDLRuby/hruby_tools.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
module HDLRuby
|
2
4
|
|
3
5
|
##
|
@@ -11,16 +13,21 @@ module HDLRuby
|
|
11
13
|
|
12
14
|
@@absoluteCounter = -1 # The absolute name counter.
|
13
15
|
|
16
|
+
@@uniq_names = Set.new(Symbol.all_symbols.map {|sym| sym.to_s})
|
17
|
+
|
14
18
|
# Generates an absolute uniq name.
|
15
19
|
def self.uniq_name(base = "")
|
16
20
|
@@absoluteCounter += 1
|
17
21
|
name = base.to_s + ":#{@@absoluteCounter}"
|
18
|
-
if Symbol.all_symbols.find {|symbol| symbol.to_s == name } then
|
22
|
+
# if Symbol.all_symbols.find {|symbol| symbol.to_s == name } then
|
23
|
+
if @@uniq_names.include?(name) then
|
19
24
|
# The symbol exists, try again.
|
20
25
|
return self.uniq_name
|
21
26
|
else
|
27
|
+
@@uniq_names.add(name)
|
22
28
|
return name.to_sym
|
23
29
|
end
|
30
|
+
# return base.to_s + ":#{@@absoluteCounter}"
|
24
31
|
end
|
25
32
|
|
26
33
|
|