-
Hi all. Gem5 beginner here. I'm trying to hack the simulator to add a new SimObject and invoke one of its methods through a pseudo instruction. I've registered my pseudo instruction in these files
Then I add the line Is this the right way to go about this? Where can I instantiate |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @kaplannp, I would propose you another design to to achieve your desired behavior. Usually, you can configure peripherals (I assume that your SimObject is a peripheral) by writing to memory mapped registers. They are also used to trigger specific tasks. So I suggest that you implement register(s) in your SimObject that corresponds to your task(s). When write, for example, a 1 to a task register, you then call your member function. Gem5 already offers you register banks that you can use to implement registers (see |
Beta Was this translation helpful? Give feedback.
Hi @kaplannp,
I would propose you another design to to achieve your desired behavior.
Usually, you can configure peripherals (I assume that your SimObject is a peripheral) by writing to memory mapped registers. They are also used to trigger specific tasks. So I suggest that you implement register(s) in your SimObject that corresponds to your task(s). When write, for example, a 1 to a task register, you then call your member function.
Gem5 already offers you register banks that you can use to implement registers (see
src/dev/reg_bank.hh
). Take a look in SimObjects where they are used to learn how they work. For example, they are part ofPlic
andClint
(src/dev/riscv/*
)