On Thu, Jun 23, 2011 at 1:14 AM, Gabe Black <[email protected]> wrote:

> I'm going to hijack the thread a bit and talk about two possible
> templating schemes. One would be what we already had where we just move
> the templates into header files. That has two main advantages. First,
> the CPUs could implement them differently if they really wanted/needed
> to. That's not a great reason since I can't think of any reason that
> would be useful, and also type based decisions are more an ISA level
> thing than a CPU level thing. CPUs should deal in bytes of memory
> primarily and not interpret them. The second benefit is that the trace
> stuff is handled by the CPU where it's traditionally been done before
> and not partially co-opted by the instructions. The instructions do some
> tracing work too by recording their result, so that's not a huge deal
> either. A downside is that the exec context is wider like Steve was
> saying, which means more stuff everywhere it appears, more complication,
> etc.
>
> Another scheme would be to have the templates but make them part of the
> instructions. This has the benefit that they really become helper
> functions instead of an interface layer on top of readBytes and
> writeBytes, and the instructions could define them however they want if
> they need something different. All the ISAs and (indirectly) all the
> CPUs would inherit one implementation in one place. These functions
> would also have access to the trace data structure implicitly, something
> that would have to be passed into a function external to the StaticInsts
> and the CPU. The one real downside to this is that the tracing moves out
> of the CPU and might get a little weirder to implement in some cases
> which aren't immediately obvious to me.
>
> Of these two I would probably prefer the second. We should decide what
> we really want before I take another pass at this.
>

Great summary, that's just what I was thinking (including the preference for
the second).  The one unknown to me is whether the minor differences between
the existing templates can be factored out into other code (like the *res
update in AtomicSimpleCPU::write(); that's the only example I know of, but
there may be others).  Assuming that can be dealt with, I'm definitely in
favor of the second approach.

Steve
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to