Class: OrigenSTIL::Processor::PinGroups

Inherits:
Base
  • Object
show all
Defined in:
lib/origen_stil/processor/pin_groups.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/pin_groups.rb', line 4

def model
  @model
end

Instance Method Details

#on_add(node) ⇒ Object



54
55
56
57
# File 'lib/origen_stil/processor/pin_groups.rb', line 54

def on_add(node)
  lhs, rhs = *node
  Array(process(lhs)) + Array(process(rhs))
end

#on_name(node) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/origen_stil/processor/pin_groups.rb', line 39

def on_name(node)
  id = node.value
  if model.has_pin?(id)
    # Expand any references to another pin group
    id = id.to_sym
    if dut.pin_groups.ids.map(&:to_sym).include?(id)
      model.pin(id).map(&:id)
    else
      [id]
    end
  else
    fail "Pin #{id} referenced at #{node.file}:#{node.line_number} but DUT does not have this pin/pin_group"
  end
end

#on_parens(node) ⇒ Object



63
64
65
# File 'lib/origen_stil/processor/pin_groups.rb', line 63

def on_parens(node)
  process_all(node.children).first
end

#on_signal_group(node) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/origen_stil/processor/pin_groups.rb', line 29

def on_signal_group(node)
  name, expr = *node
  name = OrigenSTIL.unquote(name.value)
  @current_signal_group = name
  unless model.has_pin?(name)
    ids = process(expr).to_a[0]
    model.add_pin_group name.to_sym, *ids
  end
end

#on_signal_groups(node) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/origen_stil/processor/pin_groups.rb', line 14

def on_signal_groups(node)
  groups = node.children
  if groups.first.type == :name
    groups = groups.dup
    # Not doing anything with named groups currently
    @current_signal_group_domain = groups.shift.value
    groups.freeze
    Origen.log.warning "Signal groups for domain \"#{@current_signal_group_domain}\" are being ignored (support for named signal groups is not implemented yet)"
    # process_all(groups)
  else
    @current_signal_group_domain = nil
    process_all(groups)
  end
end

#on_subtract(node) ⇒ Object



59
60
61
# File 'lib/origen_stil/processor/pin_groups.rb', line 59

def on_subtract(node)
  fail 'Subtraction in pin groups is not supported yet'
end

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

Adds pin groups from the given node to the given model



7
8
9
10
11
12
# File 'lib/origen_stil/processor/pin_groups.rb', line 7

def run(node, model, options = {})
  @model = model
  node.find_all(:signal_groups).each do |signal_groups|
    process(signal_groups)
  end
end