Class: ClassHDL::HDLFunction
- Inherits:
-
Object
- Object
- ClassHDL::HDLFunction
- Defined in:
- lib/tdl/class_hdl/hdl_function.rb
Instance Attribute Summary collapse
-
#belong_to_module ⇒ Object
readonly
Returns the value of attribute belong_to_module.
-
#name ⇒ Object
Returns the value of attribute name.
-
#open_ivoke ⇒ Object
Returns the value of attribute open_ivoke.
-
#opertor_chains ⇒ Object
Returns the value of attribute opertor_chains.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Instance Method Summary collapse
-
#initialize(belong_to_module, name, return_type, *argvs) ⇒ HDLFunction
constructor
A new instance of HDLFunction.
- #inst_port ⇒ Object
- #instance ⇒ Object
- #ivoked(*fargvs) ⇒ Object
Constructor Details
#initialize(belong_to_module, name, return_type, *argvs) ⇒ HDLFunction
Returns a new instance of HDLFunction.
62 63 64 65 66 67 68 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 62 def initialize(belong_to_module,name,return_type,*argvs) @opertor_chains = [] @name = name @argvs = argvs @return_type = return_type @belong_to_module = belong_to_module end |
Instance Attribute Details
#belong_to_module ⇒ Object (readonly)
Returns the value of attribute belong_to_module.
60 61 62 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 60 def belong_to_module @belong_to_module end |
#name ⇒ Object
Returns the value of attribute name.
57 58 59 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 57 def name @name end |
#open_ivoke ⇒ Object
Returns the value of attribute open_ivoke.
58 59 60 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 58 def open_ivoke @open_ivoke end |
#opertor_chains ⇒ Object
Returns the value of attribute opertor_chains.
57 58 59 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 57 def opertor_chains @opertor_chains end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
59 60 61 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 59 def return_type @return_type end |
Instance Method Details
#inst_port ⇒ Object
70 71 72 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 70 def inst_port return @argvs.map{|e| "#{e.inst_port[0]} #{e.inst_port[1]}" }.join(',') end |
#instance ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 74 def instance str = [] if @return_type if @return_type.is_a? EnumStruct str.push "function #{@return_type.typedef_name} #{@name}(#{inst_port}); " elsif @return_type.is_a? StructMeta str.push "function #{@return_type.name} #{@name}(#{inst_port}); " else str.push "function #{@return_type.to_s} #{@name}(#{inst_port}); " end else str.push "function #{@name}(#{inst_port}); " end opertor_chains.each do |op| unless op.is_a? OpertorChain str.push op.instance(:assign).gsub(/^./){ |m| " #{m}"} else unless op.slaver rel_str = ClassHDL.compact_op_ch(op.instance(:assign,belong_to_module)) str.push " #{rel_str};" end end end str.push "endfunction:#{@name}\n" str.join("\n") end |
#ivoked(*fargvs) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 103 def ivoked(*fargvs) str = fargvs.map do |e| if e.is_a? OpertorChain e.slaver = true end if e.instance_of? String "\"#{e}\"" else e.to_s end end.join(",") return "#{@name}(#{str})".to_nq end |