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.
692 693 694 695 696 697 698 699 700 701 702 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 692 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
691 692 693 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 691 def modport_type @modport_type end |
#tclass ⇒ Object
DefArrayChain in sdlmodule_arratchain attr_accessor :dsize,:freqM,:clock,:reset
691 692 693 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 691 def tclass @tclass end |
Instance Method Details
#-(xname) ⇒ Object
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 719 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
704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 704 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 |