Module: RgGen::SystemVerilog::RTL::BitFieldIndex

Defined in:
lib/rggen/systemverilog/rtl/bit_field_index.rb

Constant Summary collapse

EXPORTED_METHODS =
[
  :local_index, :local_indices, :loop_variables, :array_size
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(feature) ⇒ Object



11
12
13
14
15
# File 'lib/rggen/systemverilog/rtl/bit_field_index.rb', line 11

def self.included(feature)
  feature.module_eval do
    EXPORTED_METHODS.each { |m| export m }
  end
end

Instance Method Details

#array_sizeObject



30
31
32
33
34
35
36
37
# File 'lib/rggen/systemverilog/rtl/bit_field_index.rb', line 30

def array_size
  (inside_loop? || nil) &&
    [
      *register_files.flat_map(&:array_size),
      *register.array_size,
      *bit_field.sequence_size
    ].compact
end

#local_indexObject



17
18
19
# File 'lib/rggen/systemverilog/rtl/bit_field_index.rb', line 17

def local_index
  create_identifier(local_index_name)
end

#local_indicesObject



21
22
23
# File 'lib/rggen/systemverilog/rtl/bit_field_index.rb', line 21

def local_indices
  [*register.local_indices, local_index_name]
end

#loop_variablesObject



25
26
27
28
# File 'lib/rggen/systemverilog/rtl/bit_field_index.rb', line 25

def loop_variables
  (inside_loop? || nil) &&
    [*register.loop_variables, local_index].compact
end