The assembler is fairly simple, a line is broken up into the following components.
SECTION LABEL VALUE COMMENT
SECTION
is one of .code
, .data
, or .value
.
LABEL
is an identifier (any valid C identifier) followed by a colon.
VALUE
is either an instruction or data value, such as integer number, char, or string as would be entered in C.
COMMENT
starts with a #
at continues to the end of the line.
This should be a simplified form of MIPS assembly, just note that all registers must be prefixed by a $
.
Note that the assembler outputs a 32 bit image, a utility script 32to64
has been written to convert that to 64 bit
image used by verilog (and the sim-nc
simulator)
The assembler includes pseudo-instructions VADD and VMUL.
For instance
sends the
VADD $RD, $RS, $RT, IMM
ADD $RD, $RS, $RT
to the IMM
instruction in LSC.
For effiency it is recommended that you store the various instructions you need in .text
,
rather than loading and storing words when writing your final version of code that uses the LSC.
This psuedo-instruction is provided for convience not efficiency.