HDLRuby 2.2.5 → 2.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 970d857a0599c47d617e6a3d4be7720134a33adc009a3c069332fa198ef05a3f
4
- data.tar.gz: a81688812f9a76bf80a56d2d3aabb59caf507dd3cd4897d37ced83c3f2319f03
3
+ metadata.gz: 586ce6da5943ec0473a7849a515c9a673d3467e1acb5a5214cbccc0794e33848
4
+ data.tar.gz: fd6d45a53a35154b4936a9e146028e74fa2b351185a6f7f0f87e16b884188a42
5
5
  SHA512:
6
- metadata.gz: 1b2e23d1c84cb1a7e4e3bcb16b90f409caaa6ded6855b85590ee10de2d378976f44f35612b955b710ed4dc7bd7b316b0a3c2e1a1d1a1b8a74a34051e49b3459b
7
- data.tar.gz: 92c75812d649592042da377556762c64aa43d2c2ceca6515f3424cec41c0e79ed2c81880f7e566cb6ea5ffdbb9c6d3f1106ae8c1750b38fe4283e4c5c4f0648b
6
+ metadata.gz: 9cd1a599cadb487012df47fcce184de6b5eab1d64a631869ad508ce52833ebbaa1320dd692d3657f30e0b8cb50829d001f2529161f0255963969469a1b1338e3
7
+ data.tar.gz: e71c9dff6b99b9a037b9d8e7a14ca5adb757ca4a21e45481c4816b26e909f92db221e1acdbad1d53ceb65b04f207e3b07b95b0f08745681d856b1eee44f234b5
@@ -86,14 +86,28 @@ module HDLRuby::Low
86
86
  outputs_blk.add_statement(
87
87
  Transmit.new(left.clone,right.clone))
88
88
  else
89
- # puts "left/right is inout"
89
+ # # puts "left/right is inout"
90
+ # if (left.is_a?(Ref)) then
91
+ # inputs_blk.add_statement(
92
+ # Transmit.new(left.clone,right.clone))
93
+ # end
94
+ # if (right.is_a?(Ref)) then
95
+ # outputs_blk.add_statement(
96
+ # Transmit.new(right.clone,left.clone))
97
+ # end
98
+ # Both or neither input/output, make a behavior
99
+ # for each.
90
100
  if (left.is_a?(Ref)) then
91
- inputs_blk.add_statement(
101
+ blk = Block.new(:par)
102
+ blk.add_statement(
92
103
  Transmit.new(left.clone,right.clone))
104
+ scope.add_behavior(Behavior.new(blk))
93
105
  end
94
106
  if (right.is_a?(Ref)) then
95
- outputs_blk.add_statement(
107
+ blk = Block.new(:par)
108
+ blk.add_statement(
96
109
  Transmit.new(right.clone,left.clone))
110
+ scope.add_behavior(Behavior.new(blk))
97
111
  end
98
112
  end
99
113
  end
@@ -1446,7 +1446,7 @@ class If
1446
1446
  # If noif (else if) exists, it outputs it.
1447
1447
  # Since noif is directly under, respond_to is unnecessary.
1448
1448
  self.each_noif do |condition, block|
1449
- result << "#{" " * $space_count} else if (#{condition.to_verilog})\n"
1449
+ result << "#{" " * $space_count} else if (#{condition.to_verilog}) begin\n"
1450
1450
  block.each_statement do |statement|
1451
1451
  result << "#{" " * $space_count} #{statement.to_verilog(mode)}"
1452
1452
  end
@@ -585,6 +585,22 @@ static Value sub_value_bitstring(Value src0, Value src1, Value dst) {
585
585
  }
586
586
 
587
587
 
588
+ /** Computes the multiplication of two defined bitstring values.
589
+ * @param src0 the first source value of the addition
590
+ * @param src1 the second source value of the addition
591
+ * @param dst the destination value
592
+ * @return dst */
593
+ static Value mul_value_defined_bitstring(Value src0, Value src1, Value dst) {
594
+ /* Sets state of the destination using the first source. */
595
+ dst->type = src0->type;
596
+ dst->numeric = 1;
597
+
598
+ /* Perform the addition. */
599
+ dst->data_int = value2integer(src0) * value2integer(src1);
600
+ return dst;
601
+ }
602
+
603
+
588
604
  /** Computes the NOT of a bitstring value.
589
605
  * @param src the source value of the not
590
606
  * @param dst the destination value
@@ -1803,8 +1819,14 @@ Value mul_value(Value src0, Value src1, Value dst) {
1803
1819
  if (src0->numeric && src1->numeric) {
1804
1820
  /* Both sources are numeric. */
1805
1821
  return mul_value_numeric(src0,src1,dst);
1822
+ } else if (is_defined_value(src0) && is_defined_value(src1)) {
1823
+ /* Both sources can be converted to numeric values. */
1824
+ return mul_value_defined_bitstring(src0,src1,dst);
1806
1825
  } else {
1807
1826
  /* Cannot compute (for now), simply undefines the destination. */
1827
+ /* First ensure dst has the right shape. */
1828
+ copy_value(src0,dst);
1829
+ /* Then make it undefined. */
1808
1830
  set_undefined_bitstring(dst);
1809
1831
  }
1810
1832
  return dst;
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.2.5"
2
+ VERSION = "2.2.6"
3
3
  end
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.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-11 00:00:00.000000000 Z
11
+ date: 2020-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler