Class: Origen::Pins::Timing::Timeset

Inherits:
Object
  • Object
show all
Defined in:
lib/origen/pins/timing/timeset.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Timeset

Returns a new instance of Timeset.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/origen/pins/timing/timeset.rb', line 17

def initialize(id)
  @id = id
  @drive_waves = []
  @compare_waves = []
  # Look up tables that map pins to waves
  @compare_pin_map = {}
  @drive_pin_map = {}
  # Temporary storage of pin assignments
  @pin_ids = { drive: [], compare: [] }

  # Create the default waves, these can be overridden later
  wave do |w|
    w.compare :data, at: 'period / 2'
  end

  wave do |w|
    w.drive :data, at: 0
  end
end

Instance Attribute Details

#compare_wavesObject (readonly)

Returns an array containing the defined waves for compare cycles The wave at position 0 will be applied be default to any pin which does not otherwise have a specific wave assignment.



15
16
17
# File 'lib/origen/pins/timing/timeset.rb', line 15

def compare_waves
  @compare_waves
end

#drive_wavesObject (readonly)

Returns an array containing the defined waves for drive cycles. The wave at position 0 will be applied be default to any pin which does not otherwise have a specific wave assignment.



10
11
12
# File 'lib/origen/pins/timing/timeset.rb', line 10

def drive_waves
  @drive_waves
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/origen/pins/timing/timeset.rb', line 5

def id
  @id
end

Instance Method Details

#clear_cacheObject

The timeset will cache a view of the dut's pins for performance, calling this method will clear that cache and regenerate the internal view. This should generally not be required, but available for corner cases where a pin is added to the dut after the cache has been generated.



77
78
79
80
81
82
# File 'lib/origen/pins/timing/timeset.rb', line 77

def clear_cache
  @all_pin_ids = nil
  @groups = nil
  compare_waves.each { |w| w.send(:clear_cache) }
  drive_waves.each { |w| w.send(:clear_cache) }
end

#wave(*pin_ids) {|w| ... } ⇒ Object Also known as: compare_wave, drive_wave

Add a new drive or compare wave to the timeset

timeset.wave :tck do |w|
  w.drive :data, at: 0
  w.drive 0, at: 25
  w.dont_care at: "period - 10"
end

Yields:

  • (w)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/origen/pins/timing/timeset.rb', line 44

def wave(*pin_ids)
  options = pin_ids.last.is_a?(Hash) ? pin_ids.pop : {}
  w = Wave.new(self, options)
  yield w
  if w.drive?
    if pin_ids.empty?
      w.send(:index=, 0)
      drive_waves[0] = w
      @pin_ids[:drive][0] = pin_ids
    else
      w.send(:index=, drive_waves.size)
      drive_waves << w
      @pin_ids[:drive] << pin_ids
    end
  else
    if pin_ids.empty?
      w.send(:index=, 0)
      compare_waves[0] = w
      @pin_ids[:compare][0] = pin_ids
    else
      w.send(:index=, compare_waves.size)
      compare_waves << w
      @pin_ids[:compare] << pin_ids
    end
  end
end