Introduction
File Name Conventions
Files written in the PREASM language are, by convention, appended with a suffix of .preasm to distinguish them from other file types.Comments
To provide the programmer with a means of documenting their source code, the PREASM language supports comments. Comments begin with a ; and extend to the end of the line.Instructions
The instructions for the PREASM language are grouped, for readability, into several types :- Load & Store Instructions.
- Arithmetic & Logic instructions.
- Branching & Procedural Instructions.
- Partitioning Instructions.
- Misc Instructions.
Load & Store instructions
Memory load and store instructions take a partition parameter that has no effect on non-partitioned cache implementations.LOADC RDest, Constant
Load the literal value Constant into register RDest.MOV RDest, RSource
Copy the value in register RSource to register RDest.LOAD RDest, RAddress, ParNum
Load into register RDest the word from the memory location given in register RAddress. The cache partition ParNum is used to cache this memory access.LOADIDX RDest, RBase, RAddress, ParNum
Load into register RDest the word from the memory location given as the sum of registers RBase and RAddress. The cache partition ParNum is used to cache this memory access.STORE RSource, RAddress, ParNum
Store the contents of register RSource in memory at the location given in register RAddress. The cache partition ParNum is used to cache this memory access.STOREIDX RSource, RBase, RAddress, ParNum
Store the contents of register RSource in memory at the location given as the sum of registers RBase and RAddress. The cache partition ParNum is used to cache this memory access.
Arithmetic & Logic instructions
All arithmetic and logic instructions are register-register based, and can have assumed natural semantics. They are briefly described here for completeness. All comparison operations are on signed values.Arithmetic Instructions
ADD RDest, RSource1, RSource2
RDest=RSource1+RSource2.SUB RDest, RSource1, RSource2
RDest=RSource1-RSource2.MUL RDest, RSource1, RSource2
RDest=RSource1*RSource2.DIV RDest, RSource1, RSource2
RDest=RSource1/RSource2.MOD RDest, RSource1, RSource2
RDest=RSource1%RSource2.LS RDest, RSource1, RSource2
RDest=RSource1<< RSource2.RS RDest, RSource1, RSource2
RDest=(signed)RSource1>>RSource2.RSU RDest, RSource1, RSource2
RDest=(unsigned)RSource1>>RSource2.Logic Instructions
NOT RDest, RSource
RDest=~RSource.AND RDest, RSource1, RSource2
RDest=RSource1&RSource2.OR RDest, RSource1, RSource2
RDest=RSource1|RSource2.XOR RDest, RSource1, RSource2
RDest=RSource1^RSource2.LT RDest, RSource1, RSource2
RDest=RSource1< RSource2.GT RDest, RSource1, RSource2
RDest=RSource1>RSource2.EQ RDest, RSource1, RSource2
RDest=RSource1==RSource2.
Branching & Procedural instructions
Branches are immediate (no pipelining simulation).JUMP Label
Jump to Label.JUMPR RTarget
Jump to the address in register RTarget.JUMPZ RCond, Label
Jump to Label if register RCond contains zero.JUMPNZ RCond, Label
Jump to Label if register RCond is not zero.
Partitioning instructions
Partition instructions have no effect on non-partitioned cache implementations.CREPAR ParNum, Size, Stride
Create partition named ParNum, with Size lines, with stride Stride. Size is a power of 2, and the implementable strides are governed by the partitioned cache implementation.DELPAR ParNum
Delete partition named ParNum. The partition name is now free for reuse.INVPAR ParNum
Invalidate partition named ParNum. All lines of this partition are invalidated (valid bit set to false).SETIPAR ParNum
Set the current instruction partition to ParNum. All further accesses to instructions will be routed through this partition.UPDPAR RSource, RBase, RAddress, ParNum
Update the value in the specified address within partition ParNum with the specified value.
Misc instructions
These are instructions that don't fit in anywhere else.NOP
Perform no operation.TRAP
Cause a trap to occur in the operating system layer of the machine.HALT
A pseduo-instruction which causes the similator to stop.
Directives
To allow slightly more complex assembly support, directives can be used to introduce some structure into .PREASM programs :- .ALIGN
- .CONSTANT_SEGMENT and .END_CONSTANT_SEGMENT
- .DATA
- .DATA_SEGMENT and .END_DATA_SEGMENT
- .DATA_PARTITION and .INSTRUCTION_PARTITION
- .MACRO and .END_MACRO
- .INSTRUCTION_SEGMENT and .END_INSTRUCTION_SEGMENT
- Labels
- .PUBLIC, .PRIVATE and .EXTERN
- .STRING

