On Wed, Jun 22, 2011 at 12:18 PM, nathan binkert <[email protected]> wrote:
>> ... but just to be clear, I'm saying let's keep readBytes/writeBytes
>> as the official ExecContext interface, but provide global templates
>> that map basic data types like uint64_t to those functions as a
>> convenience for when they can be used (but these templates can be
>> bypassed when appropriate).  Then we can hide the byte swapping and
>> tracing goop inside those templates in the typical case.
>
> The write templates in AtomicSimpleCPU and base_dyn_inst are
> different.  I don't see how they become global.  Also, I think that
> the the need to have many specializations of read and write stems from
> the improper implementation of those templates.  (base_dyn_inst)
> doesn't need specializations.  It should be possible for us to write
> the templates for read/write in such a way that they only need to know
> the ISA (endianness).

You're comparing this:

BaseDynInst<Impl>::write(T data, Addr addr, unsigned flags, uint64_t *res)
{
    if (traceData) {
        traceData->setData(data);
    }
    data = TheISA::htog(data);
    return writeBytes((uint8_t *)&data, sizeof(T), addr, flags, res);
}

with this:

AtomicSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
{
    uint8_t *dataPtr = (uint8_t *)&data;
    if (traceData)
        traceData->setData(data);
    data = htog(data);

    Fault fault = writeBytes(dataPtr, sizeof(data), addr, flags, res);
    if (fault == NoFault && data_write_req.isSwap()) {
        *res = gtoh((T)*res);
    }
    return fault;
}

and you don't think they look very similar?  We'd have to figure out where
*res gets updated in O3 and InOrder, but other than that they look the same
to me.  Now that I see how similar they are I'm surprised you aren't anxious
to eliminate the redundancy...

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

Reply via email to