Class: RubyHDL::High::RefIndex
- Inherits:
-
Ref
- Object
- Expression
- Ref
- RubyHDL::High::RefIndex
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes a SW implementation of an index reference.
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Attributes inherited from Expression
Instance Method Summary collapse
-
#final_base ⇒ Object
Get the final base object of the binary if it is an [] operator.
-
#initialize(type, base, idx) ⇒ RefIndex
constructor
Create a new index reference with +type+ data type +base+ base reference and +idx+ index.
-
#range ⇒ Object
Get the access range.
-
#to_c ⇒ Object
Convert to C code.
-
#to_ruby ⇒ Object
Convert to Ruby code.
Methods inherited from Ref
Methods inherited from Expression
#<=, #[], #mux, #sdownto, #seach, #stimes, #supto, #to_expr, #to_value
Constructor Details
#initialize(type, base, idx) ⇒ RefIndex
Create a new index reference with +type+ data type +base+ base reference and +idx+ index.
2041 2042 2043 2044 2045 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2041 def initialize(type,base,idx) super(type) @base = base.to_expr @idx = idx.to_expr end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
2037 2038 2039 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2037 def base @base end |
Instance Method Details
#final_base ⇒ Object
Get the final base object of the binary if it is an [] operator.
2048 2049 2050 2051 2052 2053 2054 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2048 def final_base if @base.is_a?(Ref) then return @base.final_base else return @base end end |
#range ⇒ Object
Get the access range.
2084 2085 2086 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2084 def range return @idx..@idx end |
#to_c ⇒ Object
Convert to C code.
2094 2095 2096 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2094 def to_c return "#{@base.to_c}[#{@idx.to_c}]" end |
#to_ruby ⇒ Object
Convert to Ruby code.
2089 2090 2091 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2089 def to_ruby return "#{@base.to_ruby}[#{@idx.to_ruby}]" end |