HDLRuby 2.11.12 → 3.1.0
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.html +3274 -0
- data/README.md +660 -128
- data/ext/hruby_sim/hruby_sim_calc.c +2 -0
- data/lib/HDLRuby/backend/hruby_allocator.rb +2 -2
- data/lib/HDLRuby/backend/hruby_c_allocator.rb +7 -7
- data/lib/HDLRuby/hdr_samples/constant_in_function.rb +2 -1
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/with_bram.rb +3 -3
- data/lib/HDLRuby/hdr_samples/with_bram_frame_stack.rb +105 -0
- data/lib/HDLRuby/hdr_samples/with_bram_stack.rb +69 -0
- data/lib/HDLRuby/hdr_samples/with_ref_expr.rb +30 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer.rb +185 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_deep.rb +91 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +439 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +89 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_func.rb +63 -0
- data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +120 -0
- data/lib/HDLRuby/hdrcc.rb +16 -3
- data/lib/HDLRuby/hdrlib.rb +1 -1
- data/lib/HDLRuby/hruby_db.rb +2 -2
- data/lib/HDLRuby/hruby_high.rb +61 -25
- data/lib/HDLRuby/hruby_high_fullname.rb +3 -1
- data/lib/HDLRuby/hruby_low.rb +2 -2
- data/lib/HDLRuby/hruby_low2c.rb +58 -43
- data/lib/HDLRuby/hruby_low2hdr.rb +66 -40
- data/lib/HDLRuby/hruby_low2high.rb +86 -44
- data/lib/HDLRuby/hruby_low2seq.rb +26 -18
- data/lib/HDLRuby/hruby_low2sym.rb +14 -13
- data/lib/HDLRuby/hruby_low2vhd.rb +78 -43
- data/lib/HDLRuby/hruby_low_bool2select.rb +61 -46
- data/lib/HDLRuby/hruby_low_casts_without_expression.rb +56 -44
- data/lib/HDLRuby/hruby_low_cleanup.rb +18 -16
- data/lib/HDLRuby/hruby_low_fix_types.rb +64 -32
- data/lib/HDLRuby/hruby_low_mutable.rb +53 -118
- data/lib/HDLRuby/hruby_low_resolve.rb +26 -31
- data/lib/HDLRuby/hruby_low_with_bool.rb +33 -16
- data/lib/HDLRuby/hruby_low_with_port.rb +3 -3
- data/lib/HDLRuby/hruby_low_with_var.rb +23 -9
- data/lib/HDLRuby/hruby_low_without_concat.rb +19 -13
- data/lib/HDLRuby/hruby_low_without_namespace.rb +47 -32
- data/lib/HDLRuby/hruby_low_without_parinseq.rb +18 -12
- data/lib/HDLRuby/hruby_low_without_select.rb +36 -23
- data/lib/HDLRuby/hruby_low_without_subsignals.rb +79 -39
- data/lib/HDLRuby/hruby_rcsim.rb +79 -64
- data/lib/HDLRuby/hruby_rsim.rb +64 -15
- data/lib/HDLRuby/hruby_rsim_mute.rb +2 -3
- data/lib/HDLRuby/hruby_rsim_vcd.rb +28 -25
- data/lib/HDLRuby/hruby_types.rb +5 -5
- data/lib/HDLRuby/hruby_values.rb +19 -8
- data/lib/HDLRuby/hruby_verilog.rb +191 -65
- data/lib/HDLRuby/hruby_verilog_name.rb +49 -42
- data/lib/HDLRuby/soft/stacks.rb +219 -0
- data/lib/HDLRuby/std/bram.rb +9 -5
- data/lib/HDLRuby/std/clocks.rb +1 -1
- data/lib/HDLRuby/std/fsm.rb +39 -10
- data/lib/HDLRuby/std/sequencer.rb +2085 -0
- data/lib/HDLRuby/std/sequencer_func.rb +533 -0
- data/lib/HDLRuby/std/sequencer_sync.rb +400 -0
- data/lib/HDLRuby/std/std.rb +13 -0
- data/lib/HDLRuby/version.rb +1 -1
- data/tuto/adder_sat_flags_vcd.png +0 -0
- data/tuto/addsub_vcd.png +0 -0
- data/tuto/alu_vcd.png +0 -0
- data/tuto/bit_pong_vcd.png +0 -0
- data/tuto/checksum_vcd.png +0 -0
- data/tuto/circuit_hdr.odg +0 -0
- data/tuto/circuit_hdr.png +0 -0
- data/tuto/circuit_hie.odg +0 -0
- data/tuto/circuit_hie.png +0 -0
- data/tuto/circuit_view.odg +0 -0
- data/tuto/circuit_view.png +0 -0
- data/tuto/clock_counter_vcd.png +0 -0
- data/tuto/counter_ext_vcd.png +0 -0
- data/tuto/fact_vcd.png +0 -0
- data/tuto/hw_flow.odg +0 -0
- data/tuto/hw_flow.png +0 -0
- data/tuto/maxxer_vcd.png +0 -0
- data/tuto/pingpong0_vcd.png +0 -0
- data/tuto/pingpong1_vcd.png +0 -0
- data/tuto/pingpong2_vcd.png +0 -0
- data/tuto/ram_vcd.png +0 -0
- data/tuto/serializer_vcd.png +0 -0
- data/tuto/sw_flow.odg +0 -0
- data/tuto/sw_flow.png +0 -0
- data/tuto/the_counter_vcd.png +0 -0
- data/tuto/tutorial_sw.html +2359 -0
- data/tuto/tutorial_sw.md +2890 -0
- data/tuto/tutorial_sw.pdf +0 -0
- data/tuto/tutorial_sw_jp.md +417 -0
- metadata +46 -2
|
@@ -40,9 +40,9 @@ module HDLRuby::High
|
|
|
40
40
|
return idstr
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
# Enhance the system type class with VCD support.
|
|
43
|
+
|
|
45
44
|
class SystemT
|
|
45
|
+
# Enhance the system type class with VCD support.
|
|
46
46
|
|
|
47
47
|
## Initializes the displayer for generating a vcd on +vcdout+
|
|
48
48
|
def show_init(vcdout)
|
|
@@ -161,9 +161,9 @@ module HDLRuby::High
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
|
|
164
|
-
##
|
|
165
|
-
# Enhance the scope class with VCD support.
|
|
166
164
|
class Scope
|
|
165
|
+
# Enhance the scope class with VCD support.
|
|
166
|
+
|
|
167
167
|
## Shows the hierarchy of the variables.
|
|
168
168
|
def show_hierarchy(vcdout)
|
|
169
169
|
# puts "show_hierarchy for scope=#{self}"
|
|
@@ -252,9 +252,10 @@ module HDLRuby::High
|
|
|
252
252
|
end
|
|
253
253
|
end
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
# Enhance the signals class with VCD support.
|
|
255
|
+
|
|
257
256
|
module SimSignal
|
|
257
|
+
# Enhance the signals class with VCD support.
|
|
258
|
+
|
|
258
259
|
## Shows the hierarchy of the variables.
|
|
259
260
|
def show_hierarchy(vcdout)
|
|
260
261
|
# puts "show_hierarcy for signal=#{self.name}"
|
|
@@ -300,9 +301,10 @@ module HDLRuby::High
|
|
|
300
301
|
end
|
|
301
302
|
end
|
|
302
303
|
|
|
303
|
-
|
|
304
|
-
# Enhance the Transmit class with VCD support.
|
|
304
|
+
|
|
305
305
|
class Transmit
|
|
306
|
+
# Enhance the Transmit class with VCD support.
|
|
307
|
+
|
|
306
308
|
## Shows the hierarchy of the variables.
|
|
307
309
|
def show_hierarchy(vcdout)
|
|
308
310
|
# By default: nothing to do.
|
|
@@ -319,9 +321,10 @@ module HDLRuby::High
|
|
|
319
321
|
end
|
|
320
322
|
end
|
|
321
323
|
|
|
322
|
-
|
|
323
|
-
# Enhance the TimeRepeat class with VCD support.
|
|
324
|
+
|
|
324
325
|
class TimeRepeat
|
|
326
|
+
# Enhance the TimeRepeat class with VCD support.
|
|
327
|
+
|
|
325
328
|
## Shows the hierarchy of the variables.
|
|
326
329
|
def show_hierarchy(vcdout)
|
|
327
330
|
# Recurse on the statement.
|
|
@@ -339,9 +342,10 @@ module HDLRuby::High
|
|
|
339
342
|
end
|
|
340
343
|
end
|
|
341
344
|
|
|
342
|
-
|
|
343
|
-
# Enhance the TimeWait class with VCD support.
|
|
345
|
+
|
|
344
346
|
class TimeWait
|
|
347
|
+
# Enhance the TimeWait class with VCD support.
|
|
348
|
+
|
|
345
349
|
## Shows the hierarchy of the variables.
|
|
346
350
|
def show_hierarchy(vcdout)
|
|
347
351
|
# By default: nothing to do.
|
|
@@ -358,9 +362,10 @@ module HDLRuby::High
|
|
|
358
362
|
end
|
|
359
363
|
end
|
|
360
364
|
|
|
361
|
-
|
|
362
|
-
# Enhance the Print class with VCD support.
|
|
365
|
+
|
|
363
366
|
class Print
|
|
367
|
+
# Enhance the Print class with VCD support.
|
|
368
|
+
|
|
364
369
|
## Shows the hierarchy of the variables.
|
|
365
370
|
def show_hierarchy(vcdout)
|
|
366
371
|
# By default: nothing to do.
|
|
@@ -378,7 +383,7 @@ module HDLRuby::High
|
|
|
378
383
|
end
|
|
379
384
|
|
|
380
385
|
|
|
381
|
-
## Module adding
|
|
386
|
+
## Module adding show_hierarchy to block objects.
|
|
382
387
|
module BlockHierarchy
|
|
383
388
|
## Shows the hierarchy of the variables.
|
|
384
389
|
def show_hierarchy(vcdout)
|
|
@@ -445,23 +450,20 @@ module HDLRuby::High
|
|
|
445
450
|
end
|
|
446
451
|
|
|
447
452
|
|
|
448
|
-
##
|
|
449
|
-
# Enhance the block class with VCD support.
|
|
450
453
|
class Block
|
|
454
|
+
# Enhance the block class with VCD support.
|
|
451
455
|
include HDLRuby::High::BlockHierarchy
|
|
452
456
|
end
|
|
453
457
|
|
|
454
458
|
|
|
455
|
-
##
|
|
456
|
-
# Enhance the block class with VCD support.
|
|
457
459
|
class TimeBlock
|
|
460
|
+
# Enhance the block class with VCD support.
|
|
458
461
|
include HDLRuby::High::BlockHierarchy
|
|
459
462
|
end
|
|
460
463
|
|
|
461
464
|
|
|
462
|
-
##
|
|
463
|
-
# Enhance the if class with VCD support.
|
|
464
465
|
class If
|
|
466
|
+
# Enhance the if class with VCD support.
|
|
465
467
|
## Shows the hierarchy of the variables.
|
|
466
468
|
def show_hierarchy(vcdout)
|
|
467
469
|
# Recurse on the yes.
|
|
@@ -502,9 +504,9 @@ module HDLRuby::High
|
|
|
502
504
|
end
|
|
503
505
|
|
|
504
506
|
|
|
505
|
-
##
|
|
506
|
-
# Enhance the Case class with VCD support.
|
|
507
507
|
class Case
|
|
508
|
+
# Enhance the Case class with VCD support.
|
|
509
|
+
|
|
508
510
|
## Shows the hierarchy of the variables.
|
|
509
511
|
def show_hierarchy(vcdout)
|
|
510
512
|
# Recurse on each when.
|
|
@@ -538,9 +540,10 @@ module HDLRuby::High
|
|
|
538
540
|
end
|
|
539
541
|
end
|
|
540
542
|
|
|
541
|
-
|
|
542
|
-
# Enhance the TimeRepeat class with VCD support.
|
|
543
|
+
|
|
543
544
|
class TimeRepeat
|
|
545
|
+
# Enhance the TimeRepeat class with VCD support.
|
|
546
|
+
|
|
544
547
|
## Shows the hierarchy of the variables.
|
|
545
548
|
def show_hierarchy(vcdout)
|
|
546
549
|
# Recurse on the statement.
|
data/lib/HDLRuby/hruby_types.rb
CHANGED
|
@@ -42,13 +42,13 @@ module HDLRuby
|
|
|
42
42
|
elsif type.float? then
|
|
43
43
|
return type
|
|
44
44
|
elsif self.signed? then
|
|
45
|
-
|
|
45
|
+
if type.signed? then
|
|
46
|
+
return self.width >= type.width ? self : type
|
|
47
|
+
else
|
|
48
|
+
return self
|
|
49
|
+
end
|
|
46
50
|
elsif type.signed? then
|
|
47
51
|
return type
|
|
48
|
-
elsif self.unsigned? then
|
|
49
|
-
return self
|
|
50
|
-
elsif type.unsigned? then
|
|
51
|
-
return type
|
|
52
52
|
elsif self.width >= type.width then
|
|
53
53
|
return self
|
|
54
54
|
else
|
data/lib/HDLRuby/hruby_values.rb
CHANGED
|
@@ -56,7 +56,7 @@ module HDLRuby
|
|
|
56
56
|
else
|
|
57
57
|
# Generate the resulting content.
|
|
58
58
|
res_content = self.content.send(op,val.content)
|
|
59
|
-
# puts "op=#{op} self.content=#{self.content} (#{self.content.to_i}) val.content=#{val.content} (#{val.content.to_i}) res_content=#{res_content} (#{res_content.class})"
|
|
59
|
+
# puts "op=#{op} self.content=#{self.content} (#{self.content.to_i}) val.content=#{val.content} (#{val.content.to_i}) res_content=#{res_content} (#{res_content.class})"
|
|
60
60
|
end
|
|
61
61
|
res_type = self.type.resolve(val.type)
|
|
62
62
|
# # Adjust the result content size.
|
|
@@ -148,9 +148,11 @@ module HDLRuby
|
|
|
148
148
|
if self.content.is_a?(BitString) then
|
|
149
149
|
res_content = self.content[index*width..(index+1)*width-1]
|
|
150
150
|
else
|
|
151
|
+
# puts "self.content=#{self.content} index=#{index}"
|
|
151
152
|
sh = index*width
|
|
152
153
|
mask = (-1 << sh) & ~(-1 << (index+1)*width)
|
|
153
154
|
res_content = (self.content & mask) >> sh
|
|
155
|
+
# puts "res_content=#{res_content}"
|
|
154
156
|
end
|
|
155
157
|
# Return the resulting value.
|
|
156
158
|
return self.class.new(res_type,res_content)
|
|
@@ -240,7 +242,7 @@ module HDLRuby
|
|
|
240
242
|
# Generate the resulting type.
|
|
241
243
|
res_type = self.type
|
|
242
244
|
# Generate the resulting content.
|
|
243
|
-
# puts "op=#{op} content=#{content.to_s}"
|
|
245
|
+
# puts "op=#{op} content=#{content.to_s} width=#{res_type.width}"
|
|
244
246
|
res_content = self.content.send(op)
|
|
245
247
|
# puts "res_content=#{res_content}"
|
|
246
248
|
# Return the resulting value.
|
|
@@ -251,6 +253,7 @@ module HDLRuby
|
|
|
251
253
|
# Cast to +type+.
|
|
252
254
|
# NOTE: nodir tells if the direction is to be ignored.
|
|
253
255
|
def cast(type,nodir = false)
|
|
256
|
+
# puts "cast with content=#{self.content} type.signed=#{type.signed?} type.width=#{type.width}"
|
|
254
257
|
# Handle the direction.
|
|
255
258
|
if !nodir && type.direction != self.type.direction then
|
|
256
259
|
if self.content.is_a?(Numeric) then
|
|
@@ -279,16 +282,18 @@ module HDLRuby
|
|
|
279
282
|
res_content.positive!
|
|
280
283
|
end
|
|
281
284
|
end
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
# else
|
|
286
|
-
# res_content = self.trunc(res_content,type.width)
|
|
287
|
-
# end
|
|
285
|
+
if type.signed? && res_content.is_a?(Numeric) && res_content >= (1 << (type.width-1)) then
|
|
286
|
+
res_content = (-1 << type.width) + res_content
|
|
287
|
+
end
|
|
288
288
|
# Generate the resulting value.
|
|
289
|
+
# puts "res_content=#{res_content}"
|
|
289
290
|
return self.class.new(type,res_content)
|
|
290
291
|
end
|
|
291
292
|
|
|
293
|
+
def as(typ)
|
|
294
|
+
return self.cast(typ)
|
|
295
|
+
end
|
|
296
|
+
|
|
292
297
|
# Concat the content of +vals+.
|
|
293
298
|
def self.concat(*vals)
|
|
294
299
|
# Compute the resulting type.
|
|
@@ -405,6 +410,12 @@ module HDLRuby
|
|
|
405
410
|
end
|
|
406
411
|
end
|
|
407
412
|
|
|
413
|
+
# Tell if the value is high impedance.
|
|
414
|
+
def impedence?
|
|
415
|
+
return false unless @content.is_a?(BitString)
|
|
416
|
+
return @content.raw_content.include?(2)
|
|
417
|
+
end
|
|
418
|
+
|
|
408
419
|
## Converts the value to a string of the right size.
|
|
409
420
|
def to_vstr
|
|
410
421
|
if self.content.is_a?(Numeric) then
|