@Test
	public void testOverridingRefAndDelaySlots() throws AddressFormatException {
		//verify that the test program contains the instructions for the test
		Address calldsFunc3Addr = defaultSpace.getAddress(CALLDS_FUNC3_100022);
		Instruction calldsFunc3 = program.getListing().getInstructionAt(calldsFunc3Addr);
		assertNotNull(calldsFunc3);
		assertEquals("callds 0x" + func3Addr.toString(), calldsFunc3.toString());

		Address user3Addr = defaultSpace.getAddress(USER_THREE_100024);
		Instruction user3 = program.getListing().getInstructionAt(user3Addr);
		assertNotNull(user3);
		assertEquals("_user_three", user3.toString());

		//grab pcode for both instructions before any overrides applied
		PcodeOp[] calldsUnmodified = calldsFunc3.getPcode(false);
		PcodeOp[] user3Unmodified = user3.getPcode(false);

		//verify that requesting overrides when there aren't any is the same as 
		//not requesting overrides
		assertTrue(equalPcodeOpArrays(calldsFunc3.getPcode(false), calldsFunc3.getPcode(true)));
		assertTrue(equalPcodeOpArrays(user3.getPcode(false), user3.getPcode(true)));

		//lay down a primary CALLOTHER_OVERRIDE_CALL reference on the instruction in the delay slot
		int id = program.startTransaction("test");
		Reference user3OverrideRef = refManager.addMemoryReference(user3Addr, func1Addr,
			RefType.CALLOTHER_OVERRIDE_CALL, SourceType.USER_DEFINED, 0);
		refManager.setPrimary(user3OverrideRef, true);
		program.endTransaction(id, true);

		//verify that nothing changes if no overrides are requested
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode()));
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode(false)));
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode()));
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode(false)));

		//verify that the override doesn't change the pcode for the instruction with the delay slot
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode(true)));

		//verify that the override does change the pcode for the instruction in the delay slot
		PcodeOp[] user3Modified = user3.getPcode(true);
		assertTrue(user3Modified.length == 1);
		assertNull(user3Modified[0].getOutput());
		assertTrue(user3Modified[0].getOpcode() == PcodeOp.CALL);
		assertTrue(user3Modified[0].getNumInputs() == 1);
		assertTrue(user3Modified[0].getInput(0).isAddress());
		assertTrue(user3Modified[0].getInput(0).getOffset() == func1Addr.getOffset());

		//set user3OverrideRef to non-primary and create a primary CALLOTHER_OVERRIDE_CALL
		//reference on callds
		id = program.startTransaction("test");
		refManager.setPrimary(user3OverrideRef, false);
		Reference calldsOverrideRef = refManager.addMemoryReference(calldsFunc3Addr, func1Addr,
			RefType.CALLOTHER_OVERRIDE_CALL, SourceType.USER_DEFINED, 0);
		refManager.setPrimary(calldsOverrideRef, true);
		program.endTransaction(id, true);

		//verify that nothing changes if no overrides are requested
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode()));
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode(false)));
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode()));
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode(false)));

		//verify that nothing changes for the instruction in the delay slot if overrides are requested
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode(true)));

		//verify that the CALLOTHER_OVERRIDE_CALL reference on callds DOES change the
		//CALLOTHER op from the delay slot to a CALL in the pcode for callds
		PcodeOp[] calldsModified = calldsFunc3.getPcode(true);
		assertTrue(calldsModified.length == calldsUnmodified.length);
		assertNull(calldsModified[0].getOutput());
		assertTrue(calldsModified[0].getOpcode() == PcodeOp.CALL);
		assertTrue(calldsModified[0].getNumInputs() == 1);
		assertTrue(calldsModified[0].getInput(0).isAddress());
		assertTrue(calldsModified[0].getInput(0).getOffset() == func1Addr.getOffset());

		//verify that the rest of the pcode ops for callds are unchanged
		for (int i = 1; i < calldsModified.length; ++i) {
			assertTrue(equalPcodeOps(calldsModified[i], calldsUnmodified[i]));
		}

		//set the CALLOTHER_OVERRIDE_CALL reference on user3 to primary, so that
		//both user3 and callds have primary CALLOTHER_OVERRIDE_CALL refs
		id = program.startTransaction("test");
		refManager.setPrimary(user3OverrideRef, true);
		program.endTransaction(id, true);

		//verify that nothing changes if no overrides are requested
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode()));
		assertTrue(equalPcodeOpArrays(calldsUnmodified, calldsFunc3.getPcode(false)));
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode()));
		assertTrue(equalPcodeOpArrays(user3Unmodified, user3.getPcode(false)));

		//verify that the CALLOTHER is changed to a CALL in the pcode for callds 
		assertTrue(equalPcodeOpArrays(calldsModified, calldsFunc3.getPcode(true)));
		//verify that the CALLOTHER is changed to a CALL in the pcode for callds 
		assertTrue(equalPcodeOpArrays(user3Modified, user3.getPcode(true)));
	}
Test that CALLOTHER_CALL_OVERRIDE references:
  1) When placed on an instruction *with* a delay slot:
      a) changes a CALLOTHER op in the pcode for the instruction with the delay slot 
      b) do not change a CALLOTHER op in the pcode for the instruction in the delay slot
         when generated directly
     Note: the callds instruction in this test has the delayslot directive before
           any other pcode and does not itself contain a CALLOTHER op
  2) When placed on an instruction *in* a delay slot
     a) do not change the pcode for the instruction with the delay slot
     b) changes a CALLOTHER op in the pcode for the instruction in the delay slot when
        generated directly
@throws AddressFormatException if {@code AddressSpace.getAddress} throws it
Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/program/model/pcode/PcodeEmitContextTest.java