HDLRuby 2.10.5 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HDLRuby.gemspec +1 -0
- data/README.md +8 -4
- data/Rakefile +8 -0
- data/{lib/HDLRuby/sim/Makefile → ext/hruby_sim/Makefile_csim} +0 -0
- data/ext/hruby_sim/extconf.rb +13 -0
- data/ext/hruby_sim/hruby_rcsim_build.c +1188 -0
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim.h +255 -16
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_calc.c +310 -181
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_core.c +34 -17
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_list.c +0 -0
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_stack_calc.c +4 -1
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_stack_calc.c.sav +0 -0
- data/ext/hruby_sim/hruby_sim_tree_calc.c +375 -0
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_vcd.c +5 -5
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_sim_vizualize.c +2 -2
- data/{lib/HDLRuby/sim → ext/hruby_sim}/hruby_value_pool.c +4 -1
- data/lib/HDLRuby/hdr_samples/bstr_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/case_bench.rb +2 -2
- data/lib/HDLRuby/hdr_samples/counter_bench.rb +0 -1
- data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +46 -0
- data/lib/HDLRuby/hdr_samples/dff_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/print_bench.rb +62 -0
- data/lib/HDLRuby/hdr_samples/rom.rb +5 -3
- data/lib/HDLRuby/hdr_samples/simple_counter_bench.rb +43 -0
- data/lib/HDLRuby/hdrcc.rb +54 -8
- data/lib/HDLRuby/hruby_bstr.rb +1175 -917
- data/lib/HDLRuby/hruby_high.rb +200 -90
- data/lib/HDLRuby/hruby_high_fullname.rb +82 -0
- data/lib/HDLRuby/hruby_low.rb +41 -23
- data/lib/HDLRuby/hruby_low2c.rb +7 -0
- data/lib/HDLRuby/hruby_rcsim.rb +978 -0
- data/lib/HDLRuby/hruby_rsim.rb +1134 -0
- data/lib/HDLRuby/hruby_rsim_vcd.rb +322 -0
- data/lib/HDLRuby/hruby_values.rb +362 -18
- data/lib/HDLRuby/hruby_verilog.rb +21 -3
- data/lib/HDLRuby/version.rb +1 -1
- metadata +24 -13
data/lib/HDLRuby/hruby_values.rb
CHANGED
@@ -1,52 +1,339 @@
|
|
1
1
|
module HDLRuby
|
2
2
|
|
3
|
-
##
|
4
|
-
# Library for implementing the value processing.
|
5
|
-
#
|
6
|
-
########################################################################
|
3
|
+
##
|
4
|
+
# Library for implementing the value processing.
|
5
|
+
#
|
6
|
+
########################################################################
|
7
7
|
|
8
8
|
# To include to classes for value processing support.
|
9
9
|
module Vprocess
|
10
10
|
|
11
|
+
# TRUNC_P_T = 65536.times.map { |i| 2**i - 1 }
|
12
|
+
# TRUNC_N_T = 65536.times.map { |i| (-1 * 2**i) }
|
13
|
+
|
14
|
+
# Truncs integer +val+ to +width+
|
15
|
+
def trunc(val,width)
|
16
|
+
if val.bit_length > width then
|
17
|
+
if val >= 0 then
|
18
|
+
# return val & (2**width-1)
|
19
|
+
return val % (2**width)
|
20
|
+
# return val & TRUNC_P_T[width]
|
21
|
+
else
|
22
|
+
# return val | (-1 * 2**width)
|
23
|
+
return val % -(2**width)
|
24
|
+
# return val | TRUNC_N_T[width]
|
25
|
+
end
|
26
|
+
else
|
27
|
+
return val
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
11
31
|
# Redefinition of the arithmetic and logic operations binary operators
|
12
|
-
[ :+, :-, :*, :/, :%, :&, :|, :**,
|
32
|
+
[ :+, :-, :*, :/, :%, :&, :|, :^, :**,
|
13
33
|
:<<, :>>,
|
14
|
-
:==, :<, :>, :<=, :>=, :<=> ].
|
15
|
-
|
16
|
-
define_method(op) do |
|
17
|
-
# puts "value=#{value}"
|
18
|
-
# Ensures
|
19
|
-
unless
|
34
|
+
:==, :!=, :<, :>, :<=, :>=, :<=> ].
|
35
|
+
each do |op|
|
36
|
+
define_method(op) do |val|
|
37
|
+
# puts "op=#{op} value=#{value}"
|
38
|
+
# Ensures val is computable.
|
39
|
+
unless val.to_value? then
|
40
|
+
# Not computable, use the former method that generates
|
41
|
+
# HDLRuby code.
|
42
|
+
return self.send(orig_operator(op),value)
|
43
|
+
end
|
44
|
+
# Handle Numeric op BitString case.
|
45
|
+
if self.content.is_a?(Numeric) && val.content.is_a?(BitString)
|
46
|
+
if val.content.specified? then
|
47
|
+
res_content = self.content.send(op,val.content.to_i)
|
48
|
+
else
|
49
|
+
res_content =
|
50
|
+
BitString.new(self.content).send(op,val.content)
|
51
|
+
end
|
52
|
+
else
|
53
|
+
# Generate the resulting content.
|
54
|
+
res_content = self.content.send(op,val.content)
|
55
|
+
# puts "op=#{op} self.content=#{self.content} (#{self.content.class}) val.content=#{val.content} (#{val.content.class}) res_content=#{res_content} (#{res_content.class})"
|
56
|
+
end
|
57
|
+
res_type = self.type.resolve(val.type)
|
58
|
+
# # Adjust the result content size.
|
59
|
+
# res_width = res_type.width
|
60
|
+
# if res_content.is_a?(BitString) then
|
61
|
+
# res_content.trunc!(res_width)
|
62
|
+
# else
|
63
|
+
# res_content = self.trunc(res_content,res_width)
|
64
|
+
# end
|
65
|
+
# Return the resulting value.
|
66
|
+
return self.class.new(res_type,res_content)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Redefinition of the access operators.
|
71
|
+
define_method(:[]) do |val|
|
72
|
+
if val.is_a?(Range) then
|
73
|
+
# Range case.
|
74
|
+
# Ensures value is really a range of values.
|
75
|
+
left = val.first
|
76
|
+
right = val.last
|
77
|
+
unless left.to_value? && right.to_value? then
|
20
78
|
# Not a value, use the former method.
|
21
79
|
# Assumed
|
22
|
-
return self.send(orig_operator(op),
|
80
|
+
return self.send(orig_operator(op),val)
|
81
|
+
end
|
82
|
+
# Process left.
|
83
|
+
# unless left.is_a?(Numeric) || left.is_a?(BitString) then
|
84
|
+
# left = left.to_value.content
|
85
|
+
# end
|
86
|
+
left = left.content
|
87
|
+
if left.is_a?(BitString) && !left.specified? then
|
88
|
+
return self.class.new(self.type.base,
|
89
|
+
BitString::UNKNOWN.clone)
|
23
90
|
end
|
24
|
-
|
91
|
+
# left = left.to_i
|
92
|
+
left = self.trunc(left.to_i,val.first.type.width)
|
93
|
+
# Process right.
|
94
|
+
# unless right.is_a?(Numeric) || right.is_a?(BitString) then
|
95
|
+
# right = right.to_value.content
|
96
|
+
# end
|
97
|
+
right = right.content
|
98
|
+
if right.is_a?(BitString) && !right.specified? then
|
99
|
+
return self.class.new(self.type.base,
|
100
|
+
BitString::UNKNOWN.clone)
|
101
|
+
end
|
102
|
+
# right = right.to_i
|
103
|
+
right = self.trunc(right.to_i,val.last.type.width)
|
25
104
|
# Generate the resulting type.
|
26
|
-
res_type = self.type.
|
27
|
-
# Generate the resulting
|
28
|
-
|
29
|
-
# puts "
|
105
|
+
res_type = self.type.base[(left-right+1).abs]
|
106
|
+
# Generate the resulting value.
|
107
|
+
width = res_type.base.width
|
108
|
+
# puts "width=#{width}, left=#{left} right=#{right}"
|
109
|
+
if self.content.is_a?(BitString) then
|
110
|
+
res_content = self.content[right*width..(left+1)*width-1]
|
111
|
+
else
|
112
|
+
sh = right*width
|
113
|
+
mask = (-1 << sh) & ~(-1 << (left+1)*width)
|
114
|
+
res_content = (self.content & mask) >> sh
|
115
|
+
end
|
116
|
+
# Return the resulting value.
|
117
|
+
return self.class.new(res_type,res_content)
|
118
|
+
else
|
119
|
+
# Index case.
|
120
|
+
# Ensures val is really a value.
|
121
|
+
unless val.to_value? then
|
122
|
+
# Not a value, use the former method.
|
123
|
+
# Assumed
|
124
|
+
return self.send(orig_operator(op),val)
|
125
|
+
end
|
126
|
+
# Process val.
|
127
|
+
index = val.content
|
128
|
+
if index.is_a?(BitString) && !index.specified? then
|
129
|
+
return self.class.new(self.type.base,
|
130
|
+
BitString::UNKNOWN.clone)
|
131
|
+
end
|
132
|
+
index = self.trunc(index.to_i,val.type.width)
|
133
|
+
# index = index.to_i
|
134
|
+
# if index >= self.type.size then
|
135
|
+
# # puts "index=#{index}"
|
136
|
+
# index %= self.type.size
|
137
|
+
# # puts "now index=#{index}"
|
138
|
+
# end
|
139
|
+
# Generate the resulting type.
|
140
|
+
res_type = self.type.base
|
141
|
+
# Generate the resulting value.
|
142
|
+
width = res_type.width
|
143
|
+
# puts "type width=#{self.type.width}, element width=#{width}, index=#{index}"
|
144
|
+
if self.content.is_a?(BitString) then
|
145
|
+
res_content = self.content[index*width..(index+1)*width-1]
|
146
|
+
else
|
147
|
+
sh = index*width
|
148
|
+
mask = (-1 << sh) & ~(-1 << (index+1)*width)
|
149
|
+
res_content = (self.content & mask) >> sh
|
150
|
+
end
|
30
151
|
# Return the resulting value.
|
31
152
|
return self.class.new(res_type,res_content)
|
32
153
|
end
|
33
154
|
end
|
34
155
|
|
156
|
+
define_method(:[]=) do |index,val|
|
157
|
+
if index.is_a?(Range) then
|
158
|
+
# Range case.
|
159
|
+
# Ensures indexes and val are really values.
|
160
|
+
left = index.first
|
161
|
+
right = index.last
|
162
|
+
unless val.to_value? &&
|
163
|
+
left.to_value? && right.to_value? then
|
164
|
+
# Not a value, use the former method.
|
165
|
+
# Assumed
|
166
|
+
return self.send(orig_operator(op),index,value)
|
167
|
+
end
|
168
|
+
# Process val.
|
169
|
+
val = val.content if val.is_a?(Value)
|
170
|
+
# Process left.
|
171
|
+
left = left.content if left.is_a?(Value)
|
172
|
+
if left.is_a?(BitString) && !left.specified? then
|
173
|
+
return self.class.new(self.type.base,
|
174
|
+
BitString::UNKNOWN.clone)
|
175
|
+
end
|
176
|
+
left = left.to_i
|
177
|
+
# Process right.
|
178
|
+
right = right.content if right.is_a?(Value)
|
179
|
+
if right.is_a?(BitString) && !right.specified? then
|
180
|
+
return self.class.new(self.type.base,
|
181
|
+
BitString::UNKNOWN.clone)
|
182
|
+
end
|
183
|
+
right = right.to_i
|
184
|
+
# Compute the width of one element.
|
185
|
+
width = self.type.base.width
|
186
|
+
# Write the value at the right position.
|
187
|
+
# puts "width=#{width}, left=#{left}, right=#{right}"
|
188
|
+
if @content.is_a?(BitString) then
|
189
|
+
@content[right*width..(left+1)*width-1] = val
|
190
|
+
else
|
191
|
+
sh = right*width
|
192
|
+
val = self.trunc(val,((left-right).abs+1)*width) << sh
|
193
|
+
mask = ~(-1 << sh) | (-1 << (left+1)*width)
|
194
|
+
@content =((@content & mask) | val)
|
195
|
+
end
|
196
|
+
else
|
197
|
+
# Index case.
|
198
|
+
# Ensures index and val are really values.
|
199
|
+
unless val.to_value? && index.to_value? then
|
200
|
+
# Not a value, use the former method.
|
201
|
+
# Assumed
|
202
|
+
return self.send(orig_operator(op),index,value)
|
203
|
+
end
|
204
|
+
# Process val.
|
205
|
+
val = val.content if val.is_a?(Value)
|
206
|
+
# puts "val=#{val} (#{val.class})"
|
207
|
+
# Process index.
|
208
|
+
index = index.content if index.is_a?(Value)
|
209
|
+
# puts "index=#{index} (#{index.class})"
|
210
|
+
if index.is_a?(BitString) && !index.specified? then
|
211
|
+
return self.class.new(self.type.base,
|
212
|
+
BitString::UNKNOWN.clone)
|
213
|
+
end
|
214
|
+
index = index.to_i
|
215
|
+
# Compute the width of one element.
|
216
|
+
width = self.type.base.width
|
217
|
+
# Write the value at the right position.
|
218
|
+
# puts "width=#{width}, index=#{index}, val=#{val}"
|
219
|
+
# puts "first @content=#{@content}, index*width=#{index*width} next=#{(index+1)*width-1}"
|
220
|
+
if @content.is_a?(BitString) then
|
221
|
+
@content[index*width..(index+1)*width-1] = val
|
222
|
+
else
|
223
|
+
sh = index*width
|
224
|
+
val = self.trunc(val,width) << sh
|
225
|
+
mask = ~(-1 << sh) | (-1 << (index+1)*width)
|
226
|
+
@content = ((@content & mask) | val)
|
227
|
+
end
|
228
|
+
# puts "now @content=#{@content}"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
35
232
|
# Redefinition of the arithmetic and logic operations unary operators
|
36
233
|
[ :-@, :+@, :~, :abs ].each do |op|
|
37
234
|
# Actual redefinition.
|
38
235
|
define_method(op) do
|
39
236
|
# Generate the resulting type.
|
40
|
-
res_type = self.type
|
237
|
+
res_type = self.type
|
41
238
|
# Generate the resulting content.
|
239
|
+
# puts "op=#{op} content=#{content.to_s}"
|
42
240
|
res_content = self.content.send(op)
|
241
|
+
# puts "res_content=#{res_content}"
|
43
242
|
# Return the resulting value.
|
44
243
|
return self.class.new(res_type,res_content)
|
45
244
|
end
|
46
245
|
end
|
47
246
|
|
247
|
+
# Cast to +type+.
|
248
|
+
# NOTE: nodir tells if the direction is to be ignored.
|
249
|
+
def cast(type,nodir = false)
|
250
|
+
# Handle the direction.
|
251
|
+
if !nodir && type.direction != self.type.direction then
|
252
|
+
if self.content.is_a?(Numeric) then
|
253
|
+
tmp = 0
|
254
|
+
res_content = self.content
|
255
|
+
self.type.width.times do |i|
|
256
|
+
tmp = tmp*2 | (res_content & 1)
|
257
|
+
res_content /= 2
|
258
|
+
end
|
259
|
+
res_content = tmp
|
260
|
+
elsif self.content.is_a?(BitString) then
|
261
|
+
res_content = self.content.clone.reverse!(self.type.width)
|
262
|
+
else
|
263
|
+
res_content = self.content.reverse
|
264
|
+
end
|
265
|
+
else
|
266
|
+
res_content = self.content.clone
|
267
|
+
end
|
268
|
+
# Handle the sign.
|
269
|
+
if type.unsigned? && !self.content.positive? then
|
270
|
+
# Ensure the content is a positive value to match unsigned type.
|
271
|
+
if res_content.is_a?(Numeric) then
|
272
|
+
res_content &= ~(-1 << type.width) if res_content < 0
|
273
|
+
# res_content &= ~(-1 * 2**type.width) if res_content < 0
|
274
|
+
else
|
275
|
+
res_content.positive!
|
276
|
+
end
|
277
|
+
end
|
278
|
+
# # truncs to the right size if necessary.
|
279
|
+
# if res_content.is_a?(BitString) then
|
280
|
+
# res_content.trunc!(type.width)
|
281
|
+
# else
|
282
|
+
# res_content = self.trunc(res_content,type.width)
|
283
|
+
# end
|
284
|
+
# Generate the resulting value.
|
285
|
+
return self.class.new(type,res_content)
|
286
|
+
end
|
287
|
+
|
288
|
+
# Concat the content of +vals+.
|
289
|
+
def self.concat(*vals)
|
290
|
+
# Compute the resulting type.
|
291
|
+
types = vals.map {|v| v.type }
|
292
|
+
if types.uniq.count <= 1 then
|
293
|
+
res_type = types[0][types.size]
|
294
|
+
else
|
295
|
+
res_type = vals.map {|v| v.type }.to_type
|
296
|
+
end
|
297
|
+
# Concat the contents.
|
298
|
+
res_content = []
|
299
|
+
content = width = 0
|
300
|
+
vals.each_with_index do |val,i|
|
301
|
+
content = val.content
|
302
|
+
width = types[i].width
|
303
|
+
if content.is_a?(BitString) then
|
304
|
+
count = 0
|
305
|
+
content.raw_content.each do |b|
|
306
|
+
res_content << b
|
307
|
+
count += 1
|
308
|
+
break if count == width
|
309
|
+
end
|
310
|
+
if count < width then
|
311
|
+
res_content.concat(res_content[-1] * (width-count))
|
312
|
+
end
|
313
|
+
else
|
314
|
+
width.times do |p|
|
315
|
+
res_content << content[p]
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
# Make a bit string from res_content.
|
320
|
+
res_content = BitString.new(res_content,:raw)
|
321
|
+
# Return the resulting value.
|
322
|
+
return vals[0].class.new(res_type,res_content)
|
323
|
+
end
|
324
|
+
|
325
|
+
|
48
326
|
# Conversion to an integer if possible.
|
49
327
|
def to_i
|
328
|
+
# if self.content.is_a?(BitString) then
|
329
|
+
# if self.type.signed? then
|
330
|
+
# return self.content.to_numeric_signed
|
331
|
+
# else
|
332
|
+
# return self.content.to_numeric
|
333
|
+
# end
|
334
|
+
# else
|
335
|
+
# return self.content.to_i
|
336
|
+
# end
|
50
337
|
return self.content.to_i
|
51
338
|
end
|
52
339
|
|
@@ -55,10 +342,67 @@ module HDLRuby
|
|
55
342
|
return self.content.to_f
|
56
343
|
end
|
57
344
|
|
345
|
+
# # Conversion to a BitString of the right size.
|
346
|
+
# def to_bstr
|
347
|
+
# # Ensure the content is a bit string.
|
348
|
+
# bstr = self.content
|
349
|
+
# if bstr.is_a?(Numeric) then
|
350
|
+
# # Handle negative values.
|
351
|
+
# bstr = 2**self.type.width + bstr if bstr < 0
|
352
|
+
# end
|
353
|
+
# bstr = BitString.new(bstr) unless bstr.is_a?(BitString)
|
354
|
+
# # Resize it if necessary.
|
355
|
+
# cwidth = self.content.width
|
356
|
+
# twidth = self.type.width
|
357
|
+
# if cwidth < twidth then
|
358
|
+
# # Its lenght must be extended.
|
359
|
+
# if self.type.signed? then
|
360
|
+
# return bstr.sext(twidth)
|
361
|
+
# else
|
362
|
+
# return bstr.zext(twidth)
|
363
|
+
# end
|
364
|
+
# elsif cwidth > twidth then
|
365
|
+
# # Its lenght must be reduced.
|
366
|
+
# return bstr.trunc(twidth)
|
367
|
+
# else
|
368
|
+
# return bstr.clone
|
369
|
+
# end
|
370
|
+
# end
|
371
|
+
|
58
372
|
# Coercion when operation from Ruby values.
|
59
373
|
def coerce(other)
|
60
374
|
return other,self.content
|
61
375
|
end
|
376
|
+
|
377
|
+
# Tell if the value is zero.
|
378
|
+
def zero?
|
379
|
+
return false unless @content
|
380
|
+
if content.is_a?(Numeric) then
|
381
|
+
return @content & (2**self.type.width-1) == 0
|
382
|
+
else
|
383
|
+
return !@content.raw_content[0..self.type.width-1].any?{|b| b!=0}
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
## Converts the value to a string of the right size.
|
388
|
+
def to_vstr
|
389
|
+
if self.content.is_a?(Numeric) then
|
390
|
+
if self.content >= 0 then
|
391
|
+
str = "0" + self.content.to_s(2)
|
392
|
+
else
|
393
|
+
str = (2**((-self.content).width+1) + self.content).to_s(2)
|
394
|
+
end
|
395
|
+
else
|
396
|
+
str = self.content.to_s
|
397
|
+
end
|
398
|
+
width = self.type.width
|
399
|
+
if str.size >= width then
|
400
|
+
return str[-width..-1]
|
401
|
+
else
|
402
|
+
return str[0] * (width-str.size) + str
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
62
406
|
end
|
63
407
|
|
64
408
|
end
|
@@ -194,7 +194,8 @@ module HDLRuby::Low
|
|
194
194
|
|
195
195
|
# Converts the system to Verilog code adding 'spc' spaces at the begining
|
196
196
|
# of each line.
|
197
|
-
|
197
|
+
# NOTE: if +vcdmodule+ is not nil add code for generating vcd file when simulating
|
198
|
+
def to_verilog(spc = 3, vcdmodule = nil)
|
198
199
|
code = "begin"
|
199
200
|
if self.name && !self.name.empty? then
|
200
201
|
vname = name_to_verilog(self.name)
|
@@ -229,6 +230,12 @@ module HDLRuby::Low
|
|
229
230
|
code << ";\n"
|
230
231
|
end
|
231
232
|
|
233
|
+
# Make the generation of vcd file if required.
|
234
|
+
if vcdmodule then
|
235
|
+
code << "\n#{" " * (spc+3)}$dumpfile(\"verilog_simulator.vcd\");"
|
236
|
+
code << "\n#{" " * (spc+3)}$dumpvars(0,#{vcdmodule});\n"
|
237
|
+
end
|
238
|
+
|
232
239
|
# Translate the block that finished scheduling.
|
233
240
|
block.each_statement do |statement|
|
234
241
|
# puts "#{statement.to_verilog(spc+3)}"
|
@@ -1864,7 +1871,9 @@ module HDLRuby::Low
|
|
1864
1871
|
|
1865
1872
|
|
1866
1873
|
# Converts the system to Verilog code.
|
1867
|
-
|
1874
|
+
# NOTE: if +vcd+ is true, generate verilog code whose simulation
|
1875
|
+
# produces a vcd file.
|
1876
|
+
def to_verilog(vcd = false)
|
1868
1877
|
# Detect the registers
|
1869
1878
|
HDLRuby::Low::VERILOG_REGS.clear
|
1870
1879
|
# The left values.
|
@@ -2122,8 +2131,12 @@ module HDLRuby::Low
|
|
2122
2131
|
end
|
2123
2132
|
|
2124
2133
|
# Translation of behavior part (always).
|
2134
|
+
$timebeh_shown = false
|
2125
2135
|
self.each_behavior do |behavior|
|
2136
|
+
timebeh = false
|
2126
2137
|
if behavior.block.is_a?(TimeBlock) then
|
2138
|
+
# Tell it is a time behavior for further processing.
|
2139
|
+
timebeh = true
|
2127
2140
|
# Extract and translate the TimeRepeat separately.
|
2128
2141
|
behavior.each_block_deep do |blk|
|
2129
2142
|
codeC << blk.repeat_to_verilog!
|
@@ -2157,7 +2170,12 @@ module HDLRuby::Low
|
|
2157
2170
|
codeC << " ) "
|
2158
2171
|
end
|
2159
2172
|
|
2160
|
-
|
2173
|
+
if vcd && timebeh && !$timebeh_shown then
|
2174
|
+
codeC << behavior.block.to_verilog(3,name_to_verilog(self.name))
|
2175
|
+
$timebeh_shown = true
|
2176
|
+
else
|
2177
|
+
codeC << behavior.block.to_verilog
|
2178
|
+
end
|
2161
2179
|
|
2162
2180
|
end
|
2163
2181
|
|
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.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,7 +46,8 @@ email:
|
|
46
46
|
- lovic@ariake-nct.ac.jp
|
47
47
|
executables:
|
48
48
|
- hdrcc
|
49
|
-
extensions:
|
49
|
+
extensions:
|
50
|
+
- ext/hruby_sim/extconf.rb
|
50
51
|
extra_rdoc_files:
|
51
52
|
- README.md
|
52
53
|
files:
|
@@ -62,6 +63,19 @@ files:
|
|
62
63
|
- bin/console
|
63
64
|
- bin/setup
|
64
65
|
- exe/hdrcc
|
66
|
+
- ext/hruby_sim/Makefile_csim
|
67
|
+
- ext/hruby_sim/extconf.rb
|
68
|
+
- ext/hruby_sim/hruby_rcsim_build.c
|
69
|
+
- ext/hruby_sim/hruby_sim.h
|
70
|
+
- ext/hruby_sim/hruby_sim_calc.c
|
71
|
+
- ext/hruby_sim/hruby_sim_core.c
|
72
|
+
- ext/hruby_sim/hruby_sim_list.c
|
73
|
+
- ext/hruby_sim/hruby_sim_stack_calc.c
|
74
|
+
- ext/hruby_sim/hruby_sim_stack_calc.c.sav
|
75
|
+
- ext/hruby_sim/hruby_sim_tree_calc.c
|
76
|
+
- ext/hruby_sim/hruby_sim_vcd.c
|
77
|
+
- ext/hruby_sim/hruby_sim_vizualize.c
|
78
|
+
- ext/hruby_sim/hruby_value_pool.c
|
65
79
|
- lib/HDLRuby.rb
|
66
80
|
- lib/HDLRuby/alcc.rb
|
67
81
|
- lib/HDLRuby/backend/hruby_allocator.rb
|
@@ -88,6 +102,7 @@ files:
|
|
88
102
|
- lib/HDLRuby/hdr_samples/comparison_bench.rb
|
89
103
|
- lib/HDLRuby/hdr_samples/constant_in_function.rb
|
90
104
|
- lib/HDLRuby/hdr_samples/counter_bench.rb
|
105
|
+
- lib/HDLRuby/hdr_samples/counter_dff_bench.rb
|
91
106
|
- lib/HDLRuby/hdr_samples/dff.rb
|
92
107
|
- lib/HDLRuby/hdr_samples/dff_bench.rb
|
93
108
|
- lib/HDLRuby/hdr_samples/dff_counter.rb
|
@@ -128,6 +143,7 @@ files:
|
|
128
143
|
- lib/HDLRuby/hdr_samples/neural/sigmoid.rb
|
129
144
|
- lib/HDLRuby/hdr_samples/neural/z.rb
|
130
145
|
- lib/HDLRuby/hdr_samples/parseq_bench.rb
|
146
|
+
- lib/HDLRuby/hdr_samples/print_bench.rb
|
131
147
|
- lib/HDLRuby/hdr_samples/prog.obj
|
132
148
|
- lib/HDLRuby/hdr_samples/ram.rb
|
133
149
|
- lib/HDLRuby/hdr_samples/range_bench.rb
|
@@ -136,6 +152,7 @@ files:
|
|
136
152
|
- lib/HDLRuby/hdr_samples/rom_nest.rb
|
137
153
|
- lib/HDLRuby/hdr_samples/ruby_fir_hw.rb
|
138
154
|
- lib/HDLRuby/hdr_samples/seqpar_bench.rb
|
155
|
+
- lib/HDLRuby/hdr_samples/simple_counter_bench.rb
|
139
156
|
- lib/HDLRuby/hdr_samples/struct.rb
|
140
157
|
- lib/HDLRuby/hdr_samples/sumprod.rb
|
141
158
|
- lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb
|
@@ -241,6 +258,7 @@ files:
|
|
241
258
|
- lib/HDLRuby/hruby_decorator.rb
|
242
259
|
- lib/HDLRuby/hruby_error.rb
|
243
260
|
- lib/HDLRuby/hruby_high.rb
|
261
|
+
- lib/HDLRuby/hruby_high_fullname.rb
|
244
262
|
- lib/HDLRuby/hruby_low.rb
|
245
263
|
- lib/HDLRuby/hruby_low2c.rb
|
246
264
|
- lib/HDLRuby/hruby_low2hdr.rb
|
@@ -265,6 +283,9 @@ files:
|
|
265
283
|
- lib/HDLRuby/hruby_low_without_outread.rb
|
266
284
|
- lib/HDLRuby/hruby_low_without_parinseq.rb
|
267
285
|
- lib/HDLRuby/hruby_low_without_select.rb
|
286
|
+
- lib/HDLRuby/hruby_rcsim.rb
|
287
|
+
- lib/HDLRuby/hruby_rsim.rb
|
288
|
+
- lib/HDLRuby/hruby_rsim_vcd.rb
|
268
289
|
- lib/HDLRuby/hruby_serializer.rb
|
269
290
|
- lib/HDLRuby/hruby_tools.rb
|
270
291
|
- lib/HDLRuby/hruby_types.rb
|
@@ -313,16 +334,6 @@ files:
|
|
313
334
|
- lib/HDLRuby/low_samples/with_seq.yaml
|
314
335
|
- lib/HDLRuby/low_samples/yaml2hdr.rb
|
315
336
|
- lib/HDLRuby/low_samples/yaml2vhd.rb
|
316
|
-
- lib/HDLRuby/sim/Makefile
|
317
|
-
- lib/HDLRuby/sim/hruby_sim.h
|
318
|
-
- lib/HDLRuby/sim/hruby_sim_calc.c
|
319
|
-
- lib/HDLRuby/sim/hruby_sim_core.c
|
320
|
-
- lib/HDLRuby/sim/hruby_sim_list.c
|
321
|
-
- lib/HDLRuby/sim/hruby_sim_stack_calc.c
|
322
|
-
- lib/HDLRuby/sim/hruby_sim_stack_calc.c.sav
|
323
|
-
- lib/HDLRuby/sim/hruby_sim_vcd.c
|
324
|
-
- lib/HDLRuby/sim/hruby_sim_vizualize.c
|
325
|
-
- lib/HDLRuby/sim/hruby_value_pool.c
|
326
337
|
- lib/HDLRuby/std/channel.rb
|
327
338
|
- lib/HDLRuby/std/clocks.rb
|
328
339
|
- lib/HDLRuby/std/connector.rb
|