Class: Origen::Models::Mux

Inherits:
Object show all
Includes:
Origen::Model
Defined in:
lib/origen/models/mux.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Origen::Model

#==, #_initialized?, #_resolve_controller_class, #add_configuration, #add_mode, #app, #attributes, #clock!, #clock_apply, #clock_prepare, #configuration, #configuration=, #configurations, #current_configuration, #current_mode, #current_mode=, #delete_all_modes, #delete_all_specs_and_notes, #find_specs, #has_mode?, #inspect, #ip_name, #is_a_model_and_controller?, #is_an_origen_model?, #is_top_level?, #load_block, #log, #method_missing, #model, #modes, #read_memory, #respond_to?, #respond_to_directly?, #to_json, #with_configuration, #with_each_mode, #with_mode, #wrap_in_controller, #write_memory

Constructor Details

#initialize(options = {}) ⇒ Mux

Returns a new instance of Mux.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/origen/models/mux.rb', line 9

def initialize(options = {})
  @input = []
  (2**select_lines).times do |i|
    @input << port("input#{i}".to_sym, size: size)
  end

  port :select, size: select_lines
  port :output, size: size

  output.connect_to do |i|
    unless ports[:select].data.undefined?
      send("input#{ports[:select].data}")[i].path
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Origen::Model

Instance Attribute Details

#select_linesObject (readonly)

Returns the value of attribute select_lines.



7
8
9
# File 'lib/origen/models/mux.rb', line 7

def select_lines
  @select_lines
end

#sizeObject (readonly)

Returns the value of attribute size.



6
7
8
# File 'lib/origen/models/mux.rb', line 6

def size
  @size
end