HDLRuby 2.11.11 → 3.0.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.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/README.html +3274 -0
  3. data/README.md +608 -99
  4. data/ext/hruby_sim/hruby_rcsim_build.c +27 -0
  5. data/ext/hruby_sim/hruby_sim.h +3 -0
  6. data/ext/hruby_sim/hruby_sim_calc.c +2 -0
  7. data/ext/hruby_sim/hruby_sim_core.c +17 -5
  8. data/ext/hruby_sim/hruby_sim_stack_calc.c +1 -1
  9. data/ext/hruby_sim/hruby_sim_tree_calc.c +8 -1
  10. data/ext/hruby_sim/hruby_sim_vcd.c +24 -7
  11. data/ext/hruby_sim/hruby_sim_vizualize.c +9 -1
  12. data/lib/HDLRuby/backend/hruby_allocator.rb +2 -2
  13. data/lib/HDLRuby/backend/hruby_c_allocator.rb +7 -7
  14. data/lib/HDLRuby/hdr_samples/constant_in_function.rb +3 -1
  15. data/lib/HDLRuby/hdr_samples/counter_dff_bench.rb +3 -1
  16. data/lib/HDLRuby/hdr_samples/huge_rom.rb +1 -1
  17. data/lib/HDLRuby/hdr_samples/mei8.rb +11 -11
  18. data/lib/HDLRuby/hdr_samples/mei8_bench.rb +12 -12
  19. data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +4 -4
  20. data/lib/HDLRuby/hdr_samples/rom_nest.rb +1 -1
  21. data/lib/HDLRuby/hdr_samples/ruby_fir_hw.rb +4 -4
  22. data/lib/HDLRuby/hdr_samples/struct.rb +44 -10
  23. data/lib/HDLRuby/hdr_samples/with_bram.rb +45 -0
  24. data/lib/HDLRuby/hdr_samples/with_bram_frame_stack.rb +105 -0
  25. data/lib/HDLRuby/hdr_samples/with_bram_stack.rb +69 -0
  26. data/lib/HDLRuby/hdr_samples/with_casts.rb +3 -3
  27. data/lib/HDLRuby/hdr_samples/with_concat.rb +6 -6
  28. data/lib/HDLRuby/hdr_samples/with_connector_memory.rb +2 -2
  29. data/lib/HDLRuby/hdr_samples/with_def.rb +10 -3
  30. data/lib/HDLRuby/hdr_samples/with_define_operator.rb +44 -0
  31. data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +12 -12
  32. data/lib/HDLRuby/hdr_samples/with_init.rb +3 -3
  33. data/lib/HDLRuby/hdr_samples/with_leftright.rb +21 -0
  34. data/lib/HDLRuby/hdr_samples/with_reduce.rb +13 -13
  35. data/lib/HDLRuby/hdr_samples/with_ref_array.rb +6 -6
  36. data/lib/HDLRuby/hdr_samples/with_register_stack.rb +150 -0
  37. data/lib/HDLRuby/hdr_samples/with_sequencer.rb +190 -0
  38. data/lib/HDLRuby/hdr_samples/with_sequencer_deep.rb +91 -0
  39. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +405 -0
  40. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +89 -0
  41. data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +120 -0
  42. data/lib/HDLRuby/hdr_samples/with_subsums.rb +3 -3
  43. data/lib/HDLRuby/hdr_samples/with_terminate.rb +3 -3
  44. data/lib/HDLRuby/hdr_samples/with_to_a.rb +10 -10
  45. data/lib/HDLRuby/hdr_samples/with_values.rb +3 -3
  46. data/lib/HDLRuby/hdrcc.rb +29 -3
  47. data/lib/HDLRuby/hdrlib.rb +1 -1
  48. data/lib/HDLRuby/hruby_bstr.rb +10 -5
  49. data/lib/HDLRuby/hruby_db.rb +2 -2
  50. data/lib/HDLRuby/hruby_high.rb +152 -47
  51. data/lib/HDLRuby/hruby_high_fullname.rb +3 -1
  52. data/lib/HDLRuby/hruby_low.rb +189 -18
  53. data/lib/HDLRuby/hruby_low2c.rb +129 -54
  54. data/lib/HDLRuby/hruby_low2hdr.rb +66 -40
  55. data/lib/HDLRuby/hruby_low2high.rb +86 -44
  56. data/lib/HDLRuby/hruby_low2seq.rb +26 -18
  57. data/lib/HDLRuby/hruby_low2sym.rb +14 -13
  58. data/lib/HDLRuby/hruby_low2vhd.rb +80 -44
  59. data/lib/HDLRuby/hruby_low_bool2select.rb +61 -46
  60. data/lib/HDLRuby/hruby_low_casts_without_expression.rb +56 -44
  61. data/lib/HDLRuby/hruby_low_cleanup.rb +18 -16
  62. data/lib/HDLRuby/hruby_low_fix_types.rb +65 -32
  63. data/lib/HDLRuby/hruby_low_mutable.rb +83 -119
  64. data/lib/HDLRuby/hruby_low_resolve.rb +38 -30
  65. data/lib/HDLRuby/hruby_low_with_bool.rb +33 -16
  66. data/lib/HDLRuby/hruby_low_with_port.rb +3 -3
  67. data/lib/HDLRuby/hruby_low_with_var.rb +23 -9
  68. data/lib/HDLRuby/hruby_low_without_concat.rb +45 -19
  69. data/lib/HDLRuby/hruby_low_without_namespace.rb +47 -32
  70. data/lib/HDLRuby/hruby_low_without_parinseq.rb +32 -16
  71. data/lib/HDLRuby/hruby_low_without_select.rb +37 -24
  72. data/lib/HDLRuby/hruby_low_without_subsignals.rb +280 -0
  73. data/lib/HDLRuby/hruby_rcsim.rb +158 -134
  74. data/lib/HDLRuby/hruby_rsim.rb +194 -20
  75. data/lib/HDLRuby/hruby_rsim_mute.rb +2 -3
  76. data/lib/HDLRuby/hruby_rsim_vcd.rb +125 -50
  77. data/lib/HDLRuby/hruby_values.rb +48 -33
  78. data/lib/HDLRuby/hruby_verilog.rb +90 -48
  79. data/lib/HDLRuby/soft/stacks.rb +219 -0
  80. data/lib/HDLRuby/std/bram.rb +26 -0
  81. data/lib/HDLRuby/std/clocks.rb +1 -1
  82. data/lib/HDLRuby/std/fixpoint.rb +2 -2
  83. data/lib/HDLRuby/std/fsm.rb +48 -11
  84. data/lib/HDLRuby/std/function_generator.rb +2 -2
  85. data/lib/HDLRuby/std/sequencer.rb +1857 -0
  86. data/lib/HDLRuby/std/sequencer_sync.rb +400 -0
  87. data/lib/HDLRuby/std/std.rb +12 -0
  88. data/lib/HDLRuby/version.rb +1 -1
  89. data/tuto/adder_sat_flags_vcd.png +0 -0
  90. data/tuto/addsub_vcd.png +0 -0
  91. data/tuto/alu_vcd.png +0 -0
  92. data/tuto/bit_pong_vcd.png +0 -0
  93. data/tuto/checksum_vcd.png +0 -0
  94. data/tuto/circuit_hdr.odg +0 -0
  95. data/tuto/circuit_hdr.png +0 -0
  96. data/tuto/circuit_hie.odg +0 -0
  97. data/tuto/circuit_hie.png +0 -0
  98. data/tuto/circuit_view.odg +0 -0
  99. data/tuto/circuit_view.png +0 -0
  100. data/tuto/clock_counter_vcd.png +0 -0
  101. data/tuto/counter_ext_vcd.png +0 -0
  102. data/tuto/fact_vcd.png +0 -0
  103. data/tuto/hw_flow.odg +0 -0
  104. data/tuto/hw_flow.png +0 -0
  105. data/tuto/maxxer_vcd.png +0 -0
  106. data/tuto/pingpong0_vcd.png +0 -0
  107. data/tuto/pingpong1_vcd.png +0 -0
  108. data/tuto/pingpong2_vcd.png +0 -0
  109. data/tuto/ram_vcd.png +0 -0
  110. data/tuto/serializer_vcd.png +0 -0
  111. data/tuto/sw_flow.odg +0 -0
  112. data/tuto/sw_flow.png +0 -0
  113. data/tuto/the_counter_vcd.png +0 -0
  114. data/tuto/tutorial_sw.html +2359 -0
  115. data/tuto/tutorial_sw.md +2684 -0
  116. data/tuto/tutorial_sw.pdf +0 -0
  117. data/tuto/tutorial_sw_jp.md +417 -0
  118. metadata +49 -3
  119. data/lib/HDLRuby/hdr_samples/sumprod.rb +0 -29
@@ -1,6 +1,7 @@
1
1
  require "HDLRuby/hruby_error"
2
2
 
3
3
 
4
+ module HDLRuby::Low
4
5
 
5
6
  ##
6
7
  # Make HDLRuby::Low objects mutable trough "!" methods.
@@ -10,13 +11,10 @@ require "HDLRuby/hruby_error"
10
11
  # * this is a work in progress.
11
12
  #
12
13
  ########################################################################
13
- module HDLRuby::Low
14
-
15
- ##
16
- # Describes a system type.
17
- #
18
- # NOTE: delegates its content-related methods to its Scope object.
14
+
15
+
19
16
  class SystemT
17
+ ## Makes SystemT mutable.
20
18
 
21
19
  # Sets the +name+.
22
20
  def set_name!(name)
@@ -97,9 +95,8 @@ module HDLRuby::Low
97
95
  end
98
96
 
99
97
 
100
- ##
101
- # Describes scopes of system types.
102
98
  class Scope
99
+ ## Makes Scope mutable.
103
100
 
104
101
  # Maps on the local types.
105
102
  def map_types!(&ruby_block)
@@ -272,9 +269,8 @@ module HDLRuby::Low
272
269
  end
273
270
 
274
271
 
275
- ##
276
- # Describes a data type.
277
272
  class Type
273
+ ## Makes Type mutable.
278
274
 
279
275
  # Sets the +name+.
280
276
  def set_name!(name)
@@ -283,12 +279,8 @@ module HDLRuby::Low
283
279
  end
284
280
 
285
281
 
286
- ##
287
- # Describes a high-level type definition.
288
- #
289
- # NOTE: type definition are actually type with a name refering to another
290
- # type (and equivalent to it).
291
282
  class TypeDef
283
+ ## Makes TypeDef mutable.
292
284
 
293
285
  # Sets the type definition to +type+.
294
286
  def set_def!(type)
@@ -302,10 +294,8 @@ module HDLRuby::Low
302
294
  end
303
295
 
304
296
 
305
-
306
- ##
307
- # Describes a vector type.
308
297
  class TypeVector
298
+ ## Makes TypeVector mutable.
309
299
 
310
300
  # Sets the +base+ type.
311
301
  def set_base!(type)
@@ -333,9 +323,8 @@ module HDLRuby::Low
333
323
  end
334
324
 
335
325
 
336
- ##
337
- # Describes a tuple type.
338
326
  class TypeTuple
327
+ ## Makes TypeTuple mutable.
339
328
 
340
329
  # Maps on the sub types.
341
330
  def map_types!(&ruby_block)
@@ -355,9 +344,8 @@ module HDLRuby::Low
355
344
  end
356
345
 
357
346
 
358
- ##
359
- # Describes a structure type.
360
347
  class TypeStruct
348
+ ## Makes TypeStruct mutable.
361
349
 
362
350
  # Maps on the sub types.
363
351
  def map_types!(&ruby_block)
@@ -377,10 +365,8 @@ module HDLRuby::Low
377
365
  end
378
366
 
379
367
 
380
-
381
- ##
382
- # Describes a behavior.
383
368
  class Behavior
369
+ ## Makes Behavior mutable.
384
370
 
385
371
  # Sets the block.
386
372
  def set_block!(block)
@@ -409,13 +395,8 @@ module HDLRuby::Low
409
395
  end
410
396
 
411
397
 
412
- ##
413
- # Describes a timed behavior.
414
- #
415
- # NOTE:
416
- # * this is the only kind of behavior that can include time statements.
417
- # * this kind of behavior is not synthesizable!
418
398
  class TimeBehavior
399
+ ## Makes TimeBehavior mutable.
419
400
 
420
401
  # Sets the block.
421
402
  def set_block!(block)
@@ -430,9 +411,9 @@ module HDLRuby::Low
430
411
  end
431
412
 
432
413
 
433
- ##
434
- # Describes an event.
435
414
  class Event
415
+ ## Makes Event mutable.
416
+
436
417
  # Sets the type.
437
418
  def set_type!(type)
438
419
  # Check and set the type.
@@ -482,9 +463,8 @@ module HDLRuby::Low
482
463
  end
483
464
 
484
465
 
485
- ##
486
- # Describes a signal.
487
466
  class SignalI
467
+ ## Makes SignalI mutable.
488
468
 
489
469
  # Sets the name.
490
470
  def set_name!(name)
@@ -515,9 +495,8 @@ module HDLRuby::Low
515
495
  end
516
496
 
517
497
 
518
- ##
519
- # Describes a system instance.
520
498
  class SystemI
499
+ ## Makes SystemI mutable.
521
500
 
522
501
  # Sets the name.
523
502
  def set_name!(name)
@@ -537,12 +516,9 @@ module HDLRuby::Low
537
516
  end
538
517
 
539
518
 
540
-
541
- ##
542
- # Describes a statement.
543
- #
544
- # NOTE: this is an abstract class which is not to be used directly.
545
519
  class Statement
520
+ ## Makes Statement mutable.
521
+
546
522
  # Replaces sub expressions using +node2rep+ table indicating the
547
523
  # node to replace and the corresponding replacement.
548
524
  # Returns the actually replaced nodes and their corresponding
@@ -564,11 +540,9 @@ module HDLRuby::Low
564
540
  end
565
541
 
566
542
 
567
-
568
-
569
- ##
570
- # Decribes a transmission statement.
571
543
  class Transmit
544
+ ## Makes Transmit mutable.
545
+
572
546
  # Sets the left.
573
547
  def set_left!(left)
574
548
  # Check and set the left reference.
@@ -600,6 +574,9 @@ module HDLRuby::Low
600
574
  right.parent = self unless right.parent
601
575
  end
602
576
 
577
+ alias_method :map_expressions!, :map_nodes!
578
+
579
+
603
580
  # Replaces sub expressions using +node2rep+ table indicating the
604
581
  # node to replace and the corresponding replacement.
605
582
  # Returns the actually replaced nodes and their corresponding
@@ -638,9 +615,8 @@ module HDLRuby::Low
638
615
  end
639
616
 
640
617
 
641
- ##
642
- # Decribes a print statement.
643
618
  class Print
619
+ ## Makes Print mutable.
644
620
 
645
621
  # Maps on the arguments.
646
622
  def map_args!(&ruby_block)
@@ -696,9 +672,8 @@ module HDLRuby::Low
696
672
  end
697
673
 
698
674
 
699
- ##
700
- # Describes an if statement.
701
675
  class If
676
+ ## Makes If mutable.
702
677
 
703
678
  # Sets the condition.
704
679
  def set_condition!(condition)
@@ -816,9 +791,10 @@ module HDLRuby::Low
816
791
  end
817
792
  end
818
793
 
819
- ##
820
- # Describes a when for a case statement.
794
+
821
795
  class When
796
+ ## Makes When mutable.
797
+
822
798
  # Sets the match.
823
799
  def set_match!(match)
824
800
  # Checks the match.
@@ -890,9 +866,8 @@ module HDLRuby::Low
890
866
  end
891
867
 
892
868
 
893
- ##
894
- # Describes a case statement.
895
869
  class Case
870
+ ## Makes Case mutable.
896
871
 
897
872
  # Sets the value.
898
873
  def set_value!(value)
@@ -908,6 +883,10 @@ module HDLRuby::Low
908
883
  # Sets the default.
909
884
  def set_default!(default)
910
885
  # Checks and set the default case if any.
886
+ if self.default then
887
+ # There is a default first detach it.
888
+ @default = nil
889
+ end
911
890
  self.default = default
912
891
  end
913
892
 
@@ -977,9 +956,8 @@ module HDLRuby::Low
977
956
  end
978
957
 
979
958
 
980
- ##
981
- # Describes a delay: not synthesizable.
982
959
  class Delay
960
+ ## Makes Delay mutable.
983
961
 
984
962
  # Sets the value.
985
963
  def set_value!(value)
@@ -1023,9 +1001,8 @@ module HDLRuby::Low
1023
1001
  end
1024
1002
 
1025
1003
 
1026
- ##
1027
- # Describes a wait statement: not synthesizable!
1028
1004
  class TimeWait
1005
+ ## Makes TimeWait mutable.
1029
1006
 
1030
1007
  # Sets the delay.
1031
1008
  def set_delay!(delay)
@@ -1045,9 +1022,8 @@ module HDLRuby::Low
1045
1022
  end
1046
1023
 
1047
1024
 
1048
- ##
1049
- # Describes a timed loop statement: not synthesizable!
1050
1025
  class TimeRepeat
1026
+ ## Makes TimeRepeat mutable.
1051
1027
 
1052
1028
  # Sets the statement.
1053
1029
  def set_statement!(statement)
@@ -1095,9 +1071,8 @@ module HDLRuby::Low
1095
1071
  end
1096
1072
 
1097
1073
 
1098
- ##
1099
- # Describes a block.
1100
1074
  class Block
1075
+ ## Makes Block mutable.
1101
1076
 
1102
1077
  # Sets the mode.
1103
1078
  def set_mode!(mode)
@@ -1172,7 +1147,11 @@ module HDLRuby::Low
1172
1147
  raise AnyError, "Invalid type for a statement: #{stmnt.class}"
1173
1148
  end
1174
1149
  idx = @statements.index(org)
1175
- @statements[idx] = stmnt if idx
1150
+ # @statements[idx] = stmnt if idx
1151
+ if idx then
1152
+ @statements[idx] = stmnt
1153
+ stmnt.parent = self unless stmnt.parent
1154
+ end
1176
1155
  end
1177
1156
 
1178
1157
  # Maps on the statements.
@@ -1263,18 +1242,14 @@ module HDLRuby::Low
1263
1242
  end
1264
1243
 
1265
1244
 
1266
- # Describes a timed block.
1267
- #
1268
- # NOTE:
1269
- # * this is the only kind of block that can include time statements.
1270
- # * this kind of block is not synthesizable!
1271
1245
  class TimeBlock
1246
+ ## Makes TimeBlock mutable.
1272
1247
  end
1273
1248
 
1274
1249
 
1275
- ##
1276
- # Decribes a piece of software code.
1277
1250
  class Code
1251
+ ## Makes Code mutable.
1252
+
1278
1253
  # Sets the type.
1279
1254
  def set_type!(type)
1280
1255
  # Check and set type.
@@ -1290,13 +1265,8 @@ module HDLRuby::Low
1290
1265
  end
1291
1266
 
1292
1267
 
1293
- ##
1294
- # Describes a connection.
1295
- #
1296
- # NOTE: eventhough a connection is semantically different from a
1297
- # transmission, it has a common structure. Therefore, it is described
1298
- # as a subclass of a transmit.
1299
1268
  class Connection
1269
+ ## Makes Connection mutable.
1300
1270
 
1301
1271
  # Replace node by corresponding replacement from +node2reassign+ that
1302
1272
  # is a table whose entries are:
@@ -1334,12 +1304,8 @@ module HDLRuby::Low
1334
1304
  end
1335
1305
 
1336
1306
 
1337
-
1338
- ##
1339
- # Describes an expression.
1340
- #
1341
- # NOTE: this is an abstract class which is not to be used directly.
1342
1307
  class Expression
1308
+ ## Makes Expression mutable.
1343
1309
 
1344
1310
  # Sets the type.
1345
1311
  def set_type!(type)
@@ -1371,9 +1337,8 @@ module HDLRuby::Low
1371
1337
  end
1372
1338
 
1373
1339
 
1374
- ##
1375
- # Describes a value.
1376
1340
  class Value
1341
+ ## Makes Value mutable.
1377
1342
 
1378
1343
  # Sets the content.
1379
1344
  def set_content!(content)
@@ -1403,6 +1368,8 @@ module HDLRuby::Low
1403
1368
  @child.parent = self unless @child.parent
1404
1369
  end
1405
1370
 
1371
+ alias_method :map_expressions!, :map_nodes!
1372
+
1406
1373
  # Replaces sub expressions using +node2rep+ table indicating the
1407
1374
  # node to replace and the corresponding replacement.
1408
1375
  # Returns the actually replaced nodes and their corresponding
@@ -1427,18 +1394,15 @@ module HDLRuby::Low
1427
1394
  end
1428
1395
  end
1429
1396
 
1430
- ##
1431
- # Describes a cast.
1397
+
1432
1398
  class Cast
1399
+ ## Makes Cast mutable.
1433
1400
  include OneChildMutable
1434
1401
  end
1435
1402
 
1436
1403
 
1437
- ##
1438
- # Describes an operation.
1439
- #
1440
- # NOTE: this is an abstract class which is not to be used directly.
1441
1404
  class Operation
1405
+ ## Makes Operation mutable.
1442
1406
 
1443
1407
  # Sets the operator.
1444
1408
  def set_operator!(operator)
@@ -1448,9 +1412,8 @@ module HDLRuby::Low
1448
1412
  end
1449
1413
 
1450
1414
 
1451
- ##
1452
- # Describes an unary operation.
1453
1415
  class Unary
1416
+ ## Makes Unary mutable.
1454
1417
  include OneChildMutable
1455
1418
 
1456
1419
  # Moved to OneChildMutable
@@ -1473,9 +1436,8 @@ module HDLRuby::Low
1473
1436
  end
1474
1437
 
1475
1438
 
1476
- ##
1477
- # Describes an binary operation.
1478
1439
  class Binary
1440
+ ## Makes Binary mutable.
1479
1441
 
1480
1442
  # Sets the left.
1481
1443
  def set_left!(left)
@@ -1507,6 +1469,8 @@ module HDLRuby::Low
1507
1469
  @right.parent = self unless @right.parent
1508
1470
  end
1509
1471
 
1472
+ alias_method :map_expressions!, :map_nodes!
1473
+
1510
1474
  # Replaces sub expressions using +node2rep+ table indicating the
1511
1475
  # node to replace and the corresponding replacement.
1512
1476
  # Returns the actually replaced nodes and their corresponding
@@ -1545,11 +1509,8 @@ module HDLRuby::Low
1545
1509
  end
1546
1510
 
1547
1511
 
1548
- ##
1549
- # Describes a section operation (generalization of the ternary operator).
1550
- #
1551
- # NOTE: choice is using the value of +select+ as an index.
1552
1512
  class Select
1513
+ ## Makes Select mutable.
1553
1514
 
1554
1515
  # Sets the select.
1555
1516
  def set_select!(select)
@@ -1590,6 +1551,8 @@ module HDLRuby::Low
1590
1551
  map_choices!(&ruby_block)
1591
1552
  end
1592
1553
 
1554
+ alias_method :map_expressions!, :map_nodes!
1555
+
1593
1556
  # Replaces sub expressions using +node2rep+ table indicating the
1594
1557
  # node to replace and the corresponding replacement.
1595
1558
  # Returns the actually replaced nodes and their corresponding
@@ -1668,9 +1631,8 @@ module HDLRuby::Low
1668
1631
  end
1669
1632
 
1670
1633
 
1671
- ##
1672
- # Describes a concatenation expression.
1673
1634
  class Concat
1635
+ ## Makes Concat mutable.
1674
1636
  include MutableConcat
1675
1637
 
1676
1638
  # Maps on the expression.
@@ -1698,21 +1660,20 @@ module HDLRuby::Low
1698
1660
  end
1699
1661
 
1700
1662
 
1701
- ##
1702
- # Describes a reference expression.
1703
- #
1704
- # NOTE: this is an abstract class which is not to be used directly.
1705
1663
  class Ref
1664
+ ## Makes Ref mutable.
1665
+
1706
1666
  # Maps on the children.
1707
1667
  def map_nodes!(&ruby_block)
1708
1668
  # Nothing to do.
1709
1669
  end
1670
+
1671
+ alias_method :map_expressions!, :map_nodes!
1710
1672
  end
1711
1673
 
1712
1674
 
1713
- ##
1714
- # Describes concatenation reference.
1715
1675
  class RefConcat
1676
+ ## Makes RefConcat mutable.
1716
1677
  include MutableConcat
1717
1678
 
1718
1679
  # Maps on the references.
@@ -1740,9 +1701,8 @@ module HDLRuby::Low
1740
1701
  end
1741
1702
 
1742
1703
 
1743
- ##
1744
- # Describes a index reference.
1745
1704
  class RefIndex
1705
+ ## Makes RefIndex mutable.
1746
1706
 
1747
1707
  # Sets the base reference.
1748
1708
  def set_ref!(ref)
@@ -1775,6 +1735,8 @@ module HDLRuby::Low
1775
1735
  @ref.parent = self unless @ref.parent
1776
1736
  end
1777
1737
 
1738
+ alias_method :map_expressions!, :map_nodes!
1739
+
1778
1740
  # Replaces sub expressions using +node2rep+ table indicating the
1779
1741
  # node to replace and the corresponding replacement.
1780
1742
  # Returns the actually replaced nodes and their corresponding
@@ -1814,9 +1776,8 @@ module HDLRuby::Low
1814
1776
  end
1815
1777
 
1816
1778
 
1817
- ##
1818
- # Describes a range reference.
1819
1779
  class RefRange
1780
+ ## Makes RefRange mutable.
1820
1781
 
1821
1782
  # Sets the base reference.
1822
1783
  def set_ref!(ref)
@@ -1856,6 +1817,8 @@ module HDLRuby::Low
1856
1817
  @ref.parent = self unless @ref.parent
1857
1818
  end
1858
1819
 
1820
+ alias_method :map_expressions!, :map_nodes!
1821
+
1859
1822
  # Replaces sub expressions using +node2rep+ table indicating the
1860
1823
  # node to replace and the corresponding replacement.
1861
1824
  # Returns the actually replaced nodes and their corresponding
@@ -1908,9 +1871,9 @@ module HDLRuby::Low
1908
1871
  end
1909
1872
 
1910
1873
 
1911
- ##
1912
- # Describes a name reference.
1913
1874
  class RefName
1875
+ # Makes RefName mutable.
1876
+
1914
1877
  # Sets the base reference.
1915
1878
  def set_ref!(ref)
1916
1879
  # Check and set the accessed reference.
@@ -1934,6 +1897,8 @@ module HDLRuby::Low
1934
1897
  @ref.parent = self unless @ref.parent
1935
1898
  end
1936
1899
 
1900
+ alias_method :map_expressions!, :map_nodes!
1901
+
1937
1902
  # Replaces sub expressions using +node2rep+ table indicating the
1938
1903
  # node to replace and the corresponding replacement.
1939
1904
  # Returns the actually replaced nodes and their corresponding
@@ -1960,23 +1925,20 @@ module HDLRuby::Low
1960
1925
  end
1961
1926
 
1962
1927
 
1963
- ##
1964
- # Describe a this reference.
1965
- #
1966
- # This is the current system.
1967
1928
  class RefThis
1929
+ ## Makes RefThis mutable.
1968
1930
 
1969
1931
  # Maps on the children.
1970
1932
  def map_nodes!(&ruby_block)
1971
1933
  # Nothing to do.
1972
1934
  end
1935
+
1936
+ alias_method :map_expressions!, :map_nodes!
1973
1937
  end
1974
1938
 
1975
- ##
1976
- # Describes a string.
1977
- #
1978
- # NOTE: This is not synthesizable!
1939
+
1979
1940
  class StringE
1941
+ ## Makes StringE mutable.
1980
1942
 
1981
1943
  # Maps on the arguments.
1982
1944
  def map_args!(&ruby_block)
@@ -1991,5 +1953,7 @@ module HDLRuby::Low
1991
1953
  def map_nodes!(&ruby_block)
1992
1954
  self.map_args!(&ruby_block)
1993
1955
  end
1956
+
1957
+ alias_method :map_expressions!, :map_nodes!
1994
1958
  end
1995
1959
  end
@@ -1,6 +1,8 @@
1
1
  require "HDLRuby/hruby_error"
2
2
 
3
3
 
4
+ module HDLRuby::Low
5
+
4
6
 
5
7
  ##
6
8
  # Adds methods for finding objects through names.
@@ -8,12 +10,11 @@ require "HDLRuby/hruby_error"
8
10
  # NOTE: For now only resolve name reference.
9
11
  #
10
12
  ########################################################################
11
- module HDLRuby::Low
12
13
 
13
- ##
14
- # Extends SystemT with the capability of finding one of its inner object
15
- # by name.
14
+
16
15
  class SystemT
16
+ ## Extends SystemT with the capability of finding one of its inner
17
+ # object by name.
17
18
 
18
19
  ## Find an inner object by +name+.
19
20
  # NOTE: return nil if not found.
@@ -31,10 +32,9 @@ module HDLRuby::Low
31
32
  end
32
33
 
33
34
 
34
- ##
35
- # Extends Scope with the capability of finding one of its inner object
36
- # by name.
37
35
  class Scope
36
+ ## Extends Scope with the capability of finding one of its inner object
37
+ # by name.
38
38
 
39
39
  ## Find an inner object by +name+.
40
40
  # NOTE: return nil if not found.
@@ -55,10 +55,10 @@ module HDLRuby::Low
55
55
  end
56
56
  end
57
57
 
58
- ##
59
- # Extends Behavior with the capability of finding one of its inner object
60
- # by name.
58
+
61
59
  class Behavior
60
+ ## Extends Behavior with the capability of finding one of its inner
61
+ # object by name.
62
62
 
63
63
  ## Find an inner object by +name+.
64
64
  # NOTE: return nil if not found.
@@ -70,10 +70,10 @@ module HDLRuby::Low
70
70
  end
71
71
  end
72
72
 
73
- ##
74
- # Extends SystemI with the capability of finding one of its inner object
75
- # by name.
73
+
76
74
  class SystemI
75
+ ## Extends SystemI with the capability of finding one of its inner object
76
+ # by name.
77
77
 
78
78
  ## Find an inner object by +name+.
79
79
  # NOTE: return nil if not found.
@@ -84,10 +84,9 @@ module HDLRuby::Low
84
84
  end
85
85
 
86
86
 
87
- ##
88
- # Extends Block with the capability of finding one of its inner object
89
- # by name.
90
87
  class Block
88
+ ## Extends Block with the capability of finding one of its inner object
89
+ # by name.
91
90
 
92
91
  ## Find an inner object by +name+.
93
92
  # NOTE: return nil if not found.
@@ -109,10 +108,23 @@ module HDLRuby::Low
109
108
  end
110
109
 
111
110
 
112
- ##
113
- # Extends RefIndex with the capability of finding the object it
114
- # refered to.
111
+ class SignalI
112
+ ## Extends SignalI with the capability of finding one of its inner object
113
+ # by name.
114
+
115
+ ## Find an inner object by +name+.
116
+ # NOTE: return nil if not found.
117
+ def get_by_name(name)
118
+ return self.get_signal(name)
119
+ end
120
+ end
121
+
122
+
123
+
115
124
  class Ref
125
+ ## Extends RefIndex with the capability of finding the object it
126
+ # refered to.
127
+
116
128
  ## Resolves the name of the reference (if any) and return the
117
129
  # corresponding object.
118
130
  # NOTE: return nil if could not resolve.
@@ -123,10 +135,9 @@ module HDLRuby::Low
123
135
  end
124
136
 
125
137
 
126
- ##
127
- # Extends RefIndex with the capability of finding the object it
128
- # refered to.
129
138
  class RefIndex
139
+ ## Extends RefIndex with the capability of finding the object it
140
+ # refered to.
130
141
 
131
142
  ## Tells if it is a reference to a systemI signal.
132
143
  def from_systemI?
@@ -142,10 +153,9 @@ module HDLRuby::Low
142
153
  end
143
154
 
144
155
 
145
- ##
146
- # Extends RefRange with the capability of finding the object it
147
- # refered to.
148
156
  class RefRange
157
+ ## Extends RefRange with the capability of finding the object it
158
+ # refered to.
149
159
 
150
160
  ## Tells if it is a reference to a systemI signal.
151
161
  def from_systemI?
@@ -161,10 +171,9 @@ module HDLRuby::Low
161
171
  end
162
172
 
163
173
 
164
- ##
165
- # Extends RefName with the capability of finding the object it
166
- # refered to.
167
174
  class RefName
175
+ ## Extends RefName with the capability of finding the object it
176
+ # refered to.
168
177
 
169
178
  ## Tells if it is a reference to a systemI signal.
170
179
  def from_systemI?
@@ -219,10 +228,9 @@ module HDLRuby::Low
219
228
  # corresponding object.
220
229
  # NOTE: return nil if could not resolve.
221
230
  def resolve
222
- # puts "Resolve with #{self} and name=#{self.name}"
231
+ # puts "Resolve with #{self} and name=#{self.name} and ref=#{self.ref.class}"
223
232
  # First resolve the sub reference if possible.
224
233
  if self.ref.is_a?(RefName) then
225
- # puts "ref name=#{self.ref.name}"
226
234
  obj = self.ref.resolve
227
235
  # puts "obj=#{obj}"
228
236
  # Look into the object for the name.