Class: HDLRuby::High::Std::SEnumeratorWrapper

Inherits:
SEnumerator
  • Object
show all
Defined in:
lib/HDLRuby/std/sequencer.rb

Overview

Describes a sequencer enumerator class that allows to generate HW iterations over HW or SW objects within sequencers. This is the wrapper Enumerator over an other one for applying an other interation method over the first one.

Instance Method Summary collapse

Methods inherited from SEnumerator

#+, #seach_with_index, #seach_with_object, #with_index, #with_object

Methods included from SEnumerable

#sall?, #sany?, #schain, #schunk, #schunk_while, #scompact, #scount, #scycle, #sdrop, #sdrop_while, #seach_cons, #seach_entry, #seach_nexts, #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, iter, *args) ⇒ SEnumeratorWrapper

Create a new SEnumerator wrapper over +enum+ with +iter+ iteration method and +args+ argument.



1842
1843
1844
1845
1846
1847
1848
1849
1850
# File 'lib/HDLRuby/std/sequencer.rb', line 1842

def initialize(enum,iter,*args)
    if enum.is_a?(SEnumerator) then
        @enumerator = enum.clone
    else
        @enumerator = enum.seach
    end
    @iterator  = iter.to_sym
    @arguments = args
end

Instance Method Details

#access(idx) ⇒ Object



1869
1870
1871
# File 'lib/HDLRuby/std/sequencer.rb', line 1869

def access(idx)
    return @enumerator.access(idx)
end

#cloneObject

Clones the enumerator.



1909
1910
1911
# File 'lib/HDLRuby/std/sequencer.rb', line 1909

def clone
    return SEnumeratorWrapper.new(@enumerator,@iterator,*@arguments)
end

#indexObject



1865
1866
1867
# File 'lib/HDLRuby/std/sequencer.rb', line 1865

def index
    return @enumerator.index
end

#resultObject



1861
1862
1863
# File 'lib/HDLRuby/std/sequencer.rb', line 1861

def result
    return @enumerator.result
end

#seach(&ruby_block) ⇒ Object

Iterate over each element.



1914
1915
1916
1917
1918
1919
# File 'lib/HDLRuby/std/sequencer.rb', line 1914

def seach(&ruby_block)
    # No block given, returns self.
    return self unless ruby_block
    # A block is given, iterate.
    return @enumerator.send(@iterator,*@arguments,&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.


1904
1905
1906
# File 'lib/HDLRuby/std/sequencer.rb', line 1904

def seach_range(rng,&ruby_block)
    return @enumerator.seach_range(rng,&ruby_block)
end

#sizeObject

The directly delegate methods.



1853
1854
1855
# File 'lib/HDLRuby/std/sequencer.rb', line 1853

def size
    return @enumertor.size
end

#snextObject



1877
1878
1879
# File 'lib/HDLRuby/std/sequencer.rb', line 1877

def snext
    return @enumerator.snext
end

#snext!(val) ⇒ Object



1890
1891
1892
# File 'lib/HDLRuby/std/sequencer.rb', line 1890

def snext!(val)
    return @enumerator.snext!(val)
end

#snext?Boolean

Returns:

  • (Boolean)


1881
1882
1883
1884
1885
1886
1887
1888
# File 'lib/HDLRuby/std/sequencer.rb', line 1881

def snext?
    # if @size then
    #     return @enumerator.index < @size
    # else
    #     return @enumerator.snext?
    # end
    return @enumerator.snext?
end

#speekObject



1873
1874
1875
# File 'lib/HDLRuby/std/sequencer.rb', line 1873

def speek
    return @enumerator.speek
end

#srewindObject



1894
1895
1896
# File 'lib/HDLRuby/std/sequencer.rb', line 1894

def srewind
    return @enumerator.srewind
end

#typeObject



1857
1858
1859
# File 'lib/HDLRuby/std/sequencer.rb', line 1857

def type
    return @enumerator.type
end