class HDLRuby::High::Std::ReconfT
Describes a high-level reconfigurable component type.
Attributes
name[R]
The name of the reconfigurable component type.
Public Class Methods
new(name,&ruby_block)
click to toggle source
Creates a new reconfigurable type with name
built whose instances are created from ruby_block
.
# File lib/HDLRuby/std/reconf.rb, line 16 def initialize(name,&ruby_block) # Checks and sets the name. @name = name.to_sym # Sets the block for instantiating a channel. @ruby_block = ruby_block # Sets the instantiation procedure. obj = self HDLRuby::High.space_reg(@name) do |*args| obj.instantiate(*args) end end
Public Instance Methods
instantiate(*args)
click to toggle source
Intantiates a reconfigurable component.
# File lib/HDLRuby/std/reconf.rb, line 29 def instantiate(*args) obj = self # No argument, so not an instantiation but actually # an access to the channel type. return obj if args.empty? # Process the case of generic channel. if @ruby_block.arity > 0 then # Actually the arguments are generic arguments, # generates a new channel type with these arguments # fixed. ruby_block = @ruby_block return ReconfT.new(:"") do HDLRuby::High.top_user.instance_exec(*args,&ruby_block) end end # Generates the reconfigurable components. args.each do |nameI| # puts "for #{nameI} ruby_block=#{@ruby_block}" reconfI = ReconfI.new(name,&@ruby_block) HDLRuby::High.space_reg(nameI) { reconfI } reconfI end end
Also aliased as: call