Class: ClassHDL::HDLFunction
- Inherits:
-
Object
- Object
- ClassHDL::HDLFunction
- Defined in:
- lib/tdl/class_hdl/hdl_function.rb
Instance Attribute Summary collapse
-
#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(name, return_type, *argvs) ⇒ HDLFunction
constructor
A new instance of HDLFunction.
- #inst_port ⇒ Object
- #instance ⇒ Object
- #ivoked(*fargvs) ⇒ Object
Constructor Details
#initialize(name, return_type, *argvs) ⇒ HDLFunction
Returns a new instance of HDLFunction.
61 62 63 64 65 66 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 61 def initialize(name,return_type,*argvs) @opertor_chains = [] @name = name @argvs = argvs @return_type = return_type end |
Instance Attribute Details
#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
68 69 70 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 68 def inst_port return @argvs.map{|e| "#{e.inst_port[0]} #{e.inst_port[1]}" }.join(',') end |
#instance ⇒ Object
72 73 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 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 72 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)) str.push " #{rel_str};" end end end str.push "endfunction:#{@name}\n" str.join("\n") end |
#ivoked(*fargvs) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/tdl/class_hdl/hdl_function.rb', line 101 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 |