// R0 = multiplicand, R1 = multiplier movi R0, #6 movi R1, #9 movi R6, #0 movis R6, #0xe0 bl R7, uint16_mult stwi R6, R2, #-3 stwi R0, R2, #-2 /* * If your PART 1 code works, then data memory will contain: * - at address 0xfffd the value 0xe000 * - at address 0xfffe is the product (should be 0x0036) * - at address 0xffff the value 0xf4c1 */ halt #0x401 /*** --- DO NOT EDIT THIS LINE OR ANYTHING ABOVE THIS LINE --- ***/ /* YOUR FILE-HEADER COMMENT HERE */ uint16_mult: /** * Implement assembly code for this C function: * uint16_t uint16_mult(uint16_t i1, uint16_t i2); * * This function performs 16-bit unsigned integer multiplication of @a * i1 and @a i2, returning the 32-bit product. * * SPECIAL RESTRICTION: You may only use addition, subtraction, * shifts, rotate, bitmasks, compare, and branch operations. You * may not use any built-in multiplication, division, * nor modulo division instructions for this part. * * As a reminder, ULNAv2-C uses this calling convention: * R0 - holds first function parameter, and holds return value * R1 - holds second function parameter * R2-R5 - callee saved * R6 - stack pointer * R7 - link register (holds return address) * You are responsible for preserving registers R2-R5, and restoring * the stack when you are done. */ /* YOUR PART 1 CODE HERE */ br R7