From 4f10d864631956c67c0cd10e5284edeb696fe1bf Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 14 Nov 2018 21:48:05 +0000 Subject: [PATCH] update to branch pseudocode --- simple_v_extension/specification.mdwn | 44 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/simple_v_extension/specification.mdwn b/simple_v_extension/specification.mdwn index 995c892a1..12bf0446c 100644 --- a/simple_v_extension/specification.mdwn +++ b/simple_v_extension/specification.mdwn @@ -964,11 +964,15 @@ branch may stil go ahead if any only if *all* tests succeed (i.e. excluding those tests that are predicated out). Note that when either src1 or src2 have zero-predication enabled, -a cleared bit in the respective predicate (src1's predicate register -or src2's predicate register, respectively) indicates that a zero is passed -into the compare unit (instead of the corresponding respective src1 or -src2 element), whilst a set bit indicates that the src1 (or src2) element -be passed into the compare unit. +a cleared bit in the respective predicate indicates that the result +of the compare is set to "false", i.e. that the corresponding +destination bit (or result)) be set to zero. Contrast this with +when zeroing is not set: bits in the destination predicate are +only *set*; they are **not** cleared. This is important to appreciate, +as there may be an expectation that, going into the hardware-loop, +the destination predicate is always expected to be set to zero: +this is **not** the case. The destination predicate is only set +to zero if **zeroing** is enabled. Note that just as with the standard (scalar, non-predicated) branch operations, BLE, BGT, BLEU and BTGU may be synthesised by inverting @@ -1000,34 +1004,44 @@ complex), this becomes: ps = get_pred_val(I/F==INT, rs1); rd = get_pred_val(I/F==INT, rs2); # this may not exist - if not exists(rd) - temporary_result = 0 + if not exists(rd) or zeroing: + result = 0 else - preg[rd] = 0; # initialise to zero + result = preg[rd] for (int i = 0; i < VL; ++i) - if (ps & (1<