class RgGen::VHDL::Utility::Identifier
Public Instance Methods
__array_select__(array_index, lsb, width)
click to toggle source
# File lib/rggen/vhdl/utility/identifier.rb, line 17 def __array_select__(array_index, lsb, width) if @width lsb = __serialized_lsb__(array_index, lsb) __array_slice__(lsb, width || @width) else "(#{__serialized_index__(array_index)})" end end
__array_slice__(lsb, width)
click to toggle source
# File lib/rggen/vhdl/utility/identifier.rb, line 26 def __array_slice__(lsb, width) msb = if integer?(width) __reduce_array__([lsb, width - 1], :+, 0) else __reduce_array__([lsb, width, -1], :+, 0) end "(#{msb} downto #{lsb})" end
__create_select__(array_index_or_lsb, lsb_or_width, width)
click to toggle source
# File lib/rggen/vhdl/utility/identifier.rb, line 7 def __create_select__(array_index_or_lsb, lsb_or_width, width) if array_index_or_lsb.is_a?(Array) __array_select__(array_index_or_lsb, lsb_or_width, width) elsif lsb_or_width __array_slice__(array_index_or_lsb, lsb_or_width) else "(#{array_index_or_lsb})" end end