Class: RgGen::SystemVerilog::Common::Utility::Identifier
- Inherits:
-
Object
- Object
- RgGen::SystemVerilog::Common::Utility::Identifier
- Defined in:
- lib/rggen/systemverilog/common/utility/identifier.rb
Instance Method Summary collapse
- #[](array_index_or_lsb, lsb_or_width = nil, width = nil) ⇒ Object
- #__array_format__(array_format) ⇒ Object
- #__array_size__(array_size) ⇒ Object
- #__sub_identifiers__(sub_identifiers) ⇒ Object
- #__width__(width) ⇒ Object
-
#initialize(name) ⇒ Identifier
constructor
A new instance of Identifier.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Identifier
Returns a new instance of Identifier.
8 9 10 11 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 8 def initialize(name) @name = name block_given? && yield(self) end |
Instance Method Details
#[](array_index_or_lsb, lsb_or_width = nil, width = nil) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 38 def [](array_index_or_lsb, lsb_or_width = nil, width = nil) if array_index_or_lsb __create_new_identifier__(array_index_or_lsb, lsb_or_width, width) else self end end |
#__array_format__(array_format) ⇒ Object
21 22 23 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 21 def __array_format__(array_format) @array_format = array_format end |
#__array_size__(array_size) ⇒ Object
17 18 19 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 17 def __array_size__(array_size) @array_size = array_size end |
#__sub_identifiers__(sub_identifiers) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 25 def __sub_identifiers__(sub_identifiers) Array(sub_identifiers).each do |sub_identifier| (@sub_identifiers ||= []) << sub_identifier define_singleton_method(sub_identifier) do Identifier.new("#{@name}.#{__method__}") end end end |
#__width__(width) ⇒ Object
13 14 15 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 13 def __width__(width) @width = width end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/rggen/systemverilog/common/utility/identifier.rb', line 34 def to_s @name.to_s end |