Binary comparison - simpler solution?

    Joined
    Aug 19, 2015
    Messages
    7
    Reaction score
    0
    I am working on a complex idea - something which I will post more about once I have more built and the core concept working - but I'm potentially hitting a roadblock at the moment with the number of logic blocks needed.

    So in simple terms I have a single keypad with 12 buttons which is used as a sort of combination lock (similar to some of the ones in the community content). However instead of opening 1 lock, different combinations would open different locks. In this case I'm looking at having 10 different locks.

    Some notes about the combinations:
    • Order of button press is irrelevant
    • The combination chosen needs to be compared against each lock to determine which one to open
    • The combinations for each lock are set using activators (i.e. not fixed by logic links, but can be changed by changing the activators)
    I have a basic concept working using an XNOR (1 x or block, 2 x nand (and+not) blocks) for each of the buttons for each lock. This however means that there are 9 logic blocks for each button for each lock. 5 for xor, 1 for reset button, 1 for output, 1 for input, 1 for an and for comparator.

    For a single lock or 2 locks it's not too bad, but when one starts doing the maths I'm looking at 1,000+ logic blocks for 10 locks. And my final plan involves having 3+ of these rooms, perhaps even 20 locks per room - leading to a scary amount of logic blocks. :P

    Does anyone have a simpler way of comparing if the chosen lock combination matches a preset combination?

    Alternatively perhaps I just need to suck it up and either hard link logic for the combinations or restrict size of final project. I can also shave off some block counts by skipping a block for reset and input but I'm trying to keep it as simple to understand as possible.

    I will post some pics once I am home and can work on it more.
     
    Joined
    Aug 19, 2015
    Messages
    7
    Reaction score
    0
    Ok, so I figured out a better way to handle what I'm trying to do. Instead of a binary comparison for every lock combination I'm using a single binary comparison and a multiplexer to change which lock is being compared :)

    It's more complex than I hoped and I still have to figure out some more bits but it's good progress. It means for 16 locks I use about 600 logic blocks vs my previous method which would have used 1,700+. For 32 locks it only increases it to about 700 logic blocks vs 3,800+, so it's nice and expandable.

    Some pics of my proof of concept in the interim until I'm ready to reveal more details about what I'm building:

    Multiplexer (4-bit binary input to 16-outputs), 1 layer:
    http://steamcommunity.com/sharedfiles/filedetails/?id=552650143
    The OR gates are for inputs, I could potentially leave them out and just have the AND gates visible, I am likely to still do that, but for now it helps with keeping things easy to visualise.

    Multiplexer 11 layers (was meant to be 12 but I missed a layer by accident):
    http://steamcommunity.com/sharedfiles/filedetails/?id=552648953
    There's also some logic blocks in there for testing the multiplexers


    Binary comparison test circuit:
    http://steamcommunity.com/sharedfiles/filedetails/?id=552650028


    I am hoping to start a thread in the next few days to give more detail, to explain the logic circuits for anyone else who might need something similar and upload some of it to community content :)