Class: TdlSpace::DefEleBaseArrayChain
- Inherits:
-
DefArrayChain
- Object
- DefArrayChain
- TdlSpace::DefEleBaseArrayChain
- Defined in:
- lib/tdl/rebuild_ele/ele_base.rb
Overview
只能用于接口,dimension 和 DSIZE 并不共享空间
Instance Attribute Summary collapse
-
#modport_type ⇒ Object
DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset.
-
#tclass ⇒ Object
DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset.
Attributes inherited from DefArrayChain
Instance Method Summary collapse
- #-(xname) ⇒ Object
- #[](*a) ⇒ Object
-
#initialize(hash) ⇒ DefEleBaseArrayChain
constructor
A new instance of DefEleBaseArrayChain.
Methods inherited from DefArrayChain
#check_name, #check_topmodule_method, #method_missing, #to_inp
Constructor Details
#initialize(hash) ⇒ DefEleBaseArrayChain
Returns a new instance of DefEleBaseArrayChain.
723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 723 def initialize(hash) super(hash[:belong_to_module]) # @dsize = dsize # @freqM = freqM # @clock = clock # @reset = reset @origin_hash = hash if hash[:dsize] && hash[:dsize].instance_of?(String) raise TdlError.new("DSIZE<#{hash[:dsize]}> Cant be String") end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TdlSpace::DefArrayChain
Instance Attribute Details
#modport_type ⇒ Object
DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset
722 723 724 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 722 def modport_type @modport_type end |
#tclass ⇒ Object
DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset
722 723 724 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 722 def tclass @tclass end |
Instance Method Details
#-(xname) ⇒ Object
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 750 def - (xname) unless xname.is_a? Symbol name = to_inp(xname) else name = to_inp(xname.to_s) end # belong_to_module.Def.datainf_c(name: name ,clock: clock||@clock,reset: reset||@reset ,dsize: dsize||@dsize ,dimension: @chain,freqM:freqM||@freqM) if @chain.length > 0 dimension = @chain[0,@chain.length] @origin_hash[:dimension] = dimension end int = tclass.new(@origin_hash[:belong_to_module]) int.inst_name = name int.dimension = @chian if modport_type int.modport_type = modport_type end @origin_hash.each do |k,v| ## if int.respond_to? k int.public_send("#{k}=",v) end end if @belong_to_module.respond_to?(name) raise TdlError.new("Cant redefine #{name} !!! ") end if name.to_s.strip.empty? raise TdlError.new("Name Cant empty !!! ") end ## 给sdlmodule添加直接调用 方法 @belong_to_module.define_singleton_method(name) { int } StringBandItegration.add_method_to_itgt(name,int) return int end |
#[](*a) ⇒ Object
735 736 737 738 739 740 741 742 743 744 745 746 747 748 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 735 def [](*a) if a[0].is_a? Range a = a.to_a end if a.empty? raise TdlError.new("参数不能为空") end new_dla = self.class.new(@origin_hash) new_dla.chain = @chain + a new_dla.tclass = self.tclass new_dla.modport_type = modport_type new_dla end |