
Xor is a a bitwise operation where if exactly one of the two bits of the operands are 1 then the matching output bit is a 1 otherwise 0. Not is a bitwise inversion, each output bit is inverted from the input. In this case if the tool supports it (assembly is defined by the tool (gnu assembler, or jimmy's assembler or sue's assembler), not the target (risc-v)) it appears to be a pseudo instruction.ĪRM for example has real neg (negate) and mvn (move not) instructions. Now anything xored with 0 is itself: a b qĪnd anything xored with 1 is inverted a b qĪnd that is the same as a not operation from an operand a and result perspective, so you will often see xor with all ones instead of a not instruction. Xor's truth table is essentially a parity check, if one and not both are true then true a b q So you will not always see a neg instruction. You can simply do a subtract with result = 0 - operand, to perform a (non-bitwise) neg. Bitwise negative 0 = 1+1 = 0, bitwise negative 1 = 0+1 = 1. You can also see this with twos copmplement to do the negation. It is not a bitwise operation as negative 0 = - (or just 0 bit wise) 0 and negative 1 = -1 (or just one bitwise) it has no effect on the result if considered bitwise. Neg is a negative, and is not the same as not.

The truth table for not is just a inversion a q

Not is an instruction that if implemented logic would be done with one operand (bit 0 of the only operand is operated on to get bit 0 of the result). Not is like xor, and, or, etc and are bitwise operands so bit 0 is operated with bit 0 of the other operand to result in bit 0 of the result. Sometimes you will see neg and not instructions but you can implement them with sub and xor using extra operands(/registers) so sometimes you do not.
