Sha256: 00f61fccb6f1bd5cae0e7d0aae70174302603defea47741c718bf6452ea49eba

Contents?: true

Size: 617 Bytes

Versions: 5

Compression:

Stored size: 617 Bytes

Contents

require "rips/instructions/instruction"

module Rips
  module Instructions

    class Sub < Instruction

      attr_reader :variables, :length

      # @variables: types of instruction's variables
      # @length: length in bits for each variable
      def initialize
        super("sub",Formats::DFormat.new(0b0011))
        @variables = [Variables::Register.new, Variables::Register.new, Variables::Register.new]
        @length = {r3:4, r2:4, r1:4, op:4}
      end

      # Swap subtractor
      def set_arguments (args)
        args[1], args[2] = args[2], args[1]
        super
      end      
    end
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rips-0.1.1 lib/rips/instructions/sub.rb
rips-0.1.0 lib/rips/instructions/sub.rb
rips-0.0.8 lib/rips/instructions/sub.rb
rips-0.0.7 lib/rips/instructions/sub.rb
rips-0.0.6 lib/rips/instructions/sub.rb