HDLRuby 2.11.12 → 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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.html +3274 -0
  3. data/README.md +556 -84
  4. data/ext/hruby_sim/hruby_sim_calc.c +2 -0
  5. data/lib/HDLRuby/backend/hruby_allocator.rb +2 -2
  6. data/lib/HDLRuby/backend/hruby_c_allocator.rb +7 -7
  7. data/lib/HDLRuby/hdr_samples/mei8_bench.rb +1 -1
  8. data/lib/HDLRuby/hdr_samples/with_bram.rb +3 -3
  9. data/lib/HDLRuby/hdr_samples/with_bram_frame_stack.rb +105 -0
  10. data/lib/HDLRuby/hdr_samples/with_bram_stack.rb +69 -0
  11. data/lib/HDLRuby/hdr_samples/with_register_stack.rb +150 -0
  12. data/lib/HDLRuby/hdr_samples/with_sequencer.rb +190 -0
  13. data/lib/HDLRuby/hdr_samples/with_sequencer_deep.rb +91 -0
  14. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerable.rb +405 -0
  15. data/lib/HDLRuby/hdr_samples/with_sequencer_enumerator.rb +89 -0
  16. data/lib/HDLRuby/hdr_samples/with_sequencer_sync.rb +120 -0
  17. data/lib/HDLRuby/hdrcc.rb +15 -2
  18. data/lib/HDLRuby/hdrlib.rb +1 -1
  19. data/lib/HDLRuby/hruby_db.rb +2 -2
  20. data/lib/HDLRuby/hruby_high.rb +38 -20
  21. data/lib/HDLRuby/hruby_high_fullname.rb +3 -1
  22. data/lib/HDLRuby/hruby_low.rb +2 -2
  23. data/lib/HDLRuby/hruby_low2c.rb +58 -43
  24. data/lib/HDLRuby/hruby_low2hdr.rb +66 -40
  25. data/lib/HDLRuby/hruby_low2high.rb +86 -44
  26. data/lib/HDLRuby/hruby_low2seq.rb +26 -18
  27. data/lib/HDLRuby/hruby_low2sym.rb +14 -13
  28. data/lib/HDLRuby/hruby_low2vhd.rb +78 -43
  29. data/lib/HDLRuby/hruby_low_bool2select.rb +61 -46
  30. data/lib/HDLRuby/hruby_low_casts_without_expression.rb +56 -44
  31. data/lib/HDLRuby/hruby_low_cleanup.rb +18 -16
  32. data/lib/HDLRuby/hruby_low_fix_types.rb +64 -32
  33. data/lib/HDLRuby/hruby_low_mutable.rb +53 -118
  34. data/lib/HDLRuby/hruby_low_resolve.rb +26 -31
  35. data/lib/HDLRuby/hruby_low_with_bool.rb +33 -16
  36. data/lib/HDLRuby/hruby_low_with_port.rb +3 -3
  37. data/lib/HDLRuby/hruby_low_with_var.rb +23 -9
  38. data/lib/HDLRuby/hruby_low_without_concat.rb +19 -13
  39. data/lib/HDLRuby/hruby_low_without_namespace.rb +47 -32
  40. data/lib/HDLRuby/hruby_low_without_parinseq.rb +18 -12
  41. data/lib/HDLRuby/hruby_low_without_select.rb +36 -23
  42. data/lib/HDLRuby/hruby_low_without_subsignals.rb +29 -28
  43. data/lib/HDLRuby/hruby_rcsim.rb +79 -64
  44. data/lib/HDLRuby/hruby_rsim.rb +64 -15
  45. data/lib/HDLRuby/hruby_rsim_mute.rb +2 -3
  46. data/lib/HDLRuby/hruby_rsim_vcd.rb +28 -25
  47. data/lib/HDLRuby/hruby_values.rb +13 -2
  48. data/lib/HDLRuby/hruby_verilog.rb +90 -48
  49. data/lib/HDLRuby/soft/stacks.rb +219 -0
  50. data/lib/HDLRuby/std/bram.rb +9 -5
  51. data/lib/HDLRuby/std/clocks.rb +1 -1
  52. data/lib/HDLRuby/std/fsm.rb +29 -9
  53. data/lib/HDLRuby/std/sequencer.rb +1857 -0
  54. data/lib/HDLRuby/std/sequencer_sync.rb +400 -0
  55. data/lib/HDLRuby/std/std.rb +12 -0
  56. data/lib/HDLRuby/version.rb +1 -1
  57. data/tuto/adder_sat_flags_vcd.png +0 -0
  58. data/tuto/addsub_vcd.png +0 -0
  59. data/tuto/alu_vcd.png +0 -0
  60. data/tuto/bit_pong_vcd.png +0 -0
  61. data/tuto/checksum_vcd.png +0 -0
  62. data/tuto/circuit_hdr.odg +0 -0
  63. data/tuto/circuit_hdr.png +0 -0
  64. data/tuto/circuit_hie.odg +0 -0
  65. data/tuto/circuit_hie.png +0 -0
  66. data/tuto/circuit_view.odg +0 -0
  67. data/tuto/circuit_view.png +0 -0
  68. data/tuto/clock_counter_vcd.png +0 -0
  69. data/tuto/counter_ext_vcd.png +0 -0
  70. data/tuto/fact_vcd.png +0 -0
  71. data/tuto/hw_flow.odg +0 -0
  72. data/tuto/hw_flow.png +0 -0
  73. data/tuto/maxxer_vcd.png +0 -0
  74. data/tuto/pingpong0_vcd.png +0 -0
  75. data/tuto/pingpong1_vcd.png +0 -0
  76. data/tuto/pingpong2_vcd.png +0 -0
  77. data/tuto/ram_vcd.png +0 -0
  78. data/tuto/serializer_vcd.png +0 -0
  79. data/tuto/sw_flow.odg +0 -0
  80. data/tuto/sw_flow.png +0 -0
  81. data/tuto/the_counter_vcd.png +0 -0
  82. data/tuto/tutorial_sw.html +2359 -0
  83. data/tuto/tutorial_sw.md +2684 -0
  84. data/tuto/tutorial_sw.pdf +0 -0
  85. data/tuto/tutorial_sw_jp.md +417 -0
  86. metadata +44 -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 show_hierarchyto block objects.
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.
@@ -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})" if op == :^
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.
@@ -279,6 +281,9 @@ module HDLRuby
279
281
  res_content.positive!
280
282
  end
281
283
  end
284
+ if type.signed && res_content.is_a?(Numeric) && res_content >= (1 << (type.width-1)) then
285
+ res_content = (-1 << type.width) + res_content
286
+ end
282
287
  # # truncs to the right size if necessary.
283
288
  # if res_content.is_a?(BitString) then
284
289
  # res_content.trunc!(type.width)
@@ -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
@@ -4,10 +4,8 @@ require "HDLRuby/hruby_verilog_name.rb"
4
4
  require 'HDLRuby/hruby_low_mutable'
5
5
 
6
6
 
7
- # module HDLRuby::Verilog
8
7
  include HDLRuby::Verilog
9
8
 
10
- #include HDLRuby::Low
11
9
  module HDLRuby::Low
12
10
 
13
11
 
@@ -38,12 +36,16 @@ module HDLRuby::Low
38
36
  $vector_reg = "" # For storing signal type at structure declaration. (temporary)
39
37
  $vector_cnt = 0 # For allocating numbers at structure declaration. (temporary)
40
38
 
39
+
41
40
  class ::Integer
41
+ ## Extends the Integer class with generation of verilog text.
42
+
42
43
  def to_verilog
43
44
  to_s
44
45
  end
45
46
  end
46
47
 
48
+
47
49
  # Class summarizing "hash" used for "par" or "seq" conversion.
48
50
  class Fm
49
51
  attr_reader :fm_seq, :fm_par, :rep, :rep_sharp
@@ -115,8 +117,9 @@ module HDLRuby::Low
115
117
  TruncersI = Truncers.new
116
118
 
117
119
 
118
- # A class that translates the left-hand side, operator, and right-hand side into form of expression.
119
120
  class Binary
121
+ ## Enhances Binary with verilog generation.
122
+
120
123
  # Converts the system to Verilog code.
121
124
  def to_verilog
122
125
  return "(#{self.left.to_verilog} #{self.operator} #{self.right.to_verilog})"
@@ -158,9 +161,10 @@ module HDLRuby::Low
158
161
  end
159
162
  end
160
163
 
161
- # class of Represent blocking substitution or nonblocking assignment.
162
- # Enhance Transmit with generation of verilog code.
164
+
163
165
  class Transmit
166
+ ## Enhances Transmit with generation of verilog code.
167
+
164
168
  # Converts the system to Verilog code.
165
169
  def to_verilog(spc = 3)
166
170
  # Determine blocking assignment or nonblocking substitution from mode and return it.
@@ -169,8 +173,10 @@ module HDLRuby::Low
169
173
  end
170
174
  end
171
175
 
172
- # Enhance Print with generation of verilog code.
176
+
173
177
  class Print
178
+ ## Enhances Print with generation of verilog code.
179
+
174
180
  # Converts the print to Verilog code.
175
181
  def to_verilog(spc = 3)
176
182
  code = "#{" " * spc}$write(#{self.each_arg.map do |arg|
@@ -180,17 +186,20 @@ module HDLRuby::Low
180
186
  end
181
187
  end
182
188
 
183
- # Enhance TimeTerminate with generation of verilog code.
189
+
184
190
  class TimeTerminate
191
+ ## Enhances TimeTerminate with generation of verilog code.
192
+
185
193
  # Converts the terminate to Verilog code.
186
194
  def to_verilog(spc = 3)
187
195
  return "#{" " * spc}$finish;"
188
196
  end
189
197
  end
190
198
 
191
- # To scheduling to the Block.
192
- # Enhance Block with generation of verilog code.
199
+
193
200
  class Block
201
+ ## Enhances Block with generation of verilog code.
202
+ # To scheduling to the Block.
194
203
 
195
204
  # Converts the system to Verilog code adding 'spc' spaces at the begining
196
205
  # of each line.
@@ -1439,9 +1448,10 @@ module HDLRuby::Low
1439
1448
  end
1440
1449
  end
1441
1450
 
1442
- # Used to display variable names.
1443
- # Enhance RefName with generation of verilog code.
1451
+
1444
1452
  class RefName
1453
+ ## Enhances RefName with generation of verilog code.
1454
+
1445
1455
  # Converts the system to Verilog code using +renamer+ for producing Verilog-compatible names.
1446
1456
  def to_verilog
1447
1457
  vname = name_to_verilog(self.name)
@@ -1463,9 +1473,10 @@ module HDLRuby::Low
1463
1473
  end
1464
1474
  end
1465
1475
 
1466
- # Used to convert an array.
1467
- # Enhance RefIndex with generation of verilog code.
1476
+
1468
1477
  class RefIndex
1478
+ ## Enhances RefIndex with generation of verilog code.
1479
+
1469
1480
  # Converts the system to Verilog code.
1470
1481
  def to_verilog
1471
1482
  return "#{self.ref.to_verilog}[#{self.index.to_verilog}]"
@@ -1473,9 +1484,9 @@ module HDLRuby::Low
1473
1484
  end
1474
1485
 
1475
1486
 
1476
- # Used to indicate the number of bits.
1477
- # Enhance TypeVector with generation of verilog code.
1478
1487
  class TypeVector
1488
+ ## Enhances TypeVector with generation of verilog code.
1489
+
1479
1490
  # Converts the system to Verilog code.
1480
1491
  def to_verilog
1481
1492
  # if self.base.name.to_s != "bit"
@@ -1486,16 +1497,22 @@ module HDLRuby::Low
1486
1497
  end
1487
1498
  end
1488
1499
 
1489
- # Necessary for displaying bit width (eg, specify and assign).
1500
+
1490
1501
  class RefRange
1502
+ ## Enhances RefRange with generation of verilog code.
1503
+
1504
+ # Necessary for displaying bit width (eg, specify and assign).
1505
+
1491
1506
  # Converts the system to Verilog code.
1492
1507
  def to_verilog(unknown = false)
1493
1508
  return "#{self.ref.to_verilog}[#{self.range.first.to_getrange}:#{self.range.last.to_getrange}]"
1494
1509
  end
1495
1510
  end
1496
1511
 
1497
- # Use it when collecting references.
1512
+
1498
1513
  class RefConcat
1514
+ ## Enhances RefConcat with generation of verilog code.
1515
+
1499
1516
  def to_verilog
1500
1517
  ref = self.each_ref.to_a
1501
1518
 
@@ -1509,18 +1526,20 @@ module HDLRuby::Low
1509
1526
  end
1510
1527
  end
1511
1528
 
1512
- # Used to output bitstring.
1513
- # Enhance HDLRuby with generation of verilog code.
1529
+
1514
1530
  class HDLRuby::BitString
1531
+ ## Enhances BitString with generation of verilog code.
1532
+
1515
1533
  # Converts the system to Verilog code.
1516
1534
  def to_verilog
1517
1535
  return "#{self.to_s}"
1518
1536
  end
1519
1537
  end
1520
1538
 
1521
- # Used for connection using choice.
1522
- # Enhance Select with generation of verilog code.
1539
+
1523
1540
  class Select
1541
+ ## Enhances Select with generation of verilog code.
1542
+
1524
1543
  # Converts the system to Verilog code.
1525
1544
  def to_verilog
1526
1545
  # Outputs the first and second choices (choice (0) and choice (1)).
@@ -1535,9 +1554,10 @@ module HDLRuby::Low
1535
1554
  end
1536
1555
  end
1537
1556
 
1538
- # Used to output numbers.
1539
- # Enhance Value with generation of verilog code.
1557
+
1540
1558
  class Value
1559
+ ## Enhances Value with generation of verilog code.
1560
+
1541
1561
  # Converts the system to Verilog code.
1542
1562
  # If it is bit, it is b, and if it is int, it is represented by d. (Example: 4'b0000, 32'd1)
1543
1563
  def to_verilog(unknown = nil)
@@ -1579,9 +1599,9 @@ module HDLRuby::Low
1579
1599
  end
1580
1600
 
1581
1601
 
1582
- # Used to transrate if.
1583
- # Enhance If with generation of verilog code.
1584
1602
  class If
1603
+ ## Enhances If with generation of verilog code.
1604
+
1585
1605
  # # Converts the system to Verilog code.
1586
1606
  # def to_verilog(mode = nil)
1587
1607
  # Converts to Verilog code, checking adding 'spc' spaces at the begining
@@ -1617,10 +1637,10 @@ module HDLRuby::Low
1617
1637
  end
1618
1638
  end
1619
1639
 
1620
- # Used to translate case
1640
+
1621
1641
  class Case
1622
- # def to_verilog(mode = nil)
1623
- #
1642
+ ## Enhances Case with generation of verilog code.
1643
+
1624
1644
  # Converts to Verilog code, checking if variables are register
1625
1645
  # or wire adding 'spc' spaces at the begining of each line.
1626
1646
  def to_verilog(spc = 3)
@@ -1656,9 +1676,10 @@ module HDLRuby::Low
1656
1676
  end
1657
1677
  end
1658
1678
 
1659
- # Translate expression of combination circuit.
1660
- # Enhance Connection with generation of verilog code.
1679
+
1661
1680
  class Connection
1681
+ ## Enhances Connection with generation of verilog code.
1682
+
1662
1683
  # Converts the system to Verilog code.
1663
1684
 
1664
1685
  # Method used for array.
@@ -1715,23 +1736,29 @@ module HDLRuby::Low
1715
1736
  end
1716
1737
  end
1717
1738
 
1718
- # It could be used for instantiation.
1739
+
1719
1740
  class RefThis
1741
+ ## Enhances RefThis with generation of verilog code.
1742
+
1720
1743
  def to_another_verilog
1721
1744
  return ""
1722
1745
  end
1723
1746
  end
1724
1747
 
1725
- # Used when using "~" for expressions.
1748
+
1726
1749
  class Unary
1750
+ ## Enhances Unary with generation of verilog code.
1751
+
1727
1752
  # Converts the system to Verilog code.
1728
1753
  def to_verilog
1729
1754
  return "#{self.operator[0]}#{self.child.to_verilog}"
1730
1755
  end
1731
1756
  end
1732
1757
 
1733
- # Used when casting expressions.
1758
+
1734
1759
  class Cast
1760
+ ## Enhances Cast with generation of verilog code.
1761
+
1735
1762
  # Converts the system to Verilog code.
1736
1763
  # NOTE: the cast is rounded up size bit-width cast is not supported
1737
1764
  # by traditional verilog.
@@ -1773,9 +1800,10 @@ module HDLRuby::Low
1773
1800
  end
1774
1801
  end
1775
1802
 
1776
- # For declaring variables.
1777
- # Enhance SignalI with generation of verilog code.
1803
+
1778
1804
  class SignalI
1805
+ ## Enhances SignalI with generation of verilog code.
1806
+
1779
1807
  # Converts the system to Verilog code.
1780
1808
  def to_verilog
1781
1809
  # Convert unusable characters and return them.
@@ -1785,25 +1813,30 @@ module HDLRuby::Low
1785
1813
  end
1786
1814
  end
1787
1815
 
1788
- # If it is signed, it outputs signed.
1789
- # Enhance Type with generation of verilog code.
1816
+
1790
1817
  class Type
1818
+ ## Enhances Type with generation of verilog code.
1819
+
1791
1820
  # Converts the type to Verilog code.
1792
1821
  def to_verilog
1793
1822
  return self.name == :signed ? "#{self.name.to_s} " : ""
1794
1823
  end
1795
1824
  end
1796
1825
 
1797
- # Replace type by refered type.
1826
+
1798
1827
  class TypeDef
1828
+ ## Enhances TypeDef with generation of verilog code.
1829
+
1799
1830
  # Converts the type to verilog code.
1800
1831
  def to_verilog
1801
1832
  return self.def.to_verilog
1802
1833
  end
1803
1834
  end
1804
1835
 
1805
- # Use it when collecting.
1836
+
1806
1837
  class Concat
1838
+ ## Enhances Concat with generation of verilog code.
1839
+
1807
1840
  def to_verilog
1808
1841
  expression = self.each_expression.to_a
1809
1842
 
@@ -1817,14 +1850,19 @@ module HDLRuby::Low
1817
1850
  end
1818
1851
  end
1819
1852
 
1820
- # Look at the unit of time, convert the time to ps and output it.
1821
- # One of two people, TimeWait and Delay.
1853
+
1822
1854
  class TimeWait
1855
+ ## Enhances TimeWait with generation of verilog code.
1856
+
1823
1857
  def to_verilog(spc = 3)
1824
1858
  return (" " * spc) + self.delay.to_verilog + "\n"
1825
1859
  end
1826
1860
  end
1861
+
1862
+
1827
1863
  class Delay
1864
+ ## Enhances Delay with generation of verilog code.
1865
+
1828
1866
  def to_verilog
1829
1867
  time = self.value.to_s
1830
1868
  if(self.unit.to_s == "ps") then
@@ -1842,8 +1880,9 @@ module HDLRuby::Low
1842
1880
  end
1843
1881
 
1844
1882
 
1845
- # Generate verilog code for the TimeRepeat.
1846
1883
  class TimeRepeat
1884
+ ## Enhances TimeRepeat with generation of verilog code.
1885
+
1847
1886
  def to_verilog(spc = 3)
1848
1887
  result = (" " * spc) + "repeat(#{self.number})" + "\n"
1849
1888
  result << self.statement.to_verilog(spc+3)
@@ -1855,8 +1894,9 @@ module HDLRuby::Low
1855
1894
  #class TypeTuple
1856
1895
  #class Event
1857
1896
 
1858
- # Enhance SystemT with generation of verilog code.
1897
+
1859
1898
  class SystemT
1899
+ ## Enhances SystemT with generation of verilog code.
1860
1900
 
1861
1901
  ## Tells if a connection is actually a port connection.
1862
1902
  def port_output_connection?(connection)
@@ -2163,9 +2203,10 @@ module HDLRuby::Low
2163
2203
  codeC << "),"
2164
2204
  end
2165
2205
  end
2166
- # Remove the last "," for conforming with Verilog syntax.
2167
- # and close the port connection.
2168
- codeC[-1] = ");\n"
2206
+ # Remove the last "," if any for conforming with Verilog syntax.
2207
+ codeC.chop! if codeC[-1] == ","
2208
+ # And close the port connection.
2209
+ codeC << ");\n"
2169
2210
  end
2170
2211
 
2171
2212
 
@@ -2254,8 +2295,9 @@ module HDLRuby::Low
2254
2295
  end
2255
2296
 
2256
2297
 
2257
- # Enhance StringE with generation of verilog code.
2258
2298
  class StringE
2299
+ ## Enhances stringE with generation of verilog code.
2300
+
2259
2301
  # Converts the system to Verilog code.
2260
2302
  def to_verilog(spc = 3)
2261
2303
  code = "\"#{Low.v_string(self.content)}" +
@@ -2270,8 +2312,8 @@ end
2270
2312
 
2271
2313
 
2272
2314
 
2273
- ## Extends the Numeric class with generation of verilog text.
2274
2315
  class ::Numeric
2316
+ ## Extends the Numeric class with generation of verilog text.
2275
2317
 
2276
2318
  # Generates the text of the equivalent verilog code.
2277
2319
  # +level+ is the hierachical level of the object.