New Opcode: MUL, LPM, LDS, STS
This commit is contained in:
parent
17c77fe7e2
commit
154366010f
9 changed files with 626 additions and 19 deletions
32
tests/mul.c
Normal file
32
tests/mul.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
volatile char foo[30];
|
||||
|
||||
int main() {
|
||||
foo[0] = 23;
|
||||
foo[1] = 42;
|
||||
// Should produce a mul
|
||||
foo[2] = foo[0] * foo[1];
|
||||
|
||||
// Contains a decrement (8 Bit Dividend)
|
||||
foo[3] = (unsigned char)((unsigned char )foo[1] / (unsigned char)foo[0]);
|
||||
|
||||
foo[4] = foo[1] % foo[0];
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: Complex Memory Operations
|
||||
check-start:
|
||||
\avr@instr@stepn{100000}
|
||||
|
||||
\avr@test@MEM{96}{00010111} % 23
|
||||
\avr@test@MEM{97}{00101010} % 42
|
||||
\avr@test@MEM{98}{11000110} % 198
|
||||
|
||||
\avr@test@MEM{99}{00000001} % 1
|
||||
\avr@test@MEM{100}{00010011} % 19
|
||||
|
||||
check-end:
|
||||
*/
|
22
tests/string.c
Normal file
22
tests/string.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <avr/io.h>
|
||||
|
||||
// Produces LPM operations
|
||||
const char *foo = "abc";
|
||||
|
||||
int main() {
|
||||
char* p = foo;
|
||||
while (*p) {
|
||||
UDR = *p++;
|
||||
}
|
||||
|
||||
asm volatile ("break");
|
||||
}
|
||||
|
||||
/*
|
||||
check-name: String Operations
|
||||
check-start:
|
||||
\avr@instr@stepn{1000000}
|
||||
|
||||
\avr@test@UDR{abc}
|
||||
check-end:
|
||||
*/
|
|
@ -111,7 +111,11 @@ do_test()
|
|||
if [ "$actual_exit_value" -ne 0 ]; then
|
||||
error " Actual exit value does not match the expected one."
|
||||
error " expected 0, got $actual_exit_value"
|
||||
tail -n 10 $file.output | sed 's/^/ /'
|
||||
if [ x"$V" = x"1" ]; then
|
||||
cat $file.output | sed 's/^/ /'
|
||||
else
|
||||
tail -n 10 $file.output | sed 's/^/ /'
|
||||
fi
|
||||
test_failed=1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue