CoolRISC TM Quick reference for the CoolRISC 816 Instruction set Instruction Modification Jump addr(16bits) or ip Jcc addr(16bits) or ip Call addr(16bits) or ip Calls addr(16bits) or ip Ret Rets Reti Push Pop Move reg,#data(8bits) Move reg1,reg2 Move reg,eaddr Move eaddr,reg Move addr(8bits),#data(8bits) Cmvd reg1,reg2 Cmvs reg,eaddr -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,Z,a -,-,Z,a -,-,Z,a -,-,-,-,-,-,-,-,Z,a -,-,Z,a Shl reg1,reg2 Shl reg Shl reg,eaddr Shlc reg1,reg2 Shlc reg Shlc reg,eaddr Shr reg1,reg2 Shr reg Shr reg,eaddr Shrc reg1,reg2 Shrc reg Shrc reg,eaddr Shra reg1,reg2 Shra reg Shra reg,eaddr Cpl1 reg1,reg2 Cpl1 reg Cpl1 reg,eaddr Cpl2 reg1,reg2 Cpl2 reg Cpl2 reg,eaddr Cpl2c reg1,reg2 Cpl2c reg Cpl2c reg,eaddr C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a -,-,Z,a -,-,Z,a -,-,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a Rev 1 February 2006 Inc reg1,reg2 Inc reg Inc reg,eaddr Incc reg1,reg2 Incc reg Incc reg,eaddr Dec reg1,reg2 Dec reg Dec reg,eaddr Decc reg1,reg2 Decc reg Decc reg,eaddr And reg,#data(8bits) And reg1,reg2,reg3 And reg1,reg2 And reg,eaddr Or reg,#data(8bits) Or reg1,reg2,reg3 Or reg1,reg2 Or reg,eaddr Xor reg,#data(8bits) Xor reg1,reg2,reg3 Xor reg1,reg2 Xor reg,eaddr Add reg,#data(8bits) Add reg1,reg2,reg3 Add reg1,reg2 Add reg,eaddr Addc reg,#data(8bits) Addc reg1,reg2,reg3 Addc reg1,reg2 Addc reg,eaddr Subd reg,#data(8bits) Subd reg1,reg2,reg3 Subd reg1,reg2 Subd reg,eaddr Subdc reg,#data(8bits) Subdc reg1,reg2,reg3 Subdc reg1,reg2 Subdc reg,eaddr Subs reg,#data(8bits) Subs reg1,reg2,reg3 Subs reg1,reg2 Subs reg,eaddr Subsc reg,#data(8bits) Subsc reg1,reg2,reg3 Subsc reg1,reg2 Subsc reg,eaddr Mul reg,#data(8bits) Mul reg1,reg2,reg3 Mul reg1,reg2 Mul reg,eaddr Mula reg,#data(8bits) Mula reg1,reg2,reg3 Mula reg1,reg2 Mula reg,eaddr C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a -,-,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a u,u,u,a u,u,u,a u,u,u,a u,u,u,a u,u,u,a u,u,u,a u,u,u,a u,u,u,a Mshl reg,#shift(3bits) Mshr reg,#shift(3bits) Mshra reg,#shift(3bits) u,u,u,a u,u,u,a * u,u,u,a Cmp reg,#data(8bits) Cmp reg1,reg2 Cmp reg,eaddr Cmpa reg,#data(8bits) Cmpa reg1,reg2 Cmpa reg,eaddr Tstb reg,#bit(3bit) Setb reg,#bit(3bit) Clrb reg,#bit(3bit) Invb reg,#bit(3bit) C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a C,V,Z,a Z,a Z,a Z,a Z,a Sflag Rflag reg Rflag eaddr -,-,-,a C,V,Z,a C,V,Z,a Freq divn Halt Nop -,-,-,-,-,-,-,-,-,- Pmd #s -,-,-,U = undefined *MSHR reg,#1 doesn’t shift by 1 Addressing mode eaddr Parameters addr:8 (ix) (ix, offset:8) (ix, r3) (ix)+ (ix, offset:7)+ -(ix) -(ix, offset:7) Data Memory (DM) access DM(addr) DM(ix) DM(ix+offset) DM(ix+r3) DM(ix) DM(ix) DM(ix-1) DM(ix-offset) Index update ix←ix+1 ix←ix+offset ix←ix-1 ix ← ix-offset Jump condition cc 11 Conditions CS CC ZS ZC VS VC EV EQ NE GT GE LT LE Test C=1 C=0 Z=1 Z=0 V=1 V=0 (EV0 OR EV1) = 1 After CMP d, s d=s d≠s d>s d≥s d<s d≤s www.semtech.com Various ip ix Program Memory Index 4 Data Memory (DM) Indexes i0, i1, i2, i3 nodiv, div2, div4, div8, div16 divn Interrupt Interrupt ALL address IN0 3 IN1 1 IN2 2 Priority Highest Medium Lowest Directives .cpu n .altregsyn n .abort Registers 16 Registers reg reg1 r0 reg2 r1 reg3 r2 r3 i0l i0h i1l i1h i2l i2h i3l i3h ipl iph stat a DM offset i0[7:0] i0[15:8] i1[7:0] i1[15:8] i2[7:0] i2[15:8] i3[7:0] i3[15:8] ip[7:0] ip[15:8] status accu I E 2 E V 0 I E 1 G I E I N 2 I N 1 I N 0 E V 1 Function .align abs-expr, abs-expr .app-file .ascii “string” .asciz “string” .byte expressions .comm symbol, length .data subsection .double flonums .eject .else .endif 7 Stat register © Semtech 2006 0 string Identifies the CoolRISC processor family for which the content of the file was written. “n” value is 816 for the CR816 processor and 88 for the CR88. Defines the use of alternative register naming syntax. If “n” is set to 1, a % character must precede register names. If “n” is set to 0, no preceding % character is required. This directive stops the assembly immediately. Pad the location counter to a particular storage boundary. The fist expression is the alignment required. The second expression gives the value to be stored in the padding bytes. tell GNU-as that we are about to start a new logical file. string is the new file name. It assembles each string into consecutive addresses. Just like .ascii but each string is followed by a zero. Each expression is assembled into the next byte. To declare a variable: variable1: .byte 12 Declares a named common area in the BSS section. Tells GNU-as to assemble the following statements onto the end of the data subsection numbered subsection. It assembles floating point numbers. Force a page break at this point. Is part of the GNU-as support for conditional assembly. Is part of the GNU-as support for conditional assembly. .equ symbol, expression This directive sets the value of symbol to expression. .file string tell GNU-as that we are about to start a new logical file. string is the new file name. This emits repeat copies of size bytes with value. It has the same effect as .single Makes the symbol visible to LD This directive is a synonym for both .short and .word .fill repeat, size, value .float flonums .global symbol .hword expression absolute, expression .ifdef symbol .ifndef symbol .include “file” .int expression .lcomm symbol, length .if .macro macname macargs .endm .exitm .org new-lc .rep count .set symbol, expression .short expressions .skip size, fill .space size,fill .string “str” .text subsection .title “heading” .word expression To include supporting files. Reserve length bytes for a local common denoted by symbol. Begin the definition of a macro called macname. Mark the end of a macro Exit early from the current macro Advance the location counter of the current section. Set the value of symbol to expression Is the same as “.word” This directive emits size bytes, each of value fill. The same as “.skip”. Copy the character in str to the object file. Tells GNU-as to assemble the following statements onto the end of the text subsection. Use heading as the title when generating assembly listings. Declare a variable with two bytes. wwww.semtech.com