Class: HDLRuby::High::Std::SEnumeratorSub
Overview
Describes a sequencer enumerator class that allows to generate HW iterations
over HW or SW objects within sequencers.
This is the sub Enumerator over an other one for interating inside the
enumerator.
This is specific the HDLRuby for avoiding creation of array which are
expensive in HW. Used by seach_next for example.
Will change the index position of the initial iterator without reseting
it.
Instance Method Summary
collapse
Methods inherited from SEnumerator
#+, #seach_range, #seach_with_index, #seach_with_object, #with_index, #with_object
#sall?, #sany?, #schain, #schunk, #schunk_while, #scompact, #scount, #scycle, #sdrop, #sdrop_while, #seach_cons, #seach_entry, #seach_nexts, #seach_range, #seach_slice, #seach_with_index, #seach_with_object, #sfind, #sfind_index, #sfirst, #sflat_map, #sgrep, #sgrep_v, #sgroup_by, #sinclude?, #sinject, #slazy, #smap, #smax, #smax_by, #smin, #smin_by, #sminmax, #sminmax_by, #snone?, #sone?, #spartition, #sreject, #sreverse_each, #sselect, #sslice_after, #sslice_before, #sslice_when, #ssort, #ssort_by, #ssort_merge, #ssum, #stake, #stake_while, #stally, #sto_a, #sto_h, #suniq, #szip
Constructor Details
#initialize(enum, rng, *args) ⇒ SEnumeratorSub
Create a new SEnumerator wrapper over +enum+ among +rng+ indexes.
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1934
def initialize(enum,rng,*args)
@enumerator = enum.seach
@range = rng.first..rng.last
idx = nil
siz = @range.last-@range.first+1
HDLRuby::High.cur_system.open do
idx = [siz.width].inner({
HDLRuby.uniq_name("sub_idx") => 0 })
end
@index = idx
@size = siz
end
|
Instance Method Details
#access(idx) ⇒ Object
1965
1966
1967
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1965
def access(idx)
return @enumerator.access(@index+@range.first)
end
|
#clone ⇒ Object
1991
1992
1993
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1991
def clone
return SEnumeratorSub.new(@enumerator,@range)
end
|
#index ⇒ Object
1961
1962
1963
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1961
def index
return @index
end
|
#result ⇒ Object
1957
1958
1959
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1957
def result
return @enumerator.result
end
|
#seach(&ruby_block) ⇒ Object
Iterate over each element.
1996
1997
1998
1999
2000
2001
2002
2003
2004
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1996
def seach(&ruby_block)
return self unless ruby_block
this = self
SequencerT.current.swhile(this.snext?) do
ruby_block.call(this.snext)
end
end
|
#size ⇒ Object
The directly delegate methods.
1949
1950
1951
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1949
def size
return @size
end
|
#snext ⇒ Object
1973
1974
1975
1976
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1973
def snext
@index <= @index + 1
return @enumerator.snext
end
|
#snext!(val) ⇒ Object
1982
1983
1984
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1982
def snext!(val)
return @enumerator.snext!(val)
end
|
#snext? ⇒ Boolean
1978
1979
1980
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1978
def snext?
return @index < self.size
end
|
#speek ⇒ Object
1969
1970
1971
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1969
def speek
return @enumerator.speek
end
|
#srewind ⇒ Object
1986
1987
1988
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1986
def srewind
@index <= 0
end
|
#type ⇒ Object
1953
1954
1955
|
# File 'lib/HDLRuby/std/sequencer.rb', line 1953
def type
return @enumerator.type
end
|