From e215ffbe8b9421e4551af019728ed9db58cad654 Mon Sep 17 00:00:00 2001 From: Iain Robertson Date: Mon, 25 Nov 2024 12:19:33 +0000 Subject: [PATCH] Generalized resync behaviour --- exampleAlgorithm.adoc | 15 +- testAlgo.svg | 1764 ++++++++++++++++++++--------------------- 2 files changed, 875 insertions(+), 904 deletions(-) diff --git a/exampleAlgorithm.adoc b/exampleAlgorithm.adoc index 6834b73..64c787b 100644 --- a/exampleAlgorithm.adoc +++ b/exampleAlgorithm.adoc @@ -41,11 +41,10 @@ cycle it occured because it was preceded by an updiscon or immediately followed by another exception; * _resync count._ A counter used to keep track of when it is necessary to send a synchronization packet (see <>); -* _max_resync._ The resync counter value that schedules a -synchronization packet (see <>); -* _resync_br._ The resync counter has reached the maximum value and +* _resync2_br._ The resync FSM is in state 2 and there are entries in the branch map that have not yet been output (see <>). +* _resync3._ The resync FSM is in state 3 (see <>); <> shows instruction by instruction behavior, as would be seen in a single-retirement system only. Whilst the core to @@ -137,9 +136,15 @@ When the resync is required, the primary objective is to output a format needing any of the history. However, if the decoder is already synced, then it is also required that it can continue to follow the execution path up to and through the format 3 packet seamlessly. As such, before -outputting a format 3 packet, it is necessary to output a format 1 +outputting a format 3 packet, it is necessary to output a format 0/1 packet for the preceding instruction if there are any unreported -branches (because format 3 does not contain a branch map). The format 3 +branches (because format 3 does not contain a branch map). There are several supported options for incrementing the resync timer (packets, cycle or instruction half-words), and as such updates to the timer do not necessarily coincide with instrucitn retirements. A small, independent FSM can be used to ensure the required packets are output in the required order, as follows: + + * *State 1*: resync_count < max_resync. Transition to *State 2* when resync_count >= max_resync + * *State 2*: output packet of unreported branches if required, transition to *state 3* + * *State 3*: output sync packet, reset resync_count and transition to *State 1*. + +The format 3 will be sent if the resync timer has been exceeded. On the cycle before this (when the resync timer value has been exactly reached), a format 1 will be generated if the branch map is not empty. diff --git a/testAlgo.svg b/testAlgo.svg index 834c9a3..60ecea0 100755 --- a/testAlgo.svg +++ b/testAlgo.svg @@ -1,927 +1,893 @@ - - + + + xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="4.1289in" height="6.34084in" + viewBox="0 0 297.281 456.54" xml:space="preserve" color-interpolation-filters="sRGB" class="st16"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - Page-1 - - Decision.8 - Last cycle was unpred discon? - - - - - - - - - - - - - - - - - Lastcycle was unpred discon? - - Terminator.108 - Start of cycle - - - - - - - - - - - - - - - - - Start of cycle - - Decision.111 - Qualified? - - - - - - - - - - - - - - - - - Qualified? - - Dynamic connector - - - - - - - - Terminator.138 - End of cycle - - - - - - - - - - - - - - - - - End of cycle - - Sheet.6 - - - - - - - - - - - Sheet.7 - N - - - - - - - - N - - Sheet.8 - Y - - - - - - - - Y - - Sheet.9 - Y - - - - - - - - Y - - Sheet.10 - N - - - - - - - - N - - Process.3 - Send te_inst: format 3 subformat 0 resync count = 0 - - - - - - - - - - - - - - - - - Send te_inst: format 3 subformat 0resync count = 0 - - Sheet.12 - - - - - - - - - - - Process.163 - Send te_inst: format 3 subformat 1 resync count = 0 - - - - - - - - - - - - - - - - - Send te_inst: format 3 subformat 1resync count = 0 - - Dynamic connector.164 - - - - - - - - Sheet.15 - Y - - - - - - - - Y - - Sheet.16 - N - - - - - - - - N - - Sheet.17 - - - - - - - - - - - Dynamic connector.18 - - - - - - - - Sheet.19 - Y - - - - - - - - Y - - Sheet.20 - N - - - - - - - - N - - Dynamic connector.140 - - - - - - - - Process.180 - Send te_inst: format 3 subformat 2 resync count ++ - - - - - - - - - - - - - - - - - Send te_inst: format 3 subformat 2resync count ++ - - Sheet.23 - Y - - - - - - - - Y - - Decision.177 - Context change? - - - - - - - - - - - - - - - - - Contextchange? - - Dynamic connector.181 - - - - - - - - Sheet.26 - - - - - - - - - - - Process.33 - Send te_inst: format 0/1/2 resync count ++ - - - - - - - - - - - - - - - - - Send te_inst: format 0/1/2resync count ++ - - Dynamic connector.80 - - - - - - - - Sheet.29 - Y - - - - - - - - Y - - Sheet.30 - N - - - - - - - - N - - Decision.27 - Next cycle is halt, exception, privilege change, or unqualifi... - - - - - - - - - - - - - - - - - Next cycleis halt, exception,privilege change, or unqualified? - - Dynamic connector.32 - - - - - - - - Dynamic connector.47 - - - - - - - - Decision.1 - Resync pend && Branches > 0? - - - - - - - - - - - - - - - - - Resync pend &&Branches > 0? - - Sheet.35 - Y - - - - - - - - Y - - Sheet.36 - N - - - - - - - - N - - Dynamic connector.37 - - - - - - - - Sheet.38 - - - - - - - - - - - Sheet.39 - N - - - - - - - - N - - Dynamic connector.85 - - - - - - - - Dynamic connector.16 - - - - - - - - Dynamic connector.9 - - - - - - - - Decision.65 - Branch? - - - - - - - - - - - - - - - - - Branch? - - Sheet.44 - Y - - - - - - - - Y - - Sheet.45 - N - - - - - - - - N - - Dynamic connector.38 - - - - - - - - Process.47 - Update branch map - - - - - - - - - - - - - - - - - Update branch map - - Dynamic connector.69 - - - - - - - - Dynamic connector.70 - - - - - - - - Decision.12 - 1st cycle qualified or unhalted, or privilege change or resyn... - - - - - - - - - - - - - - - - - 1st cyclequalified or unhalted, or privilege change or resync_nh? - - Dynamic connector.30 - - - - - - - - Dynamic connector.14 - - - - - - - - Sheet.53 - Y - - - - - - - - Y - - Sheet.54 - N - - - - - - - - N - - Process.28 - Send te_inst: format 0 no address resync count ++ - - - - - - - - - - - - - - - - - Send te_inst: format 0 no addressresync count ++ - - Sheet.56 - - - - - - - - - - - Decision.54 - Branch map full? - - - - - - - - - - - - - - - - - Branch map full? - - Dynamic connector.56 - - - - - - - - Dynamic connector.17 - - - - - - - - Dynamic connector.29 - - - - - - - - Dynamic connector.31 - - - - - + + Sheet.139 + + Decision.8 + Updiscon previous? + + + + + + + + + + + + Updiscon previous? + + Terminator.108 + Start of cycle + + + + + + + + + + + + Start of cycle + + Decision.111 + Qualified? + + + + + + + + + + + + Qualified? + + Dynamic connector + + + + Terminator.138 + End of cycle + + + + + + + + + + + + End of cycle + + Sheet.145 + + + + Sheet.146 + N + + + + N + + Sheet.147 + Y + + + + Y + + Sheet.148 + Y + + + + Y + + Sheet.149 + N + + + + N + + Process.3 + Send te_inst: format 3, subformat 0 resync count = 0 + + + + + + + + + + + + Send te_inst: format 3, subformat 0resync count = 0 + + Sheet.151 + + + + Process.163 + Send te_inst: format 3, subformat 1 thaddr = 1 resync count = 0 + + + + + + + + + + + + Send te_inst: format 3, subformat 1 thaddr = 1resync count = 0 + + Dynamic connector.164 + + + + Sheet.154 + Y + + + + Y + + Sheet.155 + N + + + + N + + Sheet.156 + + + + Dynamic connector.25 + + + + Sheet.158 + Y + + + + Y + + Sheet.159 + N + + + + N + + Dynamic connector.140 + + + + Process.180 + Send te_inst: format 3, subformat 2 + + + + + + + + + + + + Send te_inst: format 3, subformat 2 + + Sheet.162 + Y + + + + Y + + Dynamic connector.181 + + + + Sheet.164 + + + + Process.33 + Send te_inst: format 0/1/2 + + + + + + + + + + + + Send te_inst: format 0/1/2 + + Dynamic connector.80 + + + + Sheet.167 + Y + + + + Y + + Sheet.168 + N + + + + N + + Dynamic connector.30 + + + + Dynamic connector.31 + + + + Decision.1 + resync2_br or er_n? + + + + + + + + + + + + resync2_bror er_n? + + Sheet.172 + Y + + + + Y + + Sheet.173 + N + + + + N + + Dynamic connector.16 + + + + Sheet.175 + + + + Sheet.176 + N + + + + N + + Dynamic connector.85 + + + + Dynamic connector.42 + + + + Dynamic connector.9 + + + + Decision.65 + Branch? + + + + + + + + + + + + Branch? + + Sheet.181 + Y + + + + Y + + Sheet.182 + N + + + + N + + Dynamic connector.38 + + + + Process.55 + Update branch map/predictor + + + + + + + + + + + + Update branch map/predictor + + Dynamic connector.70 + + + + Dynamic connector.52 + + + + Dynamic connector.14 + + + + Sheet.188 + Y + + + + Y + + Sheet.189 + N + + + + N + + Process.28 + Send te_inst: format 0 if pbc ≥ 31 format 1 if pbc < 31 no ad... + + + + + + + + + + + + Send te_inst: format 0 if pbc ≥ 31 format 1 if pbc < 31 no address + + Sheet.191 + + + + Dynamic connector.56 + + + + Dynamic connector.17 + + + + Dynamic connector.29 + + + + Dynamic connector.62 + + + + Decision.39 + Exception previous? + + + + + + + + + + + + Exceptionprevious? + + Sheet.197 + privilege change, precise ppccd_br: context change or context... + + + + privilege change, preciseppccd_br: context change or context change with discontinuity, and branch map not empty + + Sheet.198 + resync FSM state 2 and resync2_br: branch map not empty er_n:... + + + + resync FSM state 2 and resync2_br: branch map not empty er_n: simultaneous exception and retirement, or notify + + Sheet.199 + privilege change, precise ppccd: context change or context ch... + + + + privilege change, preciseppccd: context change or context change with discontinuity + + Sheet.200 + cci: imprecise context change + + + + cci: imprecise context change + + Sheet.201 + + Process.69 + + + + + + + + + + + + Sheet.203 + Decision or action based on previous instruction + + + + Decision or action based on previous instruction + + Process.71 + + + + + + + + + + + + Sheet.205 + Decision or action based on current instruction + + + + Decision or action based on current instruction + + Sheet.206 + Key: + + + + Key: + + Process.76 + + + + + + + + + + + + Sheet.208 + Decision based on next instruction + + + + Decision based on next instruction + + + Sheet.209 + rpt_br: branches=31 & pbc < 31, or pbc ≥ 31 and prediction fa... + + + + rpt_br: branches=31 & pbc < 31, or pbc and prediction failed + + Decision.84 + exc_only? + + + + + + + + + + + + exc_only? + + Sheet.211 + Y + + + + Y + + Sheet.212 + N + + + + N + + Dynamic connector.87 + + + + Process.88 + Send te_inst: format 3, subformat 1 thaddr = 0 resync count = 0 + + + + + + + + + + + + Send te_inst: format 3, subformat 1 thaddr = 0resync count = 0 + + Sheet.215 + + + + Decision.92 + Reported? + + + + + + + + + + + + Reported? + + Sheet.217 + Y + + + + Y + + Sheet.218 + N + + + + N + + Dynamic connector.95 + + + + Decision.99 + exc_only? + + + + + + + + + + + + exc_only? + + Dynamic connector.100 + + + + Dynamic connector.101 + + + + Sheet.223 + Y + + + + Y + + Sheet.224 + N + + + + N + + Dynamic connector.104 + + + + Decision.105 + Next inst is exc_only, ppccd_br, or unqualified? + + + + + + + + + + + + Next inst isexc_only, ppccd_br, or unqualified? + + Decision.106 + Inst is 1st qualified, ppccd or resync3 + + + + + + + + + + + + Inst is1st qualified, ppccd or resync3 + + Decision.107 + rpt_br? + + + + + + + + + + + + rpt_br? + + Decision.108 + cci? + + + + + + + + + + + + cci? + + Process.111 + Send te_inst: format 3, subformat 1 thaddr = 0 resync count = 0 + + + + + + + + + + + + Send te_inst: format 3, subformat 1 thaddr = 0resync count = 0 + + Sheet.231 + + + + Sheet.232 + exc_only: exception without retirement + + + + exc_only: exception without retirement + + Process.114 + ecause/int tval + + + + + + + + + + + + ecause/inttval + + Process.115 + ecause/int tval + + + + + + + + + + + + ecause/inttval + + Process.116 + ecause/int tval + + + + + + + + + + + + ecause/inttval - - Decision.39 - Last cycle was exception? - - - - - - - - - - - - - - - - - Last cycle was exception? - - Sheet.63 - resync_nh: Resync pending and branch map holds no history fro... - - - - - - - - resync_nh: Resync pending and branch map holds no history from previous instructions