Class: RubyHDL::High::RefRange
- Inherits:
-
Ref
- Object
- Expression
- Ref
- RubyHDL::High::RefRange
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes a SW implementation of an range 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, rng) ⇒ RefRange
constructor
Create a new index reference with +type+ data type +base+ base reference and +rng+ range.
-
#range ⇒ Object
Get the access range.
-
#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, rng) ⇒ RefRange
Create a new index reference with +type+ data type +base+ base reference and +rng+ range.
1872 1873 1874 1875 1876 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1872 def initialize(type,base,rng) super(type) @base = base.to_ref @rng = (rng.first.to_expr)..(rng.last.to_expr) end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
1868 1869 1870 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1868 def base @base end |
Instance Method Details
#final_base ⇒ Object
Get the final base object of the binary if it is an [] operator.
1884 1885 1886 1887 1888 1889 1890 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1884 def final_base if @base.is_a?(Ref) then return @base.final_base else return @base end end |
#range ⇒ Object
Get the access range.
1879 1880 1881 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1879 def range return @rng.first..@rng.last end |
#to_ruby ⇒ Object
Convert to ruby code.
1920 1921 1922 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1920 def to_ruby return "#{@base.to_ruby}[#{@rng.first.to_ruby}..#{@rng.last.to_ruby}]" end |