Hi Andrea,
This is definitely possible with Sniper, although it will take a bit
of work depending on the level of detail at which you want to model
this (but given Sniper's abstraction level I'd say it would be a lot
more doable than on other, more detailed simulators).
Functional side: The easiest thing would be to use magic instructions
for this. In your application, #include <sim_api.h>, then call
SimUser(a, b) to execute a new instruction. You can use a and b to
encode arguments or instruction type, and expect a return value (all
uint64_t). If needed one of those arguments can point to a struct with
more parameters. The functional emulation can go in
pin/instruction__modeling.cc:handleMagic(), here you can look at a and
b (in the rbx and rcx registers) and do the proper thing, potentially
changing the application's state (use Pin's PIN_SetContextReg),
updating other per-thread state to simulate extra registers (extend
the ThreadLocalStorage structure for that), or returning a value
through the rax register.
Timing side: I think doing a
core->getPerformanceModel()->queueDynamicInstruction(), using your own
subclass of Instruction as the argument, from your functional emulator
is probably the easiest way to get the instructions into the timing
model. You'll see these come out in PerformanceModel::iterate() where
you can add the required modeling: i.e. advance time, do memory
accesses (which will follow the normal path through the memory
hierarchy) using core->accessMemory(), etc.
Note that your new ISA extensions, by using magic instructions, will
be NOPs if you execute this application natively. You can use
SimInSimulator(), also defined in sim_api.h, to figure out whether
you're running in the simulator or not.
I know I've probably been a bit vague here at points, but I don't know
exactly what you'll need -- so hopefully this will allow you to get
started and do let us know if you need more information.
Regards,
Wim
[1]
http://software.intel.com/sites/landingpage/pintool/docs/55942/Pin/html/group__CONTEXT__API.html#ga3f8746ccdac1c1fbcb2e2f3f3cd7bcb
> --
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Sniper simulator" group.
> To post to this group, send email to
snip...@googlegroups.com
> To unsubscribe from this group, send email to
>
snipersim+...@googlegroups.com
> For more options, visit this group at
>
http://groups.google.com/group/snipersim?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Sniper simulator" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
snipersim+...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>