LM£" Dependent Features
***********************

Options
=======

-mmultiply-enabled
     Enable multiply instructions.

-mdivide-enabled
     Enable divide instructions.

-mbarrel-shift-enabled
     Enable barrel-shift instructions.

-msign-extend-enabled
     Enable sign extend instructions.

-muser-enabled
     Enable user defined instructions.

-micache-enabled
     Enable instruction cache related CSRs.

-mdcache-enabled
     Enable data cache related CSRs.

-mbreak-enabled
     Enable break instructions.

-mall-enabled
     Enable all instructions and CSRs.

Syntax
======

Register Names
--------------

LM32 has 32 x 32-bit general purpose registers r0, r1, ... r31.

The following aliases are defined: gp - r26, fp - r27, sp - r28, ra - r29, ea - r30, ba - r31.

LM32 has the following Control and Status Registers (CSRs).

IE
     Interrupt enable.

IM
     Interrupt mask.

IP
     Interrupt pending.

ICC
     Instruction cache control.

DCC
     Data cache control.

CC
     Cycle counter.

CFG
     Configuration.

EBA
     Exception base address.

DC
     Debug control.

DEBA
     Debug exception base address.

JTX
     JTAG transmit.

JRX
     JTAG receive.

BP0
     Breakpoint 0.

BP1
     Breakpoint 1.

BP2
     Breakpoint 2.

BP3
     Breakpoint 3.

WP0
     Watchpoint 0.

WP1
     Watchpoint 1.

WP2
     Watchpoint 2.

WP3
     Watchpoint 3.

Relocatable Expression Modifiers
--------------------------------

The assembler supports several modifiers when using relocatable addresses in LM32 instruction operands.  The general syntax is the following:

     modifier(relocatable-expression)

lo

     This modifier allows you to use bits 0 through 15 of an address expression as 16 bit relocatable expression.

hi

     This modifier allows you to use bits 16 through 23 of an address expression as 16 bit relocatable expression.

     For example

          ori  r4, r4, lo(sym+10)
          orhi r4, r4, hi(sym+10)

gp

     This modified creates a 16-bit relocatable expression that is the offset of the symbol from the global pointer.

          mva r4, gp(sym)

got

     This modifier places a symbol in the GOT and creates a 16-bit relocatable expression that is the offset into the GOT of this symbol.

          lw r4, (gp+got(sym))

gotofflo16

     This modifier allows you to use the bits 0 through 15 of an address which is an offset from the GOT.

gotoffhi16

     This modifier allows you to use the bits 16 through 31 of an address which is an offset from the GOT.

          orhi r4, r4, gotoffhi16(lsym)
          addi r4, r4, gotofflo16(lsym)

Special Characters
------------------

The presence of a # on a line indicates the start of a comment that extends to the end of the current line.  Note that if a line starts with a # character then it can also be a logical line number directive (see Comments) or a preprocessor control command (see Preprocessing).

A semicolon (;) can be used to separate multiple statements on the same line.

Opcodes
=======

For detailed information on the LM32 machine instruction set, see http://www.latticesemi.com/products/intellectualproperty/ipcores/mico32/.

AS implements all the standard LM32 opcodes.