Class: OrigenTesters::MemoryStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/memory_style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemoryStyle

Returns a new instance of MemoryStyle.



5
6
7
8
9
10
11
12
13
# File 'lib/origen_testers/memory_style.rb', line 5

def initialize
  @pin_id = []
  @size = []
  @bit_order = []
  @format = []
  @trigger = []
  @mode = []
  @data_type = []
end

Instance Attribute Details

#bit_orderObject (readonly)

Returns the value of attribute bit_order.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def bit_order
  @bit_order
end

#data_typeObject (readonly)

Returns the value of attribute data_type.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def data_type
  @data_type
end

#formatObject (readonly)

Returns the value of attribute format.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def format
  @format
end

#modeObject (readonly)

Returns the value of attribute mode.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def mode
  @mode
end

#pin_idObject (readonly)

Returns the value of attribute pin_id.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def pin_id
  @pin_id
end

#sizeObject (readonly)

Returns the value of attribute size.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def size
  @size
end

#triggerObject (readonly)

Returns the value of attribute trigger.



3
4
5
# File 'lib/origen_testers/memory_style.rb', line 3

def trigger
  @trigger
end

Instance Method Details

#accumulate_attributes(pin_id) ⇒ Object

Get the chronologically last setting for the given pin’s attributes

Examples:

mem.pin :tdi, size: 1
mem.pin :tdi, size: 2

my_local_attribute_hash = mem.accumulate_attributes(:tdi)
# my_local_attribute_hash now is
# {pin_id: :tdi, size: 2, bit_order: nil, format: nil, trigger: nil}


46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/origen_testers/memory_style.rb', line 46

def accumulate_attributes(pin_id)
  a = { pin_id: pin_id }
  @pin_id.each_index do |i|
    if @pin_id[i].include?(pin_id)
      a[:size] = @size[i]
      a[:bit_order] = @bit_order[i]
      a[:format] = @format[i]
      a[:trigger] = @trigger[i]
      a[:mode] = @mode[i]
      a[:data_type] = @data_type[i]
    end
  end
  a
end

#contained_pinsObject

Get an array of pins contained in this style container



67
68
69
70
71
72
73
74
75
# File 'lib/origen_testers/memory_style.rb', line 67

def contained_pins
  pins = []
  @pin_id.each do |a|
    a.each do |p|
      pins << p
    end
  end
  pins.uniq
end

#contains_pin?(pin_id) ⇒ Boolean

Check to see if a given pin exists in this style container

Returns:

  • (Boolean)


62
63
64
# File 'lib/origen_testers/memory_style.rb', line 62

def contains_pin?(pin_id)
  contained_pins.include?(pin_id)
end

#pin(*pin_ids) ⇒ Object

Set memory style attributes for the given pin

Examples:

mem.pin :tdi, size: 8, trigger: :auto


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/origen_testers/memory_style.rb', line 19

def pin(*pin_ids)
  options = pin_ids.last.is_a?(Hash) ? pin_ids.pop : {}
  pin_ids.each_index do |i|
    if pin_ids[i].is_a?(Symbol)
      pin_ids[i] = dut.pin(pin_ids[i]).name
    else
      pin_ids[i] = pin_ids[i].name
    end
  end
  @pin_id << pin_ids
  @size << options[:size]
  @bit_order << options[:bit_order]
  @format << options[:format]
  @trigger << options[:trigger]
  @mode << options[:mode]
  @data_type << options[:data_type]
end