diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-03-09 11:49:25 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2011-03-10 16:07:00 +0000 |
commit | 00d56f95696054a9b3eb381b3894ebd49a2513a3 (patch) | |
tree | 799b9bc5f190c35a050468be35db8d1034fee8cf /risugen | |
parent | 6db7515b24f0299f2e094dfc363e33b1f231574d (diff) |
risugen: Set up random memory block if required
If any instruction specifies a 'memory' block, then set up a block
of random data and tell risu about it via the new SETMEMBLOCK op.
Diffstat (limited to 'risugen')
-rwxr-xr-x | risugen | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -88,6 +88,7 @@ sub align4() # So the last nibble indicates the desired operation: my $OP_COMPARE = 0; # compare registers my $OP_TESTEND = 1; # end of test, stop +my $OP_SETMEMBLOCK = 2; # r0 is address of memory block (8192 bytes) sub write_thumb_risuop($) { @@ -247,6 +248,28 @@ sub write_random_register_data() write_risuop($OP_COMPARE); } +sub write_memblock_setup() +{ + # Write code which sets up the memory block for loads and stores. + # We just need to set r0 to point to a block of at least 8K length + # of random data. + if ($is_thumb) { + write_switch_to_arm(); + } + + insn32(0xe28f0004); # add r0, pc, #4 + write_arm_risuop($OP_SETMEMBLOCK); + insn32(0xea000000 + 2047); # b next + for (0..2047) { + insn32(rand(0xffffffff)); + } + # next: + + if ($is_thumb) { + write_switch_to_thumb(); + } +} + sub write_arm_prologue($) { my ($fpscr) = @_; @@ -422,6 +445,10 @@ sub write_test_code($$) print "Generating code using patterns: @keys...\n"; progress_start(78, $numinsns); + if (grep { defined($insn_details{$_}->{blocks}->{"memory"}) } @keys) { + write_memblock_setup(); + } + for my $i (1..$numinsns) { my $insn_enc = $keys[int rand (@keys)]; #dump_insn_details($insn_enc, $insn_details{$insn_enc}); |