class MIPSUnit::MSpec::Util::Util

Public Class Methods

randomize_preserved() click to toggle source

return a Hash containing a random value to each of the preserved registers, except $ra

Author

Zachary Kurmas

Copyright

Copyright © 2013

# File lib/mipsunit/mspec/util/util.rb, line 8
def self.randomize_preserved
  s_regs = (0..7).map { |i| "s#{i}".to_sym }
  (s_regs + [:gp, :sp, :fp]).inject({}) { |h, reg| h[reg] = rand(16383); h }
end