Sha256: e1f4f801909d9e095c68f00f6eccf2a744b8a5c0809a5e4a5018f825bd3704dc

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

# Defines methods for detecting all possible value changes.
#--
# Copyright 2007 Suraj N. Kurapati
# See the file named LICENSE for details.

module RubyVPI
  class EdgeClass #:nodoc:
    DETECTION_METHODS = []
    Meth = Struct.new :name, :info, :body

    vals  = %w[1 0 X Z H L t f]
    edges = vals.map {|a| vals.map {|b| a + b}}.flatten

    edges.each do |edge|
      name = "change_#{edge.downcase}?"
      old, new = edge.tr('tf', '10').split(//).map {|s| 'Vpi' + s}

      info = "Tests if the logic value of this handle has changed from #{old} (in the previous time step) to #{new} (in the current time step)."

      body = %{
        def #{name}
          old = @__edge__prev_val
          new = get_value(VpiScalarVal)

          old == #{old} && new == #{new}
        end
      }

      DETECTION_METHODS << Meth.new(name, info, body)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-vpi-20.0.0 lib/ruby-vpi/core/edge-methods.rb
ruby-vpi-21.1.0 lib/ruby-vpi/core/edge-methods.rb
ruby-vpi-21.0.0 lib/ruby-vpi/core/edge-methods.rb