riscv-non-isa / riscv-trace-spec

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

How to deal with ecause match when exception nesting happens #176

Closed zhangdujiao closed 1 week ago

zhangdujiao commented 1 week ago

The ecause_match should be asserted when ecause from ingress port equal trTeFilterMatchChoiceEcause, and deasserted when itype=3 (exception return), right? For the exception nesting: t1: itype=1, //1st exception, ecause_match=1 t2: itype=1, //2nd exception t3: itype=3, //2nd exception return t4: itype=3, //1st exception return, ecause_match=0

The ecause_match should cover the inst. flow from t1~t4, but how to distinguish the exception return from 2nd exception and 1st exception? The ecause_match may be deasserted at t3 instead.

IainCRobertson commented 1 week ago

Dujiao, Yes that's exactly right. For nested exceptions, my recommendation is to implement a counter, incremented by itype 1 or 2 and decremented by itype 3. With this you can keep track of how deeply nested the exceptions are, and ensure you don't turn the match off until you return from the outermost exception.

Iain

From: Dujiao @.> Sent: 23 November 2024 03:36 To: riscv-non-isa/riscv-trace-spec @.> Cc: Subscribed @.***> Subject: [riscv-non-isa/riscv-trace-spec] How to deal with ecause match when exception nesting happens (Issue #176)

The ecause_match should be asserted when ecause from ingress port equal trTeFilterMatchChoiceEcause, and deasserted when itype=3 (exception return), right? For the exception nesting: t1: itype=1, //1st exception, ecause_match=1 t2: itype=1, //2nd exception t3: itype=3, //2nd exception return t4: itype=3, //1st exception return, ecause_match=0

The ecause_match should cover the inst. flow from t1~t4, but how to distinguish the exception return from 2nd exception and 1st exception? The ecause_match may be deasserted at t3 instead.

- Reply to this email directly, view it on GitHubhttps://github.com/riscv-non-isa/riscv-trace-spec/issues/176, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQOPSWHYEAZTECIVLQWEK32B7ZZ5AVCNFSM6AAAAABSKTEZMCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY4DKMRTGAZTOMA. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

zhangdujiao commented 1 week ago

For nested exceptions, my recommendation is to implement a counter, incremented by itype 1 or 2 and decremented by itype 3

Brilliant, thanks Iain.