Method: HDLRuby::High::Std#sdef

Defined in:
lib/HDLRuby/std/sequencer_func.rb

#sdef(name, depth = nil, overflow = nil, &ruby_block) ⇒ Object

Declares a sequencer function named +name+ using +ruby_block+ as body. You can specify a stack depth with +depth+ argument and a HDLRuby block to execute in case of stack overflow with the +overflow+ argument.



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/HDLRuby/std/sequencer_func.rb', line 517

def sdef(name, depth=nil, overflow = nil, &ruby_block)
    # Create the function.
    funcT = SequencerFunctionT.new(name,depth,overflow,&ruby_block)
    # Register it for calling.
    if HDLRuby::High.in_system? then
        define_singleton_method(name.to_sym) do |*args|
            funcT.call(*args)
        end
    else
        define_method(name.to_sym) do |*args|
            funcT.call(*args)
        end
    end
    # Return the create function.
    funcT
end