Created
December 10, 2020 07:53
-
-
Save taiyoslime/8b5849dddb4074e0fce8f1bad022435c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ ruby reg.rb < CoreMark_RV32I.trace | |
reg = [""] * 32 | |
reg[0] = "0x00000000" | |
while inst = gets | |
lv, rv = inst.split("#") | |
pc = lv.split(" ")[0][..-2] | |
# break if pc == "0xXXXX" | |
unless rv.include?("no destination") | |
rd, _, val, *_ = rv.split(" ") | |
val = val[..-2] if val[-1] == ";" | |
reg[rd[1..].to_i] = val | |
end | |
end | |
reg.each_with_index{ |reg, i| | |
puts "x#{0 if i < 10}#{i} = #{reg}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment