HDLRuby 2.3.3 → 2.3.4

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: 6548ba8f8c1572f8aa254b168eab065bc5d0a06ac996d792b4082a9243a2dfc9
4
- data.tar.gz: 97891dad52f2454d37755af82cf6d23b2665cccd39a44caff81701921f233931
3
+ metadata.gz: b9bca5842e518422f5e7b7edb864a8eae5955df19238cd9582a776d4ef6c7a1e
4
+ data.tar.gz: 6c094ebf5d69c8dbf57ddd800eca16aca88b4bc324db11eecac3f15569b633e3
5
5
  SHA512:
6
- metadata.gz: 6df258eebc8a3448824aca9bf39d24ad98c9302728c2584bb34880b8160b42a00f6b7e0fed68a4097403046e0621bf16c8048c43ce95090254f4e9e6e1ebc079
7
- data.tar.gz: 73cc373d53e91a756922c8539f15283f793db0ce6e1b3e7c2ae566ae6e2c19691ee62d7dd3ac5ca1f1e19c61a809ab234aba3c790ae207327f8cd2609c76816f
6
+ metadata.gz: f01e2f703bcade0db355c42e78267205ca3662c8b30589c5676eab6acaf334fac2a86205b600122e50f11eef3e6a17182dacb59b9a7821c3fa9d7aed90ebd6b7
7
+ data.tar.gz: 5c3b80eddb70a3f25f2941bc26c8e95a8f3a30f5020cb17d6a4a199678aacaab4ce0c5c4ffcd347c23b53bd86fb15d58392818673e57ca3d108aec0c5b062ed0
@@ -1946,7 +1946,9 @@ module HDLRuby::Low
1946
1946
  # Generates the C text for reference as left value to a signal.
1947
1947
  # +level+ is the hierarchical level of the object.
1948
1948
  def to_c_signal(level = 0)
1949
- return to_c(level,true)
1949
+ # return to_c(level,true)
1950
+ return "make_ref_rangeS(#{self.ref.to_c_signal(level)}," +
1951
+ "value2integer(#{self.range.first.to_c(level)}),value2integer(#{self.range.last.to_c(level)}))"
1950
1952
  end
1951
1953
  end
1952
1954
 
@@ -612,14 +612,18 @@ extern Value read_range(Value value, long long first, long long last,
612
612
  * @param src the source value
613
613
  * @param first the first index of the range
614
614
  * @param last the last index of the range
615
+ * @param base the type of the elements
615
616
  * @param dst the destination value
616
617
  * @return dst */
617
- extern Value write_range(Value src, long long first, long long last, Value dst);
618
+ extern Value write_range(Value src, long long first, long long last,
619
+ Type base, Value dst);
618
620
 
619
621
  /** Writes to a range within a value but without overwrite with Z.
620
622
  * @param src the source value
621
623
  * @param first the first index of the range
622
624
  * @param last the last index of the range
625
+ * @param base the type of the elements
623
626
  * @param dst the destination value
624
627
  * @return dst */
625
- extern Value write_range_no_z(Value src, long long first, long long last, Value dst);
628
+ extern Value write_range_no_z(Value src, long long first, long long last,
629
+ Type base, Value dst);
@@ -1354,10 +1354,11 @@ Value read_range_bitstring(Value src, long long first, long long last,
1354
1354
  * @param src the source value
1355
1355
  * @param first the first index of the range
1356
1356
  * @param last the last index of the range
1357
+ * @param base the type of the elements
1357
1358
  * @param dst the destination value
1358
1359
  * @return dst */
1359
1360
  Value write_range_bitstring(Value src, long long first, long long last,
1360
- Value dst) {
1361
+ Type base, Value dst) {
1361
1362
  unsigned long long i;
1362
1363
  /* Ensure first is the smaller. */
1363
1364
  if (first > last) {
@@ -1370,7 +1371,8 @@ Value write_range_bitstring(Value src, long long first, long long last,
1370
1371
  unsigned long long src_width = type_width(src->type);
1371
1372
  unsigned long long dst_width = type_width(dst->type);
1372
1373
  /* scale the range according to the base type. */
1373
- unsigned long long bw = dst->type->base;
1374
+ // unsigned long long bw = dst->type->base;
1375
+ unsigned long long bw = type_width(base);
1374
1376
  first *= bw;
1375
1377
  last *= bw;
1376
1378
  last += bw-1;
@@ -1391,10 +1393,11 @@ Value write_range_bitstring(Value src, long long first, long long last,
1391
1393
  * @param src the source value
1392
1394
  * @param first the first index of the range
1393
1395
  * @param last the last index of the range
1396
+ * @param base the type of the elements
1394
1397
  * @param dst the destination value
1395
1398
  * @return dst */
1396
1399
  Value write_range_bitstring_no_z(Value src, long long first, long long last,
1397
- Value dst) {
1400
+ Type base, Value dst) {
1398
1401
  unsigned long long i;
1399
1402
  /* Ensure first is the smaller. */
1400
1403
  if (first > last) {
@@ -1406,7 +1409,8 @@ Value write_range_bitstring_no_z(Value src, long long first, long long last,
1406
1409
  unsigned long long src_width = type_width(src->type);
1407
1410
  unsigned long long dst_width = type_width(dst->type);
1408
1411
  /* scale the range according to the base type. */
1409
- unsigned long long bw = dst->type->base;
1412
+ // unsigned long long bw = dst->type->base;
1413
+ unsigned long long bw = type_width(base);
1410
1414
  first *= bw;
1411
1415
  last *= bw;
1412
1416
  /* Access the source and destination bitstring data. */
@@ -1864,10 +1868,11 @@ Value read_range_numeric(Value value, long long first, long long last,
1864
1868
  * @param src the source value
1865
1869
  * @param first the first index of the range
1866
1870
  * @param last the last index of the range
1871
+ * @param base the type of the elements
1867
1872
  * @param dst the destination value
1868
1873
  * @return dst */
1869
1874
  Value write_range_numeric(Value src, long long first, long long last,
1870
- Value dst) {
1875
+ Type base, Value dst) {
1871
1876
  // printf("write_range_numeric\n");
1872
1877
  /* Ensure first is the smaller. */
1873
1878
  if (first > last) {
@@ -1879,7 +1884,8 @@ Value write_range_numeric(Value src, long long first, long long last,
1879
1884
  unsigned long long src_width = type_width(src->type);
1880
1885
  unsigned long long dst_width = type_width(dst->type);
1881
1886
  /* scale the range according to the base type of the destination. */
1882
- unsigned long long bw = dst->type->base;
1887
+ // unsigned long long bw = dst->type->base;
1888
+ unsigned long long bw = type_width(base);
1883
1889
  // printf("src_width=%llu dst_wdith=%llu bw=%llu\n",src_width,dst_width,bw);
1884
1890
  first *= bw;
1885
1891
  last *= bw;
@@ -2691,14 +2697,17 @@ Value read_range(Value value, long long first, long long last, Type base,
2691
2697
  * @param src the source value
2692
2698
  * @param first the first index of the range
2693
2699
  * @param last the last index of the range
2700
+ * @param base the type of the elements
2694
2701
  * @param dst the destination value
2695
2702
  * @return dst */
2696
- Value write_range(Value src, long long first, long long last, Value dst) {
2703
+ Value write_range(Value src, long long first, long long last, Type base,
2704
+ Value dst) {
2697
2705
  // printf("write_range\n");
2698
2706
  /* Is the value numeric? */
2699
2707
  if ((src->numeric) && (dst->numeric)) {
2700
2708
  /* Yes, do a numeric range read. */
2701
- return write_range_numeric(src,first,last,dst);
2709
+ // return write_range_numeric(src,first,last,dst);
2710
+ return write_range_numeric(src,first,last,base,dst);
2702
2711
  } else {
2703
2712
  /* No, do a bitstring range read. */
2704
2713
  if (dst->numeric) {
@@ -2708,7 +2717,8 @@ Value write_range(Value src, long long first, long long last, Value dst) {
2708
2717
  /* Need to convert the source to a bitstring. */
2709
2718
  src = set_bitstring_value(src,get_value());
2710
2719
  }
2711
- return write_range_bitstring(src,first,last,dst);
2720
+ // return write_range_bitstring(src,first,last,dst);
2721
+ return write_range_bitstring(src,first,last,base,dst);
2712
2722
  }
2713
2723
  }
2714
2724
 
@@ -2717,14 +2727,16 @@ Value write_range(Value src, long long first, long long last, Value dst) {
2717
2727
  * @param src the source value
2718
2728
  * @param first the first index of the range
2719
2729
  * @param last the last index of the range
2730
+ * @param base the type of the elements
2720
2731
  * @param dst the destination value
2721
2732
  * @return dst */
2722
- Value write_range_no_z(Value src, long long first, long long last, Value dst) {
2733
+ Value write_range_no_z(Value src, long long first, long long last, Type base,
2734
+ Value dst) {
2723
2735
  // printf("write_range_no_z\n");
2724
2736
  /* Is the value numeric? */
2725
2737
  if ((src->numeric) && (dst->numeric)) {
2726
2738
  /* Yes, do a numeric range read. */
2727
- return write_range_numeric(src,first,last,dst);
2739
+ return write_range_numeric(src,first,last,base,dst);
2728
2740
  } else {
2729
2741
  /* No, do a bitstring range read. */
2730
2742
  if (dst->numeric) {
@@ -2734,7 +2746,8 @@ Value write_range_no_z(Value src, long long first, long long last, Value dst) {
2734
2746
  /* Need to convert the source to a bitstring. */
2735
2747
  src = set_bitstring_value(src,get_value());
2736
2748
  }
2737
- return write_range_bitstring_no_z(src,first,last,dst);
2749
+ // return write_range_bitstring_no_z(src,first,last,dst);
2750
+ return write_range_bitstring_no_z(src,first,last,base,dst);
2738
2751
  }
2739
2752
  }
2740
2753
 
@@ -499,12 +499,18 @@ void transmit_to_signal_range(Value value, RefRangeS ref) {
499
499
  SignalI signal = ref.signal;
500
500
  unsigned long long first = ref.first;
501
501
  unsigned long long last = ref.last;
502
+ /* The base type is stored here to avoid allocating a new type each time.
503
+ * It have an arbitrary base size a single element. */
504
+ static TypeS baseT = { 1, 1 };
505
+ baseT.base = signal->f_value->type->base;
502
506
  // printf("Tansmit to signal range: %s(%p) [%lld:%lld]\n",signal->name,signal,first,last);
503
507
  /* Can transmit, copy the content. */
504
508
  if (signal->fading)
505
- signal->f_value = write_range(value,first,last,signal->f_value);
509
+ signal->f_value = write_range(value,first,last,&baseT,
510
+ signal->f_value);
506
511
  else
507
- signal->f_value = write_range_no_z(value,first,last,signal->f_value);
512
+ signal->f_value = write_range_no_z(value,first,last,&baseT,
513
+ signal->f_value);
508
514
  /* And touch the signal. */
509
515
  touch_signal(signal);
510
516
  }
@@ -553,9 +559,9 @@ void transmit_to_signal_range_seq(Value value, RefRangeS ref) {
553
559
  // printf("Tansmit to signal range: %s(%p)\n",signal->name,signal);
554
560
  /* Can transmit, copy the content. */
555
561
  if (signal->fading)
556
- write_range(value,first,last,signal->f_value);
562
+ write_range(value,first,last,signal->f_value->type,signal->f_value);
557
563
  else
558
- write_range_no_z(value,first,last,signal->f_value);
564
+ write_range_no_z(value,first,last,signal->f_value->type,signal->f_value);
559
565
  /* And touch the signal. */
560
566
  touch_signal_seq(signal);
561
567
  }
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.3.3"
2
+ VERSION = "2.3.4"
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.3.3
4
+ version: 2.3.4
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-08-09 00:00:00.000000000 Z
11
+ date: 2020-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler