Module: Enumerable

Included in:
HDLRuby::High::Std::HEnumerator, HDLRuby::High::Value, VerilogTools::AST
Defined in:
lib/HDLRuby/std/sequencer.rb,
lib/HDLRuby/std/hruby_enum.rb

Instance Method Summary collapse

Instance Method Details

#hsizeObject

Size.



1078
1079
1080
# File 'lib/HDLRuby/std/hruby_enum.rb', line 1078

def hsize
  self.to_a.size
end

#seach(&ruby_block) ⇒ Object

HW iteration on each element.



2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
# File 'lib/HDLRuby/std/sequencer.rb', line 2199

def seach(&ruby_block)
    # Convert the enumrable to an array for easier processing.
    ar = self.to_a
    return if ar.empty? # The array is empty, nothing to do.
    # Compute the type of the elements.
    typ = ar[0].respond_to?(:type) ? ar[0].type : signed[32]
    # Create the hardware iterator.
    hw_enum = SEnumeratorBase.new(typ,ar.size) do |idx|
        HDLRuby::High.top_user.mux(idx,*ar)
    end
    # Is there a ruby block?
    if(ruby_block) then
        # Yes, apply it.
        return hw_enum.seach(&ruby_block)
    else
        # No, return the resulting enumerator.
        return hw_enum
    end
end