Class: Origen::Pins::Timing::Wave

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

Constant Summary collapse

VALID_DRIVE_DATA =
[0, 1, :data]
VALID_COMPARE_DATA =
[0, 1, :data]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeset, options = {}) ⇒ Wave

Returns a new instance of Wave.



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

def initialize(timeset, options = {})
  @code = options[:code]
  @code = nil if [0, 1, 'H', 'L', :H, :L].include?(@code)
  @timeset = timeset
  @events = []
end

Instance Attribute Details

#codeObject (readonly)

Returns the pattern code value associated with the wave. By default this will return nil if no code was given at the time the wave was defined, which means it is the wave that will be applied for the conventional code values of 0, 1, H, L.



9
10
11
# File 'lib/origen/pins/timing/wave.rb', line 9

def code
  @code
end

#eventsObject (readonly)

Returns the value of attribute events.



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

def events
  @events
end

#indexObject

Returns the value of attribute index.



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

def index
  @index
end

#timesetObject (readonly)

Returns the value of attribute timeset.



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

def timeset
  @timeset
end

Instance Method Details

#compare(data, options) ⇒ Object Also known as: compare_edge



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

def compare(data, options)
  self.type = :compare
  validate_data(data) do |d|
    validate_time(options) do |t|
      events << [t, d]
    end
  end
end

#compare?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/origen/pins/timing/wave.rb', line 81

def compare?
  @type == :compare
end

#dont_care(options) ⇒ Object Also known as: highz



65
66
67
68
69
70
# File 'lib/origen/pins/timing/wave.rb', line 65

def dont_care(options)
  self.type = :drive
  validate_time(options) do |t|
    events << [t, :x]
  end
end

#drive(data, options) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/origen/pins/timing/wave.rb', line 46

def drive(data, options)
  self.type = :drive
  validate_data(data) do |d|
    validate_time(options) do |t|
      events << [t, d]
    end
  end
end

#drive?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/origen/pins/timing/wave.rb', line 77

def drive?
  @type == :drive
end

#evaluated_eventsObject

Returns the events array but with any formula based times evaluated. Note that this does not raise an error if the period is not currently set, in that case any events that reference it will have nil for their time.



26
27
28
29
30
31
32
# File 'lib/origen/pins/timing/wave.rb', line 26

def evaluated_events
  if dut.current_timeset_period
    events.map { |e| [calc.evaluate(e[0], period: dut.current_timeset_period).ceil, e[1]] }
  else
    fail 'The current timeset period has not been set'
  end
end

#pin_idsObject

Returns an array containing all dut pin_ids that are assigned to this wave by the parent timeset



36
37
38
# File 'lib/origen/pins/timing/wave.rb', line 36

def pin_ids
  @pins_ids ||= timeset.send(:pin_ids_for, self)
end

#pinsObject

Returns an array containing all dut pin objects that are assigned to this wave by the parent timeset



42
43
44
# File 'lib/origen/pins/timing/wave.rb', line 42

def pins
  @pins ||= pin_ids.map { |id| dut.pin(id) }
end

#typeObject



73
74
75
# File 'lib/origen/pins/timing/wave.rb', line 73

def type
  @type ||= :drive
end