Class: Origen::Pins::PowerPin

Inherits:
Pin show all
Defined in:
lib/origen/pins/power_pin.rb

Constant Summary

Constants inherited from Pin

Origen::Pins::Pin::FUNCTION_SCOPED_ATTRIBUTES, Origen::Pins::Pin::ORG_FILE_INTERCEPTED_METHODS, Origen::Pins::Pin::PACKAGE_SCOPED_ATTRIBUTES, Origen::Pins::Pin::TYPES

Instance Attribute Summary collapse

Attributes inherited from Pin

#aliases, #description, #ext_pulldown, #ext_pullup, #force, #functions, #invert, #notes, #open_drain, #order, #owner, #repeat_previous, #rtl_name, #size, #supply, #supply_str, #type

Instance Method Summary collapse

Methods inherited from Pin

#<=>, #add_alias, #add_dib_assignment, #add_dib_meta, #add_function, #add_function_attributes, #add_location, #assert, #assert!, #assert_hi, #assert_hi!, #assert_lo, #assert_lo!, #assert_midband, #assert_midband!, #belongs_to_a_pin_group?, #capture, #capture!, #compare_wave, #comparing?, #comparing_mem?, #comparing_midband?, #cycle, #delete!, #describe, #direction=, #disable_clock, #dont_care, #dont_care!, #drive, #drive!, #drive_hi, #drive_hi!, #drive_lo, #drive_lo!, #drive_mem, #drive_mem!, #drive_very_hi, #drive_very_hi!, #drive_wave, #driving?, #driving_mem?, #duty_cycles, #enable_clock, #expect_mem, #expect_mem!, #function_scoped_name, #global_path_to, #goodbye, #group, #group_index, #groups, #half_period, #has_alias?, #hello, #high_voltage?, #inspect, #invalidate_group_cache, #invalidate_vector_cache, #inverted?, #is_a_clock?, #is_a_running_clock?, #is_alias_of?, #is_not_a_clock?, #method_missing, #name, #name=, #next_edge, #org_file_intercepted_methods, #repeat_previous?, #respond_to_missing?, #restore, #restore_state, #resume, #sanitize_direction, #save, #set_state, #set_value, #sites, #start_clock, #state, #state=, #stop_clock, #suspend, #suspended?, #to_be_captured?, #to_vector, #toggle, #toggle!, #toggle_clock, #update_clock, #value, #vector_formatted_value=

Methods included from OrgFile::Interceptable

#__interceptor__=, included, #myself

Methods included from PinCommon

#add_configuration, #add_mode, #add_package, #enabled?, #enabled_in_configuration?, #enabled_in_mode?, #enabled_in_package?, #finalize, #id=, #to_sym

Constructor Details

#initialize(id, owner, options = {}) ⇒ PowerPin

:nodoc:



6
7
8
9
10
11
# File 'lib/origen/pins/power_pin.rb', line 6

def initialize(id, owner, options = {}) # :nodoc:
  v = options[:voltage] || options[:voltages]
  self.voltage = v if v
  self.current_limit = options[:current_limit] if options[:current_limit]
  super
end

Dynamic Method Handling

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

Instance Attribute Details

#current_limitObject

Returns the value of attribute current_limit



4
5
6
# File 'lib/origen/pins/power_pin.rb', line 4

def current_limit
  @current_limit
end

Instance Method Details

#voltageObject

Like voltages but if there is only one voltage known then it will be returned directly instead of being wrapped in an array. If no voltages are known this returns nil whereas voltages will return an empty array. For more than one voltages present this behaves like an alias of voltages.



23
24
25
26
27
28
29
30
31
# File 'lib/origen/pins/power_pin.rb', line 23

def voltage
  if voltages.size > 0
    if voltages.size > 1
      voltages
    else
      voltages.first
    end
  end
end

#voltage=(val) ⇒ Object

Set the operating voltage for the pin, can be a single value or an array



14
15
16
# File 'lib/origen/pins/power_pin.rb', line 14

def voltage=(val)
  @voltages = [val].flatten.uniq
end

#voltagesObject

Returns an array of known operating voltages for the given pin



34
35
36
# File 'lib/origen/pins/power_pin.rb', line 34

def voltages
  @voltages ||= []
end