class HDLRuby::High::Std::TaskPortA

Describes an finisher port to a task.

Public Class Methods

new(namespace,finisher_proc,reseter_proc = nil) click to toggle source

Creates a new task finisher running in namespace and writing using finisher_proc and reseting using reseter_proc.

# File lib/HDLRuby/std/task.rb, line 146
def initialize(namespace,finisher_proc,reseter_proc = nil)
    unless namespace.is_a?(Namespace)
        raise "Invalid class for a namespace: #{namespace.class}"
    end
    @namespace = namespace
    @finisher_proc = finisher_proc.to_proc
    # @reseter_proc = reseter_proc ? reseter_proc.to_proc : proc {}
end

Public Instance Methods

finish(*args,&ruby_block) click to toggle source

Performs a finish on the task using args and ruby_block as arguments.

# File lib/HDLRuby/std/task.rb, line 157
def finish(*args,&ruby_block)
    # Gain access to the finisher as local variable.
    finisher_proc = @finisher_proc
    # Execute the code generating the accesser in context.
    HDLRuby::High.space_push(@namespace)
    HDLRuby::High.cur_block.open do
        instance_exec(ruby_block,*args,&finisher_proc)
    end
    HDLRuby::High.space_pop
end