HDLRuby 2.6.24 → 2.6.25

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: 935f56ddd3e2db8f8cd72ae2d8156af2dbf9c1961be139a1b2c4f27b2e0d483c
4
- data.tar.gz: 5a6d8a611f8cf6e0e9ae859721a26b2940c569436479f74f01cced46b741d810
3
+ metadata.gz: a207f3222cab832d2b846f9658ea0cf9426e77afd14196c2db8cb6832bd4ebda
4
+ data.tar.gz: 490c8a6400d6faac77cec5ab1e49caa3abd94d4d0961521ec14d485cad640b72
5
5
  SHA512:
6
- metadata.gz: c2df833c800000df44afdd2178414f6a282b4f597ec6d6b000a26e15ddff990f3ad0784e8d93d1dc75c4948f638824ea12a731340e896c8eb976ad83a61ff6eb
7
- data.tar.gz: 84b29e842be879ed848aeb475f80cc34654a31d0ca0fbfa45093082374dca6a90ad8dce3b1774ae339d1c962fcf63a81e5821bddd924ea6be84f2a6f8b566e84
6
+ metadata.gz: '08196d385fb34444cc7387f6b4982063c38e98e10e51e3b58551b0a6b62dac6921fcbb9c7a89aaccabea055ecab0d2da0543667f688d52bd7ea6b875d9db5ebd'
7
+ data.tar.gz: c22296c840a2a7a52b8f4bd8bc34dc38c53f571feba0a01f1bb17a2f548c2965947916fcf47b95b33f2293f1481d8b91653d855c21708a746245cebffebc72f4
@@ -0,0 +1,30 @@
1
+ # Test the comparison operators.
2
+
3
+ # A benchmark for the case statement.
4
+ system :if_bench do
5
+ [8].inner :x, :y
6
+
7
+ par do
8
+ hcase(x)
9
+ hwhen(0) { y <= _10000000 }
10
+ hwhen(1) { y <= _10000001 }
11
+ hwhen(2) { y <= _10000010 }
12
+ hwhen(3) { y <= _10000011 }
13
+ helse { y <= _00000000 }
14
+ end
15
+
16
+ timed do
17
+ x <= 0
18
+ !10.ns
19
+ x <= 1
20
+ !10.ns
21
+ x <= 2
22
+ !10.ns
23
+ x <= 3
24
+ !10.ns
25
+ x <= 4
26
+ !10.ns
27
+ x <= 5
28
+ !10.ns
29
+ end
30
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  function :func do |addr|
5
- bit[4][-4].constant tbl: [ _0000, _0001, _0010, _0011 ]
5
+ bit[4][-4].constant tbl: [ _1000, _1001, _1010, _1011 ]
6
6
 
7
7
  tbl[addr]
8
8
  end
@@ -0,0 +1,24 @@
1
+ # Test the comparison operators.
2
+
3
+ # A benchmark for the if statement.
4
+ system :if_bench do
5
+ [8].inner :x, :y, :z
6
+
7
+ par do
8
+ hif(x == y) { z <= 1 }
9
+ helsif(x < y) { z <= 2 }
10
+ helse { z <= 3 }
11
+ end
12
+
13
+ timed do
14
+ x <= 0
15
+ y <= 0
16
+ !10.ns
17
+ x <= 1
18
+ !10.ns
19
+ y <= 2
20
+ !10.ns
21
+ x <= 2
22
+ !10.ns
23
+ end
24
+ end
@@ -0,0 +1,37 @@
1
+ # Test the comparison operators.
2
+
3
+ # A benchmark for the index access..
4
+ system :if_bench do
5
+ [8].inner :x
6
+ inner :b0,:b1,:b2,:b3,:b4,:b5,:b6,:b7
7
+
8
+ par do
9
+ b0 <= x[0]
10
+ b1 <= x[1]
11
+ b2 <= x[2]
12
+ b3 <= x[3]
13
+ b4 <= x[4]
14
+ b5 <= x[5]
15
+ b6 <= x[6]
16
+ b7 <= x[7]
17
+ end
18
+
19
+ timed do
20
+ x <= 0
21
+ !10.ns
22
+ x <= 1
23
+ !10.ns
24
+ x <= 2
25
+ !10.ns
26
+ x <= 3
27
+ !10.ns
28
+ x <= 4
29
+ !10.ns
30
+ x <= 5
31
+ !10.ns
32
+ x[7] <= 1
33
+ !10.ns
34
+ x[6] <= 1
35
+ !10.ns
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ # Test the comparison operators.
2
+
3
+ # A benchmark for the index access..
4
+ system :if_bench do
5
+ [8].inner :x
6
+ [2].inner :r0,:r1,:r2,:r3
7
+
8
+ par do
9
+ r0 <= x[1..0]
10
+ r1 <= x[3..2]
11
+ r2 <= x[5..4]
12
+ r3 <= x[7..6]
13
+ end
14
+
15
+ timed do
16
+ x <= 0
17
+ !10.ns
18
+ x <= 1
19
+ !10.ns
20
+ x <= 2
21
+ !10.ns
22
+ x <= 3
23
+ !10.ns
24
+ x <= 4
25
+ !10.ns
26
+ x <= 5
27
+ !10.ns
28
+ x <= 6
29
+ !10.ns
30
+ x <= 7
31
+ !10.ns
32
+ x <= 8
33
+ !10.ns
34
+ x <= 81
35
+ !10.ns
36
+ x <= 123
37
+ !10.ns
38
+ x <= 0
39
+ !10.ns
40
+ x[7..6] <= 3
41
+ !10.ns
42
+ x[5..4] <= 2
43
+ !10.ns
44
+ x[3..2] <= 1
45
+ !10.ns
46
+ end
47
+ end
@@ -0,0 +1,30 @@
1
+
2
+ # A benchmark for testing the casts.
3
+ system :with_cast do
4
+ [8].inner :count
5
+ [8].inner :val0,:val1
6
+ [9].inner :val2,:val3
7
+
8
+ timed do
9
+ val0 <= _11111111
10
+ val1 <= _00000010
11
+ val3 <= _000000000
12
+ count <= 0
13
+ !10.ns
14
+ count <= 1
15
+ val2 <= val0 + val1
16
+ val3 <= val3 + 1
17
+ !10.ns
18
+ count <= 2
19
+ val2 <= val0.as(bit[9]) + val1
20
+ val3 <= val3.as(bit[10]) + 1
21
+ !10.ns
22
+ count <= 3
23
+ val2 <= (val0 + val1).as(bit[9])
24
+ val3 <= (val3 + 1).as(bit[10])
25
+ !10.ns
26
+ count <= 4
27
+ val2 <= (val0 + val1).as(bit[8])
28
+ !10.ns
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+
2
+ # A benchmark for testing the concat.
3
+ system :with_concat do
4
+ [8].inner :count
5
+ [4].inner :val0,:val1
6
+ [8].inner :val2
7
+ [12].inner :val3
8
+
9
+ val2 <= [val0,val1]
10
+ val3 <= [val2,val0]
11
+
12
+ timed do
13
+ val0 <= _1111
14
+ val1 <= _0000
15
+ count <= 0
16
+ !10.ns
17
+ val0 <= _1001
18
+ val1 <= _0110
19
+ count <= 1
20
+ !10.ns
21
+ val0 <= _1010
22
+ val1 <= _0101
23
+ count <= 2
24
+ !10.ns
25
+ end
26
+ end
data/lib/HDLRuby/hdrcc.rb CHANGED
@@ -486,6 +486,8 @@ if $options[:syntax] then
486
486
  $output << $loader.show_all
487
487
  exit
488
488
  end
489
+ HDLRuby.show Time.now
490
+ HDLRuby.show "##### Starting parser #####"
489
491
 
490
492
  if $options[:debug] then
491
493
  # Debug mode, no error management.
@@ -608,26 +610,29 @@ elsif $options[:clang] then
608
610
  $outfile = File.open($hname,"w")
609
611
  # Adds the generated globals
610
612
  $top_system.each_systemT_deep do |systemT|
611
- # For the h file.
612
- # hname = $output + "/" +
613
- # HDLRuby::Low::Low2C.c_name(systemT.name) +
614
- # ".h"
615
- # hnames << File.basename(hname)
616
- # # Open the file for current systemT
617
- # output = File.open(hname,"w")
613
+ # # For the h file.
614
+ # # hname = $output + "/" +
615
+ # # HDLRuby::Low::Low2C.c_name(systemT.name) +
616
+ # # ".h"
617
+ # # hnames << File.basename(hname)
618
+ # # # Open the file for current systemT
619
+ # # output = File.open(hname,"w")
618
620
  # Generate the H code in to.
619
- $outfile << systemT.to_ch
620
- # # Close the file.
621
- # output.close
622
- # # Clears the name.
623
- # hname = nil
621
+ # $outfile << systemT.to_ch
622
+ systemT.to_ch($outfile)
623
+ # # # Close the file.
624
+ # # output.close
625
+ # # # Clears the name.
626
+ # # hname = nil
624
627
  end
625
628
  # Adds the globals from the non-HDLRuby code
626
629
  $non_hdlruby.each do |code|
627
630
  code.each_chunk do |chunk|
628
631
  if chunk.name == :sim then
629
- $outfile << "extern " +
630
- HDLRuby::Low::Low2C.prototype(chunk.to_c)
632
+ # $outfile << "extern " +
633
+ # HDLRuby::Low::Low2C.prototype(chunk.to_c)
634
+ $outfile << "extern "
635
+ $outfile << HDLRuby::Low::Low2C.prototype(chunk.to_c(""))
631
636
  end
632
637
  end
633
638
  end
@@ -659,7 +664,8 @@ elsif $options[:clang] then
659
664
  # Open the file for current systemT
660
665
  outfile = File.open(name,"w")
661
666
  # Generate the C code in to.
662
- outfile << systemT.to_c(0,*$hnames)
667
+ # outfile << systemT.to_c(0,*$hnames)
668
+ systemT.to_c(outfile,0,*$hnames)
663
669
  # Close the file.
664
670
  outfile.close
665
671
  # Clears the name.
@@ -668,8 +674,10 @@ elsif $options[:clang] then
668
674
  else
669
675
  # Single file generation mode.
670
676
  $top_system.each_systemT_deep.reverse_each do |systemT|
671
- $output << systemT.to_ch
672
- $output << systemT.to_c
677
+ # $output << systemT.to_ch
678
+ systemT.to_ch($output)
679
+ # $output << systemT.to_c
680
+ systemT.to_c($output)
673
681
  end
674
682
  # Adds the main code.
675
683
  $output << HDLRuby::Low::Low2C.main(top_system,
@@ -709,17 +717,19 @@ elsif $options[:verilog] then
709
717
  # top_system = $top_system
710
718
  # Make description compatible with verilog generation.
711
719
  $top_system.each_systemT_deep do |systemT|
712
- HDLRuby.show "casts_without_expression! step..."
713
- systemT.casts_without_expression!
714
- HDLRuby.show Time.now
720
+ # HDLRuby.show "casts_without_expression! step..."
721
+ # systemT.casts_without_expression!
722
+ # HDLRuby.show Time.now
715
723
  HDLRuby.show "to_upper_space! step..."
716
724
  systemT.to_upper_space!
717
725
  HDLRuby.show Time.now
718
- HDLRuby.show "to_global_space! step..."
719
- systemT.to_global_systemTs!
720
- HDLRuby.show Time.now
721
- # systemT.break_types!
722
- # systemT.expand_types!
726
+ end
727
+ HDLRuby.show "to_global_space! step (global)..."
728
+ $top_system.to_global_systemTs!
729
+ HDLRuby.show Time.now
730
+ $top_system.each_systemT_deep do |systemT|
731
+ ## systemT.break_types!
732
+ ## systemT.expand_types!
723
733
  HDLRuby.show "par_in_seq2seq! step..."
724
734
  systemT.par_in_seq2seq!
725
735
  HDLRuby.show Time.now
@@ -818,6 +828,9 @@ elsif $options[:vhdl] then
818
828
  end
819
829
  end
820
830
 
831
+ HDLRuby.show "##### Code generated #####"
832
+ HDLRuby.show Time.now
833
+
821
834
  # # Apply the post drivers if any.
822
835
  # Hdecorator.each_with_property(:post_driver) do |obj, value|
823
836
  # # Load the driver.
@@ -1960,6 +1960,9 @@ module HDLRuby::High
1960
1960
  &ruby_block)
1961
1961
  # ruby_block.call(*args)
1962
1962
  end
1963
+ # sub do
1964
+ # ruby_block.call(*args,*other_block)
1965
+ # end
1963
1966
  end
1964
1967
  else
1965
1968
  define_method(name.to_sym) do |*args,&other_block|
@@ -1968,6 +1971,9 @@ module HDLRuby::High
1968
1971
  HDLRuby::High.top_user.instance_exec(*args,*other_block,
1969
1972
  &ruby_block)
1970
1973
  end
1974
+ # sub do
1975
+ # ruby_block.call(*args,*other_block)
1976
+ # end
1971
1977
  end
1972
1978
  end
1973
1979
  end
@@ -63,6 +63,17 @@ module HDLRuby::Low
63
63
  cur = cur.parent until cur.is_a?(Scope)
64
64
  return cur
65
65
  end
66
+
67
+ # Get the full parents hierachy.
68
+ def hierarchy
69
+ res = []
70
+ cur = self
71
+ while(cur) do
72
+ res << cur
73
+ cur = cur.parent
74
+ end
75
+ return res
76
+ end
66
77
  end
67
78
 
68
79