Bug 279

Summary: inconsistency in 3.0B spec on definition of "equivalence" operator
Product: Libre-SOC's first SoC Reporter: Luke Kenneth Casson Leighton <lkcl>
Component: SpecificationAssignee: Luke Kenneth Casson Leighton <lkcl>
Status: CONFIRMED ---    
Severity: enhancement CC: libre-soc-bugs, programmerjake
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Linux   
NLnet milestone: --- total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation:
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:

Description Luke Kenneth Casson Leighton 2020-04-04 20:54:12 BST
Section 1.3.4 p6

Equivalence logical operators ((a===b) = (a XOR ¬b))

Section 2.5.1 p40

The bit in the Condition Register specified by BA+32 is
XORed with the bit in the Condition Register specified
by BB+32, and the complemented result is placed into
the bit in the Condition Register specified by BT+32.

Section 3.3.13 p95

The contents of register RS are XORed with the con-
tents of register RB and the complemented result is
placed into register RA.

these are "technically" equivalent, however the definition is inconsistent
with the wording.  to be consistent, Section 1.3.4 should read:

Equivalence logical operators ((a===b) = ¬(a XOR b))

however by an accidental property of XOR, they're the same.

also known as an "XNOR gate", which is *sigh* a better name than "Equivalence"
https://en.wikipedia.org/wiki/XNOR_gate
Comment 1 Jacob Lifshay 2020-04-05 05:19:43 BST
In my opinion, both == and XNOR (as well as != and XOR) can be used to denote the same operation, but with two different ways of thinking about it:

1. XNOR/XOR used when flipping bits, (carry-less) adding, LFSRs, etc.
2. ==/!= used when checking for same/different values.

So pick which one you use based on how you are thinking about it, perhaps with a note about being the same as the other operator when relevant.

Jacob
Comment 2 Luke Kenneth Casson Leighton 2020-04-05 11:01:13 BST
(In reply to Jacob Lifshay from comment #1)
> In my opinion, both == and XNOR (as well as != and XOR) can be used to
> denote the same operation, but with two different ways of thinking about it:
> 
> 1. XNOR/XOR used when flipping bits, (carry-less) adding, LFSRs, etc.
> 2. ==/!= used when checking for same/different values.

yes, interestingly, Anton, in Microwatt, splits up add/sub into its
sub-components:

* add 0, 1, carry
* actual add
* invert / don't bit-invert result (1s complement)

therefore, bit-inversion of the result could, hypothetically, be done
here as well.

i "solved" this one temporarily by removing the XNOR operator and
replacing it with invert (a XOR b)