ARM assembly assignment

profileSherry.khan
VisualARMProjectPrograms-2.pdf

Prof. Pitts CS556AH1: Computer Architecture Fall 2019

ARM Programming Project For this project, you'll use the subset of ARM instruction provide by the VisUAL emulator to implement the algorithms given below in ARM assembly language. You'll submit your ARM assembly language programs through Canvas as a ZIP file.

The programs that you will translate into ARM instructions are shown below. See the previous PDFs for information regarding the VisUAL ARM emulator.

// in this program, rotateRight is a functions that // rotates the first argument right by the number of // bits specified in the second argument. That is, // rotateRight(orig - key, 16) rotates the results // of the subtraction right by 16 bits and returns // returns the result. Note, ARM provides this // as an instruction. The "^" denotes the exclusive // or operation int orig = 5555; int encrypted = 0; int decrypted = 0; int key = 55; encrypted = rotateRight(orig - key, 16) ^ key; decrypted = rotateRight(encrypted ^ key) + key

// Note there is no multiply instruction in // the subset of the ARM instruction set // supported by the emulator. Use addition // to simulate the multiplication by two.

int [] one = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} int [] two = {10, 9, 8 ,7, 6, 5, 4, 3, 2, 1}; int accumulate = 0; for( i = 0, i < 10, i++)

accumulate += 2*one[i] + 2*two[i]

// to perform the remainder of the division by two // you can simply check whether the lowest bit of // each array element is zero or one. int [] vals = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int [] results = new int[10];

int count = 0; int bnd = 10;

while (count < bnd) { if ( vals[count] % 2 == 0 )

results[count] = vals[count] * 2; else

results[count] = vals[count] + 1; }

// compute the greatest common divisor int num1 = 36; int num2 = 54; int gcd = 0;

while ( num1 != num2 ) { while ( num1 > num2) {

num1 = num1 - num2; } while ( num2 > num1 ) {

num2 = num2 - num1; }

} gcd = num2;

1/1

  • ARM Programming Project