Skip to content

Commit

Permalink
validation, add local debug scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
BuJo committed Oct 31, 2023
1 parent e459e80 commit 459ec8f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
30 changes: 30 additions & 0 deletions validation/clean-disass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

sync

dut="$1"
ref="$2"

sed -i 's/\(lui.*,0x\)fff\(.....$\)/\1\2/' $dut
sed -i 's/\(lui.*,0x\)fff\(.....$\)/\1\2/' $dut
sed -i 's/add.*zero,zero,0 # 0/nop/' $dut
sed -i 's/add\(.*\),zero,\(-*[0-9]*\) # .*/li\1,\2/' $dut
sed -i 's/jal\(.*\)zero,\([0-9]*\)/j\1\2/' $dut
sed -i 's/jr\(.*\),0x0$/jr\1/' $dut
sed -i 's/add\(.*\),0 #.*$/mv\1/' $dut
sed -i 's/csrrs\(.*\),zero$/csrr\1/' $dut
sed -i 's/csrrw\tzero,\(.*\)$/csrw\t\1/' $dut
sed -i 's/xor\(.*\),-1 /not\1 /' $dut
sed -i '/Opcode for ins/d' $dut

sed -i 's/ <.*$//' $ref
sed -i '/^80......$/d' $ref
sed -i '/jbuch/d' $ref
sed -i '/Disassem/d' $ref
sed -i '/littleriscv/d' $ref
sed -i '/^$/d' $ref
sed -i '/^[0-9a-f]*$/d' $ref

sed -i '/nop/d' $ref $dut
sed -i 's/ #.*$//' $ref $dut

15 changes: 15 additions & 0 deletions validation/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e -o pipefail

DIR=`dirname $(readlink -f $0)`

tst=$1
work=$DIR/riscof_work

cargo build
../target/debug/archtest $work/$tst/dut/my.elf $work/$tst/dut/DUT-rriscv.signature 2>$work/$tst/dut/DUT.disass || true
./clean-disass.sh $work/$tst/dut/DUT.disass $work/$tst/ref/ref.disass

echo meld $work/$tst/dut/DUT.disass $work/$tst/ref/ref.disass
echo meld $work/$tst/dut/DUT-rriscv.signature $work/$tst/ref/Reference-sail_c_simulator.signature

0 comments on commit 459ec8f

Please sign in to comment.