Arm/memsize

From ASMBits

Consider a memory array of with A address lines and D data lines. What is the capacity of this memory (in bits)?

Write a function that returns the memory capacity (in bits). The capacity will not overflow a 32-bit unsigned integer.

unsigned int memsize(unsigned int A, unsigned int D);

Expected solution length: Around 4 lines.

Sample Input

memsize(12, 8)

Sample Output

r0=32768

Write your solution here

x
 
1
.global _start
2
_start:
3
    ldr r0, =12 // 12 address lines
4
    ldr r1, =8  // 8 data lines
5
    bl memsize
6
1:  b 1b    // Done
7
8
memsize:
9
    
10
    
Upload a source file...