Hi Nate,

Thanks for the clarification.

I can assure you that introducing the CycleCount wrapper is also quite a pain 
in the butt :). There are 100's of places in the O3 and inorder CPU that are 
affected as they use Tick/int/unsigned in various combinations to represent 
cycle counts. Making it a strict wrapper has hopefully chased out all those 
locations though. Fingers crossed...

When it comes to the template it makes perfect sense. I think I'll save that 
for a follow-up patch though. It's a clever idea!


Andreas

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of nathan binkert
Sent: 02 August 2012 17:56
To: Andreas Hansson
Cc: Steve Reinhardt; gem5 Developer List; Ali Saidi
Subject: Re: [gem5-dev] Review Request: Clock: Rework clocks to avoid 
tick-to-cycle transformations

> I think a wrapper class make sense and it would indeed present a huge 
> reduction in the risk of mixing ticks and cycle counts. We could also do it 
> the other way round and make ticks a wrapper (or both). What makes more sense?

I'd prefer to see both wrappers, but I worry that there's just too
much math on ticks that will make it a major pain in the butt to get
working.  Hard to say.

> I am not sure I understand the template idea. Won't it still be possible to 
> have e.g different objects of the same type using each others cycle counters 
> by mistake? What would the templated type be?

template <class T>
class Clock
{
    ....
};


You just don't use the "T" anywhere.  It's there to force each class
to be a different type.  If there are places where you want to take
any kind of Clock object, you can simply templatize those functions on
T as well (and T ought to be inferred if it is a function paramater).
The class T that you use can either be a dummy class like "namespace {
class Foo {}; } typedef Clock<Foo> MyClock;"  or it can be whatever
type you have handy, perhaps BaseCPU.

Make sense?

  Nate


-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  Thank you.

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

Reply via email to