0

How can I test the memory footprints programs written for a RISC and a CISC processor?

Which one would require more memory and why?

user366312
  • 16,949
  • 65
  • 235
  • 452

1 Answers1

0

So, the way I would do this is via experimentation. I would compile binaries for both types of architectures and then use gcc tools to see what the memory footprints are. For the following examples, I will compare x86_64 and RISCV architectures. First method I would use is the size tool which breaks down the various portions of an elf and reports the size.

 # riscv64-unknown-elf-size Test.elf

Which will output something like this

   text    data     bss     dec     hex filename
 XXXXXX     XXX XXXXXXX XXXXXXX  XXXXXX Test.elf

Then compare that to the x86 version:

 # size Test.exe

Which will output something like this

   text    data     bss     dec     hex filename
 XXXXXX     XXX XXXXXXX XXXXXXX  XXXXXX Test.exe

The other method is to convert your elf to a straight binary that will be bit for bit what is put into your memory ( this may not be true for more complex memory architectures, but we'll assume a simple case where it is all stored and executed from a RAM ). The tool for that is objcopy.

 # riscv64-unknown-elf-objcopy -O binary Test.elf Test.elf.bin
 # objcopy -O binary Test.exe Test.exe.bin

Then check the sizes of the two resulting bin files.

FeelTheBurns
  • 1,065
  • 2
  • 8
  • 14