Class: RubyHDL::High::Siter
- Inherits:
-
Object
- Object
- RubyHDL::High::Siter
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes a SW implementation of an iterator statement.
Instance Method Summary collapse
-
#each_command(&ruby_block) ⇒ Object
(also: #each)
Iterate on the commands.
-
#initialize(sequencer, *commands, &ruby_block) ⇒ Siter
constructor
Create a new iteration statement in sequencer +sequencer+ for chain of commands +commands+ to interate while executing +ruby_block+.
-
#make_iterator(meth, *args, &ruby_block) ⇒ Object
Create an iterator for a given method +meth+.
-
#sall?(arg = nil, &ruby_block) ⇒ Boolean
Tell if all the elements respect a given criterion given either as +arg+ or as block.
-
#sany?(arg = nil, &ruby_block) ⇒ Boolean
Tell if any of the elements respects a given criterion given either as +arg+ or as block.
-
#schain(arg) ⇒ Object
Returns an SEnumerator generated from current enumerable and +arg+.
-
#schunk(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk.
-
#schunk_while(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk_while.
-
#scompact ⇒ Object
HW implementation of the Ruby compact, but remove 0 values instead on nil (since nil that does not have any meaning in HW).
-
#scount(obj = nil, &ruby_block) ⇒ Object
WH implementation of the Ruby count.
-
#scycle(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby cycle.
-
#sdrop(n) ⇒ Object
HW implementation of the Ruby drop.
-
#sdrop_while(&ruby_block) ⇒ Object
HW implementation of the Ruby drop_while.
-
#seach_cons(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_cons.
-
#seach_entry(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_entry.
-
#seach_nexts(num, &ruby_block) ⇒ Object
Iterator on the +num+ next elements.
-
#seach_range(rng, &ruby_block) ⇒ Object
Iterator on each of the elements in range +rng+.
-
#seach_slice(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_slice.
-
#seach_with_index(*args, &ruby_block) ⇒ Object
(also: #with_index)
HW implementation of the Ruby each_with_index.
-
#seach_with_object(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_object.
-
#sfind(if_none_proc, &ruby_block) ⇒ Object
HW implementation of the Ruby find.
-
#sfind_index(obj = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby find_index.
-
#sfirst(n = 1) ⇒ Object
HW implementation of the Ruby first.
-
#sflat_map(&ruby_block) ⇒ Object
HW implementation of the Ruby flat_map.
-
#sgrep(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep.
-
#sgrep_v(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep_v.
-
#sgroup_by(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby group_by.
-
#sinclude?(obj) ⇒ Boolean
HW implementation of the Ruby include?.
-
#sinject(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby inject.
-
#slazy(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby lazy.
-
#smap(&ruby_block) ⇒ Object
Returns a vector containing the execution result of the given block on each element.
-
#smax(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max.
-
#smax_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max_by.
-
#smin(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min.
-
#smin_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min_by.
-
#sminmax(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax.
-
#sminmax_by(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax_by.
-
#snone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if none of the elements respects a given criterion given either as +arg+ or as block.
-
#sone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if one and only one of the elements respects a given criterion given either as +arg+ or as block.
-
#spartition(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby partition.
-
#sreduce ⇒ Object
HW implementation of the Ruby reduce.
-
#sreject(&ruby_block) ⇒ Object
HW implementatiob of the Ruby reject.
-
#sreverse_each(*args, &ruby_block) ⇒ Object
HW implementatiob of the Ruby reverse_each.
-
#sselect(&ruby_block) ⇒ Object
HW implementation of the Ruby select.
-
#sslice_after(pattern = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_after.
-
#sslice_before(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_before.
-
#sslice_when(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_when.
-
#ssort(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
-
#ssort_by(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
-
#ssort_merge(arI, arO, first, middle, last, &ruby_block) ⇒ Object
Merge two arrays in order, for ssort only.
-
#ssum(initial_value = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby sum.
-
#stake(n) ⇒ Object
The HW implementation of the Ruby take.
-
#stake_while(&ruby_block) ⇒ Object
The HW implementation of the Ruby take_while.
-
#stally(h = nil) ⇒ Object
HW implementation of the Ruby tally.
-
#sto_a ⇒ Object
HW implementation of the Ruby to_a.
-
#sto_h(h = nil) ⇒ Object
HW implementation of the Ruby to_h.
-
#suniq(&ruby_block) ⇒ Object
HW implementation of the Ruby uniq.
-
#szip(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby zip.
-
#to_c ⇒ Object
Convert to C code.
-
#to_ruby ⇒ Object
Convert to Ruby code.
Constructor Details
#initialize(sequencer, *commands, &ruby_block) ⇒ Siter
Create a new iteration statement in sequencer +sequencer+ for chain of commands +commands+ to interate while executing +ruby_block+.
2734 2735 2736 2737 2738 2739 2740 2741 2742 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2734 def initialize(sequencer,*commands, &ruby_block) @sequencer = sequencer @commands = commands if ruby_block then # The iterator is finalized. @blk = Sblock.new(sequencer,&ruby_block) end # puts "New iterator with blk=#{@blk} commands=#{@commands}" end |
Instance Method Details
#each_command(&ruby_block) ⇒ Object Also known as: each
Iterate on the commands.
2745 2746 2747 2748 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2745 def each_command(&ruby_block) return to_enum(:each_command) unless ruby_block @commands.each(&ruby_block) end |
#make_iterator(meth, *args, &ruby_block) ⇒ Object
Create an iterator for a given method +meth+.
2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2767 def make_iterator(meth,*args,&ruby_block) # if ruby_block then # blk = Sblock.new(@sequencer,&ruby_block) # command = RubyHDL::High::Ruby.new do # "#{meth}(#{args.map{|arg| arg.to_ruby}.join(",")}) { #{blk.to_ruby} }" # end # else # command = RubyHDL::High::Ruby.new do # "#{meth}(#{args.map{|arg| arg.to_ruby}.join(",")})" # end # end command = "#{meth}" if args.any? then command += "(*#{RubyHDL::High::Ruby.new { "#{args.map{|arg| arg.to_ruby}.join(",")}"}})" end return Siter.new(@sequencer,*@commands,command,&ruby_block) end |
#sall?(arg = nil, &ruby_block) ⇒ Boolean
Tell if all the elements respect a given criterion given either as +arg+ or as block.
2800 2801 2802 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2800 def sall?(arg = nil,&ruby_block) return self.make_iterator("all?",arg,&ruby_block) end |
#sany?(arg = nil, &ruby_block) ⇒ Boolean
Tell if any of the elements respects a given criterion given either as +arg+ or as block.
2806 2807 2808 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2806 def sany?(arg = nil,&ruby_block) return self.make_iterator("any?",arg,&ruby_block) end |
#schain(arg) ⇒ Object
Returns an SEnumerator generated from current enumerable and +arg+
2811 2812 2813 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2811 def schain(arg) return self.make_iterator("chain",arg) end |
#schunk(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk. NOTE: to do, or may be not.
2817 2818 2819 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2817 def schunk(*args,&ruby_block) raise "schunk is not supported yet." end |
#schunk_while(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk_while. NOTE: to do, or may be not.
2823 2824 2825 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2823 def schunk_while(*args,&ruby_block) raise "schunk_while is not supported yet." end |
#scompact ⇒ Object
HW implementation of the Ruby compact, but remove 0 values instead on nil (since nil that does not have any meaning in HW).
2844 2845 2846 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2844 def scompact return self.make_iterator("compact",&ruby_block) end |
#scount(obj = nil, &ruby_block) ⇒ Object
WH implementation of the Ruby count.
2850 2851 2852 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2850 def scount(obj = nil, &ruby_block) return self.make_iterator("count",obj,&ruby_block) end |
#scycle(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby cycle.
2855 2856 2857 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2855 def scycle(n = nil,&ruby_block) return self.make_iterator("cycle",n,&ruby_block) end |
#sdrop(n) ⇒ Object
HW implementation of the Ruby drop.
2867 2868 2869 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2867 def sdrop(n) return self.make_iterator("drop",n) end |
#sdrop_while(&ruby_block) ⇒ Object
HW implementation of the Ruby drop_while.
2872 2873 2874 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2872 def sdrop_while(&ruby_block) return self.make_iterator("drop_while",&ruby_block) end |
#seach_cons(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_cons
2877 2878 2879 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2877 def seach_cons(n,&ruby_block) return self.make_iterator("each_cons",n,&ruby_block) end |
#seach_entry(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_entry. NOTE: to do, or may be not.
2883 2884 2885 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2883 def seach_entry(*args,&ruby_block) raise "seach_entry is not supported yet." end |
#seach_nexts(num, &ruby_block) ⇒ Object
Iterator on the +num+ next elements. NOTE:
- Stop iteration when the end of the range is reached or when there are no elements left
- This is not a method from Ruby but one specific for hardware where creating a array is very expensive.
3099 3100 3101 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3099 def seach_nexts(num,&ruby_block) return self.seach.snexts(num,&ruby_block) end |
#seach_range(rng, &ruby_block) ⇒ Object
Iterator on each of the elements in range +rng+. NOTE:
- Stop iteration when the end of the range is reached or when there are no elements left
- This is not a method from Ruby but one specific for hardware where creating a array is very expensive.
2794 2795 2796 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2794 def seach_range(rng,&ruby_block) return self.make_iterator("each_range",rng,&ruby_block) end |
#seach_slice(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_slice
2888 2889 2890 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2888 def seach_slice(n,&ruby_block) return self.make_iterator("each_slice",n,&ruby_block) end |
#seach_with_index(*args, &ruby_block) ⇒ Object Also known as: with_index
HW implementation of the Ruby each_with_index.
2893 2894 2895 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2893 def seach_with_index(*args,&ruby_block) return self.make_iterator("each_with_index",*args,&ruby_block) end |
#seach_with_object(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_object.
2899 2900 2901 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2899 def seach_with_object(obj,&ruby_block) return self.make_iterator("each_with_object",obj,&ruby_block) end |
#sfind(if_none_proc, &ruby_block) ⇒ Object
HW implementation of the Ruby find. NOTE: contrary to Ruby, if_none_proc is mandatory since there is no nil in HW. Moreover, the argument can also be a value.
2862 2863 2864 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2862 def sfind(if_none_proc, &ruby_block) return self.make_iterator("find",if_none_proc,&ruby_block) end |
#sfind_index(obj = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby find_index.
2914 2915 2916 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2914 def sfind_index(obj = nil, &ruby_block) return self.make_iterator("find_index",obj,&ruby_block) end |
#sfirst(n = 1) ⇒ Object
HW implementation of the Ruby first.
2919 2920 2921 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2919 def sfirst(n=1) return self.make_iterator("first",n) end |
#sflat_map(&ruby_block) ⇒ Object
HW implementation of the Ruby flat_map. NOTE: actually due to the way HDLRuby handles vectors, should work like smap
2838 2839 2840 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2838 def sflat_map(&ruby_block) return self.make_iterator("flat_map",&ruby_block) end |
#sgrep(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep. NOTE: to do, or may be not.
2925 2926 2927 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2925 def sgrep(*args,&ruby_block) raise "sgrep is not supported yet." end |
#sgrep_v(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep_v. NOTE: to do, or may be not.
2931 2932 2933 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2931 def sgrep_v(*args,&ruby_block) raise "sgrep_v is not supported yet." end |
#sgroup_by(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby group_by. NOTE: to do, or may be not.
2937 2938 2939 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2937 def sgroup_by(*args,&ruby_block) raise "sgroup_by is not supported yet." end |
#sinclude?(obj) ⇒ Boolean
HW implementation of the Ruby include?
2942 2943 2944 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2942 def sinclude?(obj) return self.make_iterator("include?",obj) end |
#sinject(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby inject.
2947 2948 2949 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2947 def sinject(*args,&ruby_block) return self.make_iterator("inject",*args,&ruby_block) end |
#slazy(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby lazy. NOTE: to do, or may be not.
2959 2960 2961 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2959 def slazy(*args,&ruby_block) raise "slazy is not supported yet." end |
#smap(&ruby_block) ⇒ Object
Returns a vector containing the execution result of the given block on each element. If no block is given, return an SEnumerator. NOTE: be carful that the resulting vector can become huge if there are many element.
2831 2832 2833 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2831 def smap(&ruby_block) return self.make_iterator("map",&ruby_block) end |
#smax(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max.
2964 2965 2966 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2964 def smax(n = nil, &ruby_block) return self.make_iterator("max",n,&ruby_block) end |
#smax_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max_by.
2969 2970 2971 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2969 def smax_by(n = nil, &ruby_block) return self.make_iterator("max_by",n,&ruby_block) end |
#smin(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min.
2974 2975 2976 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2974 def smin(n = nil, &ruby_block) return self.make_iterator("min",n,&ruby_block) end |
#smin_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min_by.
2979 2980 2981 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2979 def smin_by(n = nil, &ruby_block) return self.make_iterator("min_by",n,&ruby_block) end |
#sminmax(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax.
2984 2985 2986 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2984 def sminmax(&ruby_block) return self.make_iterator("minmax",&ruby_block) end |
#sminmax_by(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax_by.
2989 2990 2991 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2989 def sminmax_by(&ruby_block) return self.make_iterator("minmax_by",&ruby_block) end |
#snone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if none of the elements respects a given criterion given either as +arg+ or as block.
2995 2996 2997 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2995 def snone?(arg = nil,&ruby_block) return self.make_iterator("none?",arg,&ruby_block) end |
#sone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if one and only one of the elements respects a given criterion given either as +arg+ or as block.
3001 3002 3003 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3001 def sone?(arg = nil,&ruby_block) return self.make_iterator("one?",arg,&ruby_block) end |
#spartition(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby partition. NOTE: to do, or may be not.
3007 3008 3009 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3007 def spartition(*args,&ruby_block) raise "spartition is not supported yet." end |
#sreduce ⇒ Object
HW implementation of the Ruby reduce.
2952 2953 2954 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2952 def sreduce return self.make_iterator("reduce",*args,&ruby_block) end |
#sreject(&ruby_block) ⇒ Object
HW implementatiob of the Ruby reject.
3012 3013 3014 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3012 def sreject(&ruby_block) return self.make_iterator("reject",&ruby_block) end |
#sreverse_each(*args, &ruby_block) ⇒ Object
HW implementatiob of the Ruby reverse_each.
3017 3018 3019 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3017 def sreverse_each(*args,&ruby_block) return self.make_iterator("reverse_each",*args,&ruby_block) end |
#sselect(&ruby_block) ⇒ Object
HW implementation of the Ruby select.
2909 2910 2911 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2909 def sselect(&ruby_block) return self.make_iterator("select",&ruby_block) end |
#sslice_after(pattern = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_after. NOTE: to do, or may be not.
3023 3024 3025 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3023 def sslice_after(pattern = nil,&ruby_block) raise "sslice_after is not supported yet." end |
#sslice_before(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_before. NOTE: to do, or may be not.
3029 3030 3031 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3029 def sslice_before(*args,&ruby_block) raise "sslice_before is not supported yet." end |
#sslice_when(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_when. NOTE: to do, or may be not.
3035 3036 3037 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3035 def sslice_when(*args,&ruby_block) raise "sslice_before is not supported yet." end |
#ssort(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
3045 3046 3047 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3045 def ssort(&ruby_block) return self.make_iterator("sort",&ruby_block) end |
#ssort_by(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
3050 3051 3052 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3050 def ssort_by(&ruby_block) return self.make_iterator("sort_by",&ruby_block) end |
#ssort_merge(arI, arO, first, middle, last, &ruby_block) ⇒ Object
Merge two arrays in order, for ssort only.
3040 3041 3042 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3040 def ssort_merge(arI, arO, first, middle, last, &ruby_block) return self.make_iterator("sort_merge",arI,arO,first,middle,last,&ruby_block) end |
#ssum(initial_value = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby sum.
3055 3056 3057 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3055 def ssum(initial_value = nil,&ruby_block) return self.make_iterator("sum",initial_value,&ruby_block) end |
#stake(n) ⇒ Object
The HW implementation of the Ruby take.
3060 3061 3062 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3060 def stake(n) return self.make_iterator("take",n) end |
#stake_while(&ruby_block) ⇒ Object
The HW implementation of the Ruby take_while.
3065 3066 3067 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3065 def stake_while(&ruby_block) return self.make_iterator("take_while",&ruby_block) end |
#stally(h = nil) ⇒ Object
HW implementation of the Ruby tally. NOTE: to do, or may be not.
3071 3072 3073 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3071 def stally(h = nil) raise "stally is not supported yet." end |
#sto_a ⇒ Object
HW implementation of the Ruby to_a.
2904 2905 2906 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2904 def sto_a return self.make_iterator("to_a") end |
#sto_h(h = nil) ⇒ Object
HW implementation of the Ruby to_h. NOTE: to do, or may be not.
3077 3078 3079 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3077 def sto_h(h = nil) raise "sto_h is not supported yet." end |
#suniq(&ruby_block) ⇒ Object
HW implementation of the Ruby uniq.
3082 3083 3084 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3082 def suniq(&ruby_block) return self.make_iterator("uniq",&ruby_block) end |
#szip(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby zip. NOTE: for now szip is deactivated untile tuples are properly handled by HDLRuby.
3089 3090 3091 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3089 def szip(obj,&ruby_block) return self.make_iterator("zip",obj,&ruby_block) end |
#to_c ⇒ Object
Convert to C code.
2760 2761 2762 2763 2764 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2760 def to_c res = @sequencer.clk_up_c + "\n" + @commands.map { |command| command.to_c }.join("_") return res + "(#{@blk.to_c})" end |
#to_ruby ⇒ Object
Convert to Ruby code.
2752 2753 2754 2755 2756 2757 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2752 def to_ruby # puts "to_ruby with blk=#{@blk} commands=#{@commands}" res = @sequencer.clk_up + "\n" + @commands.map { |command| command.to_ruby }.join(".") return res + " do\n#{@blk.to_ruby}\n#{@sequencer.clk_up}\nend" end |