HDLRuby 3.9.3 → 3.9.5

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: 28b1202930bb068b286b20287846f5c89bbdc4b7a2361aad7719252fa23f72a9
4
- data.tar.gz: 612ee6e9bfacfa5f670a138adf77c9924a182f1ea4ad7b48a1c5d25a49aabf89
3
+ metadata.gz: 2158fa1453147b4f00983a8e182f592a7878a3314fdabb351e79da00c99eb875
4
+ data.tar.gz: db538f8d85886189c4d309acf9ed6e5e9239e0bbe7a7b380c22a768d20eca52f
5
5
  SHA512:
6
- metadata.gz: 53a81f6c68706a774377e4b2bb5de7b2c9e0432150c8b98803d26208b1ed195d164d1bbcbe0d9ba9824ed5624d82ccfc35e35b104f251da84300a7b38d255fd2
7
- data.tar.gz: 16d7a500401513cd49550d58204497735f70540d09230701a9222fac24c515bb7a7bc10e30a118fc4bcf2a6b49f38578b4ce914abf3e0affdb7bfa6ea93e8e64
6
+ metadata.gz: 210bf9b4b29db252d1c7364d70aea07473381e8eb5500cf936edae1f01cd67d37cff69e5cff9391b65b6265b3e8261f87ec8335b75cae577379fe70304f0ef78
7
+ data.tar.gz: 7c4e9e1ff74dcba76224505182b506363f772795a45e1608918d4b60648faed104b3776fdb459964e9900633448bbdb59af6c8259e309d9da329f6834c250f8b
data/README.md CHANGED
@@ -71,7 +71,14 @@ hdrcc --get-tuto
71
71
 
72
72
  __What's New__
73
73
 
74
- For HDKRuby version 3.9.2:
74
+ For HDLRuby version 3.9.3/3.9.4/3.9.5:
75
+
76
+ * Improved the graphical representation of the RTL code in SVG format for faster generation and better rendering. The tool is still experimental though.
77
+
78
+ * Fixed various bugs.
79
+
80
+
81
+ For HDLRuby version 3.9.2:
75
82
 
76
83
  * Added the `hbreak` command for exiting parallel enumerator loops.
77
84
 
@@ -688,6 +688,7 @@ VALUE rcsim_make_value_numeric(VALUE mod, VALUE typeV, VALUE contentV) {
688
688
  /* Get the type. */
689
689
  Type type;
690
690
  value_to_rcsim(TypeS,typeV,type);
691
+ // printf("type=%llu\n",type_width(type));
691
692
  /* Create the value. */
692
693
  Value value = make_value(type,0);
693
694
  // printf("value=%p\n",value);
@@ -703,6 +704,28 @@ VALUE rcsim_make_value_numeric(VALUE mod, VALUE typeV, VALUE contentV) {
703
704
  return res;
704
705
  }
705
706
 
707
+ /* Creating a numeric value C object forcing bit 63 to one. */
708
+ VALUE rcsim_make_value_numeric_63one(VALUE mod, VALUE typeV, VALUE contentV) {
709
+ // printf("rcsim_make_value_numeric_63one\n");
710
+ /* Get the type. */
711
+ Type type;
712
+ value_to_rcsim(TypeS,typeV,type);
713
+ // printf("type=%llu\n",type_width(type));
714
+ /* Create the value. */
715
+ Value value = make_value(type,0);
716
+ // printf("value=%p\n",value);
717
+ /* Set it to numeric. */
718
+ value->numeric = 1;
719
+ value->capacity = 0;
720
+ value->data_str = NULL;
721
+ value->data_int = NUM2LL(contentV) | 0x8000000000000000ULL;
722
+ // printf("value->data_int=%lld\n",value->data_int);
723
+ /* Returns the C value embedded into a ruby VALUE. */
724
+ VALUE res;
725
+ rcsim_to_value(ValueS,value,res);
726
+ return res;
727
+ }
728
+
706
729
 
707
730
  /* Creating a bitstring value C object. */
708
731
  VALUE rcsim_make_value_bitstring(VALUE mod, VALUE typeV, VALUE contentV) {
@@ -1906,6 +1929,7 @@ void Init_hruby_sim() {
1906
1929
  rb_define_singleton_method(mod,"rcsim_make_hcase",rcsim_make_hcase,2);
1907
1930
  rb_define_singleton_method(mod,"rcsim_make_block",rcsim_make_block,1);
1908
1931
  rb_define_singleton_method(mod,"rcsim_make_value_numeric",rcsim_make_value_numeric,2);
1932
+ rb_define_singleton_method(mod,"rcsim_make_value_numeric_63one",rcsim_make_value_numeric_63one,2);
1909
1933
  rb_define_singleton_method(mod,"rcsim_make_value_bitstring",rcsim_make_value_bitstring,2);
1910
1934
  rb_define_singleton_method(mod,"rcsim_make_cast",rcsim_make_cast,2);
1911
1935
  rb_define_singleton_method(mod,"rcsim_make_unary",rcsim_make_unary,3);
@@ -327,6 +327,7 @@ Value copy_value(Value src, Value dst) {
327
327
  /* Copy the data. */
328
328
  if (src->numeric) {
329
329
  /* Numeric copy. */
330
+ // printf("copy_value with data_in: %llu\n", src->data_int);
330
331
  dst->data_int = fix_numeric_type(dst->type,src->data_int);
331
332
  } else {
332
333
  // printf("copy_value with bit string: %.*s\n",src->capacity,src->data_str);
@@ -2166,7 +2167,6 @@ fix_numeric_type(Type type, unsigned long long val) {
2166
2167
  if (type->flags.sign) {
2167
2168
  /* Yes, perform sign extension. */
2168
2169
  int is_neg = (val >> (width-1)) & 1;
2169
- // printf("is_neg=%i\n",is_neg);
2170
2170
  if (is_neg) {
2171
2171
  /* Negative sign extension. */
2172
2172
  return val | mask;
@@ -16,8 +16,8 @@ system :dff_bench do
16
16
  [8].inner :count
17
17
  [8].constant inc: 5
18
18
 
19
- # counter(:my_counter).(clk,rst,inc,count)
20
- counter(:my_counter).(clk,rst,5,count)
19
+ counter(:my_counter).(clk,rst,inc,count)
20
+ # counter(:my_counter).(clk,rst,5,count)
21
21
 
22
22
  # par do
23
23
  # my_counter.inc <= 5
@@ -5604,7 +5604,7 @@ module HDLRuby::High
5604
5604
  # Check the value
5605
5605
  return nil unless value.match(/^[0-9]+$/)
5606
5606
  # Compute it (base 10 values cannot be 4-state!)
5607
- value = value.to_i.to_s(2)
5607
+ value = value.to_i.to_s(2).rjust(width,"0")
5608
5608
  when "h" then
5609
5609
  # base 16, compute the width
5610
5610
  width = width ? width.to_i : value.size * 4
@@ -156,7 +156,7 @@ module HDLRuby::Low
156
156
  blk = self.block
157
157
  sig = blk ? blk.get_signal_up(expr.ref.name) :
158
158
  self.scope.get_signal_up(expr.ref.name)
159
- sig.split_to_index(expr,expr.index,res)
159
+ sig.split_to_index(expr,expr.index,res) if sig
160
160
  elsif expr.is_a?(RefRange) and expr.ref.is_a?(RefName) and
161
161
  expr.range.first.is_a?(Value) and
162
162
  expr.range.last.is_a?(Value) then
@@ -164,7 +164,7 @@ module HDLRuby::Low
164
164
  blk = self.block
165
165
  sig = blk ? blk.get_signal_up(expr.ref.name) :
166
166
  self.scope.get_signal_up(expr.ref.name)
167
- sig.split_to_range(expr,expr.range,res)
167
+ sig.split_to_range(expr,expr.range,res) if sig
168
168
  end
169
169
  end
170
170
  end
@@ -904,8 +904,13 @@ module HDLRuby::High
904
904
  return RCSim.rcsim_make_value_numeric(self.type.to_rcsim,
905
905
  self.content)
906
906
  else
907
+ if (self.content >= 0 and self.content & 0x8000_0000_0000_0000 == 0) then
907
908
  return RCSim.rcsim_make_value_numeric(self.type.to_rcsim,
908
- self.content & 0xFFFFFFFFFFFF)
909
+ self.content & 0x7FFF_FFFF_FFFF_FFFF)
910
+ else
911
+ return RCSim.rcsim_make_value_numeric_63one(self.type.to_rcsim,
912
+ self.content & 0x7FFF_FFFF_FFFF_FFFF)
913
+ end
909
914
  end
910
915
  else
911
916
  if self.content < 0 then