Search code examples
gem5

How I can run my own programs in gem 5? suppose I want to sort 1 thousands numbers, for that I want to make the program and then want to run?


I am new in gem5. I have downloaded, build run a simple hello world program. Now I want to run my own programs like finding a prime no. I have some questions related to this.. 1. How I can run my own programs? 2. How I can set my own parameters in gem.How? 3. How much knowledge of Python I must have to learn it?


Solution

  • How can I run my own programs

    First you have to decide if you will run full system or syscall emulation.

    The tradeoffs are discussed at: When to use full system FS vs syscall emulation SE with userland programs in gem5?

    For full system, here is an easy to use setup: https://github.com/cirosantilli/linux-kernel-module-cheat/tree/8815312cad053d0284c4d91bfbf36a1e9ea207af#gem5-buildroot-setup-getting-started You can just add your program next to the other userland programs at packages/lkmc/userland.

    For syscall emulation, get started with: How to compile and run an executable in gem5 syscall emulation mode with se.py?

    How I can set my own parameters in gem5

    Hard to answer without which parameter you have in mind. Generally:

    • fs.py --param for simpler things
    • more complex Python script options / patches for more complex things
    • touch the C++ core for even more complex / perf critical things

    How much knowledge of Python I must have to learn it?

    Python is easy, just try to do stuff, and Google away until you know enough.