From af206f959969c0efaef793e2682adb80ad6e047b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 24 Sep 2019 13:24:18 +0100 Subject: [PATCH] use zeroing as well as inversion to change branch behaviour --- simple_v_extension/appendix.mdwn | 50 ++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/simple_v_extension/appendix.mdwn b/simple_v_extension/appendix.mdwn index 779fe63d8..24ae6ca71 100644 --- a/simple_v_extension/appendix.mdwn +++ b/simple_v_extension/appendix.mdwn @@ -207,21 +207,25 @@ mode. The second is utilised to indicate where the results of each comparison are to be stored, as a bitmask. Additionally, the behaviour of the branch - when it occurs - may also be modified depending on whether the predicate -"invert" bit is set. +"invert" and "zeroing" bits are set. -* If the "invert" bit is zero, then the branch will occur if and only +* If "invert" is zero, and "zeroing" is zero, the branch will occur if and only all tests pass -* If the "invert" bit is set, the branch will occur if and only if all - tests *fail*. - -This inversion capability, with some careful boolean logic manipulation, -covers AND, OR, NAND and NOR branching based on multiple element comparisons. -Note that unlike normal computer programming early-termination of chains -of AND or OR conditional tests, the chain does *not* terminate early except -if fail-on-first is set, and even then ffirst ends on the first data-dependent -zero. When ffirst mode is not set, *all* conditional element tests must be -performed (and the result optionally stored in the result mask), with a -"post-analysis" phase carried out which checks whether to branch. +* If "invert" is set and "zeroing" is zero, the branch will occur if all + tests *fail* (opposite of inv=0,zero=0) +* If "invert" is zero, and "zeroing" is set, the branch will occur if + even *one* test passes +* If "invert" is set and "zeroing" is set, the branch will occur if + even *one* test fails. + +This inversion capability covers AND, OR, NAND and NOR branching based +on multiple element comparisons. Note that unlike normal computer +programming early-termination of chains of AND or OR conditional tests, +the chain does *not* terminate early except if fail-on-first is set, +and even then ffirst ends on the first data-dependent zero. When ffirst +mode is not set, *all* conditional element tests must be performed (and +the result optionally stored in the result mask), with a "post-analysis" +phase carried out which checks whether to branch. ### Standard Branch @@ -290,9 +294,9 @@ complex), this becomes: ffirst_mode, zeroing = get_pred_flags(rs1) if exists(rd): - pred_inversion = get_pred_invert(rs2) + pred_inversion, pred_zeroing = get_pred_flags(rs2) else - pred_inversion = False + pred_inversion, pred_zeroing = False, False if not exists(rd) or zeroing: result = (1<