riscv-non-isa / riscv-trace-spec

RISC-V Processor Trace Specification
https://jira.riscv.org/browse/RVG-88
Creative Commons Attribution 4.0 International
152 stars 47 forks source link

How to handle cm_popret while decoding? #92

Closed summorey22 closed 6 months ago

IainCRobertson commented 7 months ago

You haven't given any detail, so I don't know exactly what your concern is here, but it should be as simple as including cm_popret as one of the opcodes that causes the 'is_inferable_jump' function in the decoder pseudo code to return true.

summorey22 commented 7 months ago

Got it.

I have recently started exploring this topic and I am still studying it. That's why I didn't have a clear idea of how to classify this particular instruction.

According to the pseudocode for inferable jump, we would add the immediate bits in the instruction to the current pc to determine next pc. Is that enough to determine the next pc, or would it require the encoder to give an extra packet?

IainCRobertson commented 7 months ago

Sorry - a small typo totally changed my intended meaning and has sent you off in the wrong direction. popret is an uninferable jump, and the affected function is 'is_uninferable jump'. The program returns to the value stored in ra, which is popped from the stack. The decoder cannot infer this value. The encoder will output a packet containing the target address of this return.