Introduction
File Name Conventions
Object files produced by the linker are, by convention, appended with a suffix of .preout to distinguish them from other file types.Object File Format
The linker produces executable object files which may be run on the simulator The executable object file is split into a number of sections as displayed in the diagram below :
Instruction encoding
The instructions are encoded in binary form for the machine in the output of the linker. There are two instruction formats:
Type 1 encoding
Instructions encoded in type 1 format are generally register-register, and load/store operations that do not require large constants. The fields in the encoding are as follows:| Filed name | Bits | Contents |
|---|---|---|
| Opcode | 0-5 | Instruction opcode |
| Reg1 | 6-11 | Instruction operand 1 (typically denotes register) |
| Reg2 | 12-17 | Instruction operand 2 (typically denotes register) |
| Reg3 | 18-23 | Instruction operand 3 (typically denotes register) |
| Partition | 24-31 | Instruction operand 3 (denotes register) |
Instructions whose parameters are not register based (for example CREPAR) use a log2 encoding for constants in the Regi fields.
The instructions encoded in type 1 format are:
MOV, LOAD, STORE, LOADIDX, STOREIDX, ADD, SUB, MUL, DIV, MOD, LS, RS, RSU, AND, OR, XOR, NOT, LT, GT, EQ, CREPAR, DELPAR, INVPAR, SETIPAR, UPDPAR
Type 2 encoding
Branch instructions, instructions using large constants, and other miscellaneous instructions not requiring a partition parameter are encoded using the type 2 format. The fields in the encoding are as follows:| Filed name | Bits | Contents |
|---|---|---|
| Opcode | 0-5 | Instruction opcode |
| Reg | 6-11 | Instruction operand 1 (typically denotes register) |
| Reg2 | 12-31 | Instruction operand 2 (typically encodes 20 bit signed constant) |
The instructions encoded in type 2 format are:
LOADC, JUMP, JUMPZ, JUMPNZ, JUMPR, HALT, NOP, TRAP
Executable header
The header of the executable object file contains the bootstrap for the user application. Here the initial state of the machine is created for entry point proper into the user application. The header also contains the initial partition creation code required by the applciation. A bootstrap header looks likeCREPAR 0, i, 1 SETIPAR 0 CREPAR 1, c, 1 CREPAR 2, t, 1 CREPAR 3, p1size, p1stride CREPAR ... CREPAR n+2, pnsize, pnstride LOADC 31, nnn LOADC 30, 0 STORE 30, 31, 2 LOADC 31, nnn-2 LOADC 31, nnn-1 JUMP main HALT
| Symbol | Meaning |
|---|---|
| i | Number of cache lines for instruction cache partition |
| c | Number of cache lines for scalar cache partition |
| t | Number of cache lines for stack cache partition |
| pi | User partition i |
| size | The number of lines required for a user partition |
| stride | The stride required for a user partition |
| n | The number of user partitions |
| nnn | Application stack pointer start |
| main | Relative address of aplication entry point |
We can pattern match against this header style to spot linker generated executable files -- for use with debuggers etc.

