Class: OrigenSTIL::Processor::Pins

Inherits:
Base
  • Object
show all
Defined in:
lib/origen_stil/processor/pins.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#handler_missing, #process

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



4
5
6
# File 'lib/origen_stil/processor/pins.rb', line 4

def model
  @model
end

Instance Method Details

#on_signal(node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/origen_stil/processor/pins.rb', line 12

def on_signal(node)
  name, direction = *node
  name = OrigenSTIL.unquote(name)
  if direction == 'In'
    direction = :input
  elsif direction == 'Out'
    direction = :output
  elsif direction == 'InOut'
    direction = :io
  else
    direction = nil
  end
  # Currently does not add pins defined as "Supply" or "Pseudo"
  if direction
    # No need to do anything if it already responds to this pin name
    unless model.has_pin?(name)
      # Otherwise might need to add an alias for different casing being used
      if model.has_pin?(name.downcase)
        model.add_pin_alias(name.to_sym, name.downcase)
      elsif model.has_pin?(name.upcase)
        model.add_pin_alias(name.to_sym, name.upcase)
      # Need to add a new pin
      else
        model.add_pin(name.to_sym, direction: direction)
      end
    end
  end
end

#run(node, model, options = {}) ⇒ Object

Adds pins from the given node to the given model



7
8
9
10
# File 'lib/origen_stil/processor/pins.rb', line 7

def run(node, model, options = {})
  @model = model
  process(node)
end