module MmuPlugin

Provides runtime methods to create objects that allow describing test templates for MMU.

Public Class Methods

new() click to toggle source
Calls superclass method
# File mmu_plugin.rb, line 24
def initialize
  super

  java_import Java::Ru.ispras.microtesk.mmu.test.template.ConstraintFactory
  @constraint_factory = ConstraintFactory.get()
end

Public Instance Methods

constraints(*primitives) click to toggle source
# File mmu_plugin.rb, line 71
def constraints(*primitives)
  @constraint_factory.newConstraints primitives
end
eq(variable_name, value) click to toggle source
# File mmu_plugin.rb, line 31
def eq(variable_name, value)
  if value.is_a?(Integer)
    @constraint_factory.newEqValue variable_name, value
  elsif value.is_a?(Array)
    @constraint_factory.newEqArray variable_name, value
  elsif value.is_a?(Range)
    @constraint_factory.newEqRange variable_name, value.min, value.max
  elsif value.is_a?(Dist)
    @constraint_factory.newEqDist variable_name, value.java_object
  else
    raise "#{value} must be Integer, Array, Range or Dist."
  end
end
event(buffer_name, attrs = {}) click to toggle source
# File mmu_plugin.rb, line 65
def event(buffer_name, attrs = {})
  hit_bias  = if attrs.has_key?(:hit)  then attrs[:hit]  else 0 end
  miss_bias = if attrs.has_key?(:miss) then attrs[:miss] else 0 end
  @constraint_factory.newEvent buffer_name, hit_bias, miss_bias
end
hit(buffer_name) click to toggle source
# File mmu_plugin.rb, line 45
def hit(buffer_name)
  @constraint_factory.newHit buffer_name
end
miss(buffer_name) click to toggle source
# File mmu_plugin.rb, line 49
def miss(buffer_name)
  @constraint_factory.newMiss buffer_name
end
read(buffer_name) click to toggle source
# File mmu_plugin.rb, line 53
def read(buffer_name)
  @constraint_factory.newRead buffer_name
end
region(region_name) click to toggle source
# File mmu_plugin.rb, line 61
def region(region_name)
  region_name
end
write(buffer_name) click to toggle source
# File mmu_plugin.rb, line 57
def write(buffer_name)
  @constraint_factory.newWrite buffer_name
end