Read and save to memory

Write a program that loads 2 32-bit values from memory starting at the adress 0x400 into two registers (a0 and a1). Then add the values in a0 and a1, and store the result in a2. Save the result in memory after the two values that were loaded.

Input: Loading of values from memory.
In: Two values in memory starting at address 0x400.
Out: The values in registers, the sum in register a2, and the sum in memory after the two values.

Your program will be run with the following arguments: --d-regs --dump-cycles --cycle-limit 100 --asm submission.S
Your program will be scored by this following metric: Runtime of the program in cycles.

For interactive solution, you can use QtRvSim. The web version of the simulator is located here.
Top Scores (cycles)
  • mistrjirka
    5
  • nkin
    5
  • _
    5
  • maxamart
    8
  • reference
    14