Module: HDLRuby::High::HScope_missing

Includes:
Hmissing
Included in:
HBlock, Scope, Std::DecoderT, Std::FsmT, Std::PipelineT
Defined in:
lib/HDLRuby/hruby_high.rb

Constant Summary

Constants included from Hmissing

HDLRuby::High::Hmissing::High

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &ruby_block) ⇒ Object

Missing methods are looked for in the private namespace.

NOTE: it is ok to use the private namespace because the scope can only be accessed if it is available from its systemT.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/HDLRuby/hruby_high.rb', line 177

def method_missing(m, *args, &ruby_block)
    # puts "looking for #{m} in #{self}"
    # Is the scope currently opened?
    # if High.space_top.user_deep?(self) then
    if High.space_index(self.namespace) then
        # Yes, use the stack of namespaces.
        h_missing(m,*args,&ruby_block)
    else
        # No, look into the current namespace and return a reference
        # to the result if it is a referable hardware object.
        res = self.namespace.send(m,*args,&ruby_block)
        if res.respond_to?(:to_ref) then
            # This is a referable object, build the reference from
            # the namespace.
            return RefObject.new(self.to_ref,res)
        end
    end
end

Instance Method Details

#h_missingObject



171
# File 'lib/HDLRuby/hruby_high.rb', line 171

alias_method :h_missing, :method_missing