Class: HDLRuby::High::Std::ReconfT
- Inherits:
-
Object
- Object
- HDLRuby::High::Std::ReconfT
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/HDLRuby/std/reconf.rb
Overview
Describes a high-level reconfigurable component type.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The name of the reconfigurable component type.
Instance Method Summary collapse
-
#initialize(name, &ruby_block) ⇒ ReconfT
constructor
Creates a new reconfigurable type with +name+ built whose instances are created from +ruby_block+.
-
#instantiate(*args) ⇒ Object
(also: #call)
Intantiates a reconfigurable component.
Constructor Details
#initialize(name, &ruby_block) ⇒ ReconfT
Creates a new reconfigurable type with +name+ built whose instances are created from +ruby_block+.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/HDLRuby/std/reconf.rb', line 19 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 |
Instance Attribute Details
#name ⇒ Object (readonly)
The name of the reconfigurable component type.
15 16 17 |
# File 'lib/HDLRuby/std/reconf.rb', line 15 def name @name end |
Instance Method Details
#instantiate(*args) ⇒ Object Also known as: call
Intantiates a reconfigurable component.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/HDLRuby/std/reconf.rb', line 32 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 |