On 03/27/11 20:14, Ali Saidi wrote:
> On Mar 27, 2011, at 3:19 PM, Gabe Black wrote:
>
>> On 03/27/11 13:13, Ali Saidi wrote:
>>> On Mar 26, 2011, at 4:48 PM, Korey Sewell wrote:
>>>
>>>> I'm bumping the below e-mail from the users lists to dev. I believe it
>>>> is a legit problem with decode not actually passing back the correct
>>>> value for taken/not taken to the branch predictor when it detects a
>>>> pc-relative, unconditional control branch in decode.
>>>>
>>>> The relevant line in decode_impl.hh is this:
>>>> toFetch->decodeInfo[tid].branchTaken = inst->pcState().branching();
>>> Since it's just resolving unconditional branches (and actually just when 
>>> there is a mis-predict), doesn't that mean branchTaken should = true?
>> Possibly, but that makes the code less general. You could use the
>> advancePC function to get the straight line PC of the next instruction
>> and then compare that with the branch target. If they don't match the
>> branch is taken. Calling execute in decode just to straighten this out
>> doesn't seem like a good idea. Changes from that that ripple into
>> execute seem worse.
> The code doesn't need to be general. In only gets called if the branch in 
> unconditional, by definition that means it must be taken. If you're violently 
> opposed to that, I think Gabe is right, the simplest thing to do is:
> PCState nPc = inst->pcState();
> nPc.advance();
> branchTaken  = nPc.pc() != inst->branchTarget();
>
> Ali
>
>
> _______________________________________________
> m5-dev mailing list
> m5-dev@m5sim.org
> http://m5sim.org/mailman/listinfo/m5-dev

Except you don't want to call advance on the pc, you want to call
advancePC(nPc) on the inst. The inst knows how to advance the PC
properly (next microop, next instruction, both) and the functions that
advance the pc in particular ways aren't going to be available on every
different PCState type.
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to