Arc Assembly Language Code (Simplified SPARC Code)
This document describes the instruction set for the Arc Assembly language, which is a simplified version of the SPARC instruction set. It lists the different instruction types including data transfer, branch, arithmetic, and logic instructions and provides examples of the symbolic representation and description of some of the most common instructions.
Arc Assembly Language Code (Simplified SPARC Code)
This document describes the instruction set for the Arc Assembly language, which is a simplified version of the SPARC instruction set. It lists the different instruction types including data transfer, branch, arithmetic, and logic instructions and provides examples of the symbolic representation and description of some of the most common instructions.
Arc Assembly language code (simplified SPARC code)
Instruction Symbolic Rep. Description
type Data Transfer ld [x], %r1 load %r1 with the contents of X ld %r0+x, %r1 load %r1 with the from the address of %r0+x st %r1, [x] store the contents of %r1 in X st %r1, %r0+x store the contents of %r1 in the address of %r0+x Branch be label Branch when z condition is 1 to label bne label Branch when z condition is 0 to label bcs label Branch when c condition is 1 to label bcc label Branch when c condition is 0 to label bneg label Branch when n condition is 1 to label bpos label Branch when n condition is 0 to label bvs label Branch when v condition is 1 to label bvc label Branch when v condition is 0 to label ba label Branch to label jmpl %r15+4, %r2 set the PC to %r15+4 and set current PC in %r2 call label branch to the label, and put PC of call instruction in %r15 Condition z,c,n,v are set by arithmetic and logic opcodes n =1, when negative z =1, when zero v =1, when overflow c =1, when carry Arithmetic addcc %r1, %r2, %r3 %r3 = %r1 + %r2 (or number) and set condition codes add %r1, %r2, %r3 %r3 = %r1 + %r2 (or number) subcc %r1, %r2, %r3 %r3 = %r1 - %r2 (or number) and set condition codes sub %r1, %r2, %r3 %r3 = %r1 - %r2 (or number) srl %r1, %r2, %r3 Shift %r1 right by the value in %r2 (or number) and store in %r3. Vacant bits are filled with 0 sll %r1, %r2, %r3 Shift %r1 left by the value in %r2 (or number) and store in %r3. Vacant bits are filled with 0 sra %r1, %r2, %r3 Shift %r1 right by the value in %r2 (or number) and store in %r3. The sign bit is replicated as the value is shifted. Logic orcc %r1, %r2, %r4 %r4 = %r1 OR %r2 (or number) and set N and Z conition or %r1, %r2, %r3 %r3 = %r1 OR %r2 (or number) andcc %r1, %r2, %r3 $r3 = %r1 AND %r2 (or number) and set N and Z conition and %r1, %r2, %r3 $r3 = %r1 AND %r2 (or number) Program markers halt Stops the simulator nop Performs no operation, but increments the program counter .begin start of assembly code .end end of assembly code ! comment. Begins with ! and continues to end of line. .org 2048 Start assembly code at address 2048