Class: HDLRuby::Low::Configure
- Defined in:
- lib/HDLRuby/hruby_low.rb,
lib/HDLRuby/hruby_low2c.rb,
lib/HDLRuby/hruby_low_fix_types.rb
Overview
Describes a system instance (re)configuration statement: not synthesizable!
Direct Known Subclasses
Constant Summary
Constants included from Low2Symbol
Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
attr_reader :systemI, :systemT, :index.
-
#ref ⇒ Object
readonly
attr_reader :systemI, :systemT, :index.
Attributes included from Hparent
Instance Method Summary collapse
-
#clone ⇒ Object
Clones (deeply).
-
#each_block_deep(&ruby_block) ⇒ Object
Iterates over all the blocks contained in the current block.
-
#each_deep(&ruby_block) ⇒ Object
Iterates over each object deeply.
-
#each_node_deep(&ruby_block) ⇒ Object
Iterates over the nodes deeply if any.
-
#each_statement_deep(&ruby_block) ⇒ Object
Iterates over all the statements contained in the current block.
-
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
-
#explicit_types! ⇒ Object
Explicit the types conversions in the statement.
-
#hash ⇒ Object
Hash function.
-
#initialize(ref, index) ⇒ Configure
constructor
Creates a new (re)configure statement of system instance refered by +ref+ with system number +index+.
-
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code.
Methods inherited from Statement
#add_blocks_code, #add_make_block, #behavior, #block, #blocks2seq!, #break_types!, #delete_related!, #delete_unless!, #each_statement, #extract_declares!, #mix?, #par_in_seq2seq!, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_ch, #to_hdr, #to_high, #to_seq!, #to_upper_space!, #to_vhdl, #top_block, #top_scope, #use_name?, #with_boolean!
Methods included from Low2Symbol
Methods included from Hparent
#hierarchy, #no_parent!, #scope
Constructor Details
#initialize(ref, index) ⇒ Configure
Creates a new (re)configure statement of system instance refered by +ref+ with system number +index+
4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 |
# File 'lib/HDLRuby/hruby_low.rb', line 4036 def initialize(ref,index) super() # Process the arguments. index = index.to_i unless ref.is_a?(Ref) then raise "Invalid class for a reference: #{ref.class}." end # Sets the arguments. @ref = ref ref.parent = self @index = index # @systemT = systemI.each_systemT.to_a[index] # # Check the systemT is valid. # unless @systemT then # raise "Invalid configuration index: #{index}." # end end |
Instance Attribute Details
#index ⇒ Object (readonly)
attr_reader :systemI, :systemT, :index
4032 4033 4034 |
# File 'lib/HDLRuby/hruby_low.rb', line 4032 def index @index end |
#ref ⇒ Object (readonly)
attr_reader :systemI, :systemT, :index
4032 4033 4034 |
# File 'lib/HDLRuby/hruby_low.rb', line 4032 def ref @ref end |
Instance Method Details
#clone ⇒ Object
Clones (deeply)
4080 4081 4082 |
# File 'lib/HDLRuby/hruby_low.rb', line 4080 def clone return Configure.new(@ref.clone,@index) end |
#each_block_deep(&ruby_block) ⇒ Object
Iterates over all the blocks contained in the current block.
4095 4096 4097 4098 4099 4100 |
# File 'lib/HDLRuby/hruby_low.rb', line 4095 def each_block_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_block_deep) unless ruby_block # A ruby block? # Nothing more to do anyway. end |
#each_deep(&ruby_block) ⇒ Object
Iterates over each object deeply.
Returns an enumerator if no ruby block is given.
4065 4066 4067 4068 4069 4070 4071 4072 |
# File 'lib/HDLRuby/hruby_low.rb', line 4065 def each_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_deep) unless ruby_block # A ruby block? First apply it to current. ruby_block.call(self) # Then apply on the reference. @ref.each_deep(&ruby_block) end |
#each_node_deep(&ruby_block) ⇒ Object
Iterates over the nodes deeply if any.
4085 4086 4087 4088 4089 4090 4091 4092 |
# File 'lib/HDLRuby/hruby_low.rb', line 4085 def each_node_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_node_deep) unless ruby_block # A ruby block? First apply it to current. ruby_block.call(self) # And recurse on the reference. @ref.each_node_deep(&ruby_block) end |
#each_statement_deep(&ruby_block) ⇒ Object
Iterates over all the statements contained in the current block.
4103 4104 4105 4106 4107 4108 4109 4110 |
# File 'lib/HDLRuby/hruby_low.rb', line 4103 def each_statement_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_statement_deep) unless ruby_block # A ruby block? # Apply it on self. ruby_block.call(self) # And that's all. end |
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
4055 4056 4057 4058 4059 4060 |
# File 'lib/HDLRuby/hruby_low.rb', line 4055 def eql?(obj) return false unless obj.is_a?(Configure) return false unless @ref.eql?(obj.ref) return false unless @index.eql?(obj.index) return true end |
#explicit_types! ⇒ Object
Explicit the types conversions in the statement.
115 116 117 118 |
# File 'lib/HDLRuby/hruby_low_fix_types.rb', line 115 def explicit_types! # Nothing to do. return self end |
#hash ⇒ Object
Hash function.
4075 4076 4077 |
# File 'lib/HDLRuby/hruby_low.rb', line 4075 def hash return (@ref.hash + @index.hash).hash end |
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code. +level+ is the hierachical level of the object.
1559 1560 1561 1562 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 1559 def to_c(res,level = 0) # Save the value pool state. res << (" " * (level*3)) << "configure(#{Low2C.obj_name(self.ref.resolve)},#{self.index});\n" end |