Class: ClassHDL::BlockFOR
- Defined in:
- lib/tdl/class_hdl/hdl_foreach.rb
Instance Attribute Summary collapse
-
#flag ⇒ Object
Returns the value of attribute flag.
-
#start ⇒ Object
Returns the value of attribute start.
-
#step ⇒ Object
Returns the value of attribute step.
-
#stop ⇒ Object
Returns the value of attribute stop.
-
#var ⇒ Object
Returns the value of attribute var.
-
#var_type ⇒ Object
Returns the value of attribute var_type.
Attributes inherited from BlockIF
#belong_to_module, #cond, #opertor_chains, #slaver
Instance Method Summary collapse
Methods inherited from BlockIF
Constructor Details
This class inherits a constructor from ClassHDL::BlockIF
Instance Attribute Details
#flag ⇒ Object
Returns the value of attribute flag.
26 27 28 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 26 def flag @flag end |
#start ⇒ Object
Returns the value of attribute start.
26 27 28 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 26 def start @start end |
#step ⇒ Object
Returns the value of attribute step.
26 27 28 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 26 def step @step end |
#stop ⇒ Object
Returns the value of attribute stop.
26 27 28 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 26 def stop @stop end |
#var ⇒ Object
Returns the value of attribute var.
26 27 28 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 26 def var @var end |
#var_type ⇒ Object
Returns the value of attribute var_type.
26 27 28 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 26 def var_type @var_type end |
Instance Method Details
#instance(as_type = :cond) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/tdl/class_hdl/hdl_foreach.rb', line 27 def instance(as_type= :cond) unless var head_str = "for(#{var_type} #{flag}=#{start};#{flag}<#{stop};#{flag}=#{flag}+#{step})begin" else head_str = "for(#{var}=#{start};#{flag}<#{stop};#{flag}=#{flag}+#{step})begin" end sub_str = [] opertor_chains.each do |oc| unless oc.is_a? BlockIF unless oc.slaver sub_str.push " #{oc.instance(as_type,belong_to_module)};" end else sub_str.push( oc.instance(as_type).gsub(/^./){ |m| " #{m}"} ) end end return "#{head_str}\n#{sub_str.join("\n")}\nend" end |