Sha256: ade2dc962bc26ff70c6bc07ff7b25a955d57ec3d322616a22c8acac9cf052f61

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module OrigenTesters
  # A base class that can be used to model command-based, rather than
  # vector-based testers.
  class CommandBasedTester
    include VectorBasedTester

    def initialize
      @vector_based = false
    end

    # Write a string directly to the output file without being processed
    # or modified in any way
    def direct_write(str)
      microcode str
    end
    alias_method :dw, :direct_write

    # Concept of a cycle not supported, print out an error to the output
    # file to alert the user that execution has hit code that is not
    # compatible with a command based tester.
    def cycle(*_args)
      microcode '*** Cycle called ***'
    end

    # Concept of a subroutine not supported, print out an error to the output
    # file to alert the user that execution has hit code that is not
    # compatible with a command based tester.
    def call_subroutine(sub)
      microcode "Call_subroutine called to #{sub}"
    end

    def format_vector(vec)
      vec.microcode
    end

    # Loop the content embedded in the supplied block
    def loop(_name = nil, number_of_loops)
      number_of_loops.times do
        yield
      end
    end
    alias_method :loop_vector, :loop
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
origen_testers-0.13.2 lib/origen_testers/command_based_tester.rb
origen_testers-0.10.0 lib/origen_testers/command_based_tester.rb