diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-03-09 11:49:02 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2011-03-10 16:05:19 +0000 |
commit | 6db7515b24f0299f2e094dfc363e33b1f231574d (patch) | |
tree | a3cbfe9033d0c7d7ffa733e9ee5778236a7caee9 /risugen | |
parent | f6478315240b0a8ca3846ce0325eb2d2e07a58bc (diff) |
risugen: Generalise routines for writing insns asking risu to do things
Generalise the routines for writing the magic UNDEF instructions which we
use to ask risu to do things for us, since we're going to be adding some
new risu ops for load/store handling.
Diffstat (limited to 'risugen')
-rwxr-xr-x | risugen | 35 |
1 files changed, 22 insertions, 13 deletions
@@ -82,23 +82,32 @@ sub align4() # 'e5a' just in case the space is being used by somebody # else too. -# For Thumb the equivalent space is 0xDExx. +# For Thumb the equivalent space is 0xDExx +# and we use 0xDEEx. -sub write_test_end() +# So the last nibble indicates the desired operation: +my $OP_COMPARE = 0; # compare registers +my $OP_TESTEND = 1; # end of test, stop + +sub write_thumb_risuop($) { - if ($is_thumb) { - insn16(0xdee1); - } else { - insn32(0xe7fe5af1); - } + my ($op) = @_; + insn16(0xdee0 | $op); +} + +sub write_arm_risuop($) +{ + my ($op) = @_; + insn32(0xe7fe5af0 | $op); } -sub write_compare() +sub write_risuop($) { + my ($op) = @_; if ($is_thumb) { - insn16(0xdee0); + write_thumb_risuop($op); } else { - insn32(0xe7fe5af0); + write_arm_risuop($op); } } @@ -235,7 +244,7 @@ sub write_random_register_data() if ($is_thumb) { write_switch_to_thumb(); } - write_compare(); + write_risuop($OP_COMPARE); } sub write_arm_prologue($) @@ -418,7 +427,7 @@ sub write_test_code($$) #dump_insn_details($insn_enc, $insn_details{$insn_enc}); my $forcecond = (rand() < $condprob) ? 1 : 0; gen_one_insn($forcecond, $insn_details{$insn_enc}); - write_compare(); + write_risuop($OP_COMPARE); # Rewrite the registers periodically. This avoids the tendency # for the VFP registers to decay to NaNs and zeroes. if (($i % 100) == 0) { @@ -695,7 +704,7 @@ sub main() open_bin($outfile); write_arm_prologue($fpscr); write_test_code($condprob, $numinsns); - write_test_end(); + write_risuop($OP_TESTEND); close_bin(); return 0; } |