Module: Origen::Pins::Timing

Included in:
Origen::Pins
Defined in:
lib/origen/pins/timing.rb,
lib/origen/pins/timing/wave.rb,
lib/origen/pins/timing/timeset.rb

Overview

Top-level manager for the devices pin timing setups, an instance of this class is automatically instantiated and available as dut.timing

Defined Under Namespace

Classes: Timeset, Wave

Instance Method Summary collapse

Instance Method Details

#add_timeset(*args, &block) ⇒ Object

Add a very basic timeset where all pins will have default waves, which will drive for the whole cycle and compare at 50% of the current period

add_timeset :func

15
16
17
18
19
20
21
# File 'lib/origen/pins/timing.rb', line 15

def add_timeset(*args, &block)
  if block_given?
    timesets(*args, &block)
  else
    timesets(args.first) {}
  end
end

#current_timeset(*args, &block) ⇒ Object Also known as: timeset

Returns the currently selected timeset, or nil


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/origen/pins/timing.rb', line 40

def current_timeset(*args, &block)
  if block_given?
    timesets(*args, &block)
  else
    if args.first
      timesets(args.first)
    else
      timesets[@current_timeset]
    end
  end
end

#current_timeset=(id) ⇒ Object Also known as: timeset=

Set the current timeset, this will be called automatically if the timeset is changed via tester.set_timeset


55
56
57
58
59
60
61
# File 'lib/origen/pins/timing.rb', line 55

def current_timeset=(id)
  if timesets[id]
    @current_timeset = id
  else
    fail "Timeset #{id} has not been defined!"
  end
end

#current_timeset_periodObject

Returns the current timeset period or nil


71
72
73
# File 'lib/origen/pins/timing.rb', line 71

def current_timeset_period
  @current_timeset_period
end

#current_timeset_period=(val) ⇒ Object

Set the current timeset period, this will be called automatically if the timeset is changed via tester.set_timeset


66
67
68
# File 'lib/origen/pins/timing.rb', line 66

def current_timeset_period=(val)
  @current_timeset_period = val
end

#timesets(name = nil, options = {}) ⇒ Object


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/origen/pins/timing.rb', line 23

def timesets(name = nil, options = {})
  name, options = nil, name if name.is_a?(Hash)
  @timesets ||= {}.with_indifferent_access
  # If defining a new timeset
  if block_given?
    @timesets[name] ||= Timeset.new(name)
    yield @timesets[name]
  else
    if name
      @timesets[name]
    else
      @timesets
    end
  end
end