ARAY/FILT: Are Two Values Equal?

  • Majora
    1st Jul 2017 Member 0 Permalink

    I would like to know how to determine whether two input values are equal using ARAY/FILT.

     

    I have tried to make an XNOR gate, but I don't know how to make it only output a signal when the two are equal. id:2157435

     

    If you could provide any tips/suggestions in the comments, that would be great. I am going to make a simple ROM module using this technique.

     

    Edited once by Majora. Last: 1st Jul 2017
  • LBPHacker
    1st Jul 2017 Developer 1 Permalink

    I check for equality with a simple XOR FILT whose .ctype is set to the value I need to check for. A BRAY shot through that FILT either dies (because its .ctype is the same as the FILT's and its new .ctype is 0, which kills BRAYs) or doesn't die (in which case its new .ctype is clobbered). Whether it dies or not is easily detectable.

     

    You can even check for partial equality (which means that only some bits have to match, not all of them). Just add an AND FILT before the XOR FILT and set the bits that do matter as its .ctype.

     

    There might be special cases that make checking for equality easier, but right now I can't think of any. There also might be ways to check for equality that are less complicated than what I outlined here, but if there are, well, I've been doing a great job of ignoring them so far.

    Edited once by LBPHacker. Last: 1st Jul 2017
  • Majora
    1st Jul 2017 Member 0 Permalink

    How would I make the detector to find out when BRAY is present or not? I've tried, but can't seem to get it.

    Edited 2 times by Majora. Last: 1st Jul 2017
  • QuanTech
    2nd Jul 2017 Member 1 Permalink

    @Majora (View Post)

     You don't have to use DTEC for that. You can set the top bit of the input (by adding 0x2000000 to the input's ctype) so that if the result zeroes out, the BRAY isn't dead as the top bit is still set, with an output of 0x20000000. You can then do whatever you want with this output, because you know for sure that if the output is something other than 0x2000000, the two are not equal

    Edited once by QuanTech. Last: 1st Jul 2017
  • mark2222
    2nd Jul 2017 Member 1 Permalink

    @Majora (View Post)

    If you're doing subframe, you can DRAY (non-overwriting) a solid spark onto it, and use that to activate some powered material.

    If you're not doing subframe, you can just put a conductor there. The BRAY will spark the conductor if it did not get annihilated.

  • Majora
    2nd Jul 2017 Member 0 Permalink

    @mark2222

     

    So, I should use a regular conductor with a NOT gate to tell when BRAY isn't present? That'd take a few more frames than what I'm hoping for.

  • LBPHacker
    2nd Jul 2017 Developer 1 Permalink

    Oh no it wouldn't. It's pretty difficult to find something that can't be done in a single frame. Here, I built a demo for you.

     

     

    The setup there detects the BRAY if it goes through the XOR gate, and another BRAY if the first one doesn't. The two BRAYs have different .ctypes so the DTEC sets different .ctypes on the output depending on whether the two input values match.

     

    Of course there are other ways to detect the BRAY, and every one of them has its unique use case. The one mark2222 suggested is useful when you want to drive something immediately with the data (e.g. a DRAY to copy something). When you want to store the output though, it makes more sense to have it in the form of coloured FILT.

     

    Also, uhm, I still can't tell whether you're using subframe or not. I assumed you did.

    Edited 2 times by LBPHacker. Last: 2nd Jul 2017
  • Majora
    2nd Jul 2017 Member 0 Permalink

    No, I'm not using subframe. I figured if I'd try to make a computer in TPT, it'd better be simple for the first go-around. :-)

     

    Here's my try at an addressing unit based on your suggestions: id:2155735.

    Edited once by Majora. Last: 2nd Jul 2017
  • Draco712
    9th Jul 2017 Member 0 Permalink

    Here, try this one if it fits your needs. id:2160371

  • garr890354839
    16th Aug 2017 Member 0 Permalink

    I would implement a simpler set of instructions: ((A OR B) AND (A NAND B))