12.07.2015 Views

MAXQ Core Assembly Guide - Maxim

MAXQ Core Assembly Guide - Maxim

MAXQ Core Assembly Guide - Maxim

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>MAXQ</strong> <strong>Core</strong> <strong>Assembly</strong> <strong>Guide</strong>Automatic PrefixingAll <strong>MAXQ</strong> instructions are the same size – a single 16 bit word. However, certain operations require moreinformation than will fit in that 16 bit space. For these operations, a prefixing instruction must be used to preloadthe additional information required before the instruction is executed. This additional information is stored in thePrefix (PFX) register.Prefixing is required under the following circumstances.• When using a 16-bit immediate value as a source, and the high byte of that immediate value is nonzero.• When using a 24-bit/32-bit immediate value as a source, and the high byte(s) of that immediate value arenonzero (MaxQ30 core only).• When accessing any register with an index greater than 15 as a source.• When accessing any register with an index greater than 7 as a destination.For these types of operations, prefix instructions will be generated automatically by MaxQAsm. The following listfile shows examples of operations which do and do not require prefixing.Line: Addr: Opcode======================1:2: 0000: 0955 move A[0], #055h ; No prefix - 8 bit immediate3: 0001: 0934 move A[0], #00034h ; No prefix - high byte is zero4: 0002: 0B124: 0003: 0934 move A[0], #01234h ; Prefix for nonzero high byte5: 0004: 2B005: 0005: 0955 move A[8], #055h ; Prefix for 8+ index destination6: 0006: 89F0 move A[0], M0[0Fh] ; No prefix7: 0007: 1B007: 0008: 8900 move A[0], M0[10h] ; Prefix for 16+ index source8: 0009: 3B008: 000A: 8900 move A[8], M0[10h] ; Prefix for source+destination9:10: endManual PrefixingIt is possible to perform the required prefixing operations explicitly in assembly code by including the requiredprefixing instructions. This allows precise control of the code generated and opens up a few additional possibilitiesfor operations.Information loaded into the Prefix register PFX remains there for a single cycle only (except for the MaxQ30 core),so the prefixing instruction(s) must always come immediately before the instruction that requires the prefixinformation. The <strong>MAXQ</strong> core ensures that the instruction sequence will never be interrupted by generating aninterrupt exception window (see the <strong>MAXQ</strong> Family User’s <strong>Guide</strong> for more details) when the PFX register is loaded.To provide the high nonzero byte for a 16-bit immediate source, all that is required is to load the PFX register withthe high byte value.is equivalent to...2: 0000: 0B122: 0001: 0934 move A[0], #01234h4: 0002: 0B12 move PFX[0], #012h5: 0003: 0934 move A[0], #034hVersion 1.2 22 of 43 March 7, 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!