Assignment 5 Testing Programs

A set of assembly language programs will be used to guide your implementation as well as to test the correctness of your assembler. These programs trace the implementation steps. Once your assembler is armed with one function, you can test it on one program. Make sure the prior test goes well before you start building the next function and test it on the next program, and so on and so forth, until you have a complete assembler. These programs are sorted into three categories by different purposes as well as different weights.
Even if you do not have a complete assembler to produce an object file, for example, you only have finished pass1(),you can still use the print_passes() function provided in the print.c file to print out the content of the symbol table and the sections.
These programs weigh the majority in judging the correctness of your work
These programs let you try your assembler on interesting applications such as printing out the Fibonacci numbers and sorting an array of random integers using the Bubble Sort algorithm. Since these programs can be made into executable object files, you only need to use the gcc command with the -o option
% gcc -o application application.o
% application
These programs weigh 10% in judging the correctness of your work
These programs check if your assembler can detect and report error assembly language programs.
These programs are the extra credits.

Comprehensive Checkers

Testing Subject
Pass
Example of Assembler Function
Testing Program
Section Initializations
1
.section ".data"
01section.s
Symbol Definitions
1
label:
02symbol.s
Directives
2
.ascii "hello"
03directive.s
Instruction Opcodes
2
ld [%r1 + %r2], %r3
04opcode.s
Address Formats & Instruction Formats
2
ld [%r1 + 2], %r3
05addrformat.s
06instrformat.s
Registers
2
ld [%fp + 2], %o0
07register.s
Expressions
2
ld [%r1 + 1*(2+3)/4], %r3
08expression.s
Relocation
2
sethi %hi(label), %r3
09relocation.s
Symbol References
2
call printf
 10symbol+.s
Synthetic Instructions
2
cmp %r1, %r2
11synthetic.s

Simple Applications

Application Name
Testing Program
Fibonacci Numbers
app_01fibonacci.s
Bubble Sort
app_02bubblesort.s

Error Programs

Testing Subject
Pass
Example of Error
Testing Program
Invalid Boundaries
1
.align 4; .byte 0; .half 0
err_01boundary.s
Invalid Symbol Definitions
1
label:;label:
err_02symbol.s
Invalid Directives
1
.align 3
err_03directive.s
Invalid Immediate Values
2
ld [%r1 + 4096], %r3
err_04immvalue.s
Invalid Relocation
2
sethi %lo(label)], %r3
err_05relocation.s

Back to Assignment 5 Home