Every custom logic device has a model name, which points to a model that describes how it works. You can have any number of devices with the same model. Editing the model changes the behavior of all devices that use that model.
When editing the model, you specify the inputs, the outputs, some info text (which is shown in the lower right corner when hovering the mouse over a device), and the definition.
The inputs (and outputs) is a comma separated list of short pin labels (one or two characters max). You can also specify inverted labels, like /Q for Q. Example: A,B,/C,/D
The definition is multiple lines of the form input=output. The first input pattern that matches the input pins is chosen, and the output pins are set to match the output pattern. The pattern can contain bit values (0, 1), transitions (+, -), wildcards/don't cares (?), and pattern letters (A, B, etc.). The input has to be at least as long as the number of input pins. If it's longer, than the additional pattern characters will be matched against the output pins; this allows you to create devices with state.
If all three inputs are 1, the output is 0. Otherwise, it's 1.
111=11 110=10 011=10 101=10 100=01 010=01 001=01 000=00
?? 00=10 10 ??=10 01 ??=01 ?? AB=ABThe input pattern (the left side of the equals sign) matches S, R, Q, and Q, in that order. The right side of the equals sign specifies the resulting Q and Q.
The first line sets the Q output if both outputs are low (this is needed when resetting the circuit). The next line sets the outputs to 1,0 if set is high. The second line sets the outputs to 0,1 if reset is high. The next line keeps the outputs the same otherwise. (The first two letters match the input pins and the second two letters match the output pins. Spaces are ignored, but are added here for clarity.)
?? 00=10 0+ ??=01 1+ ??=10 ?? AB=ABThe first line sets the Q output if both outputs are low (this is needed when resetting the circuit). The next two lines set the Q output to match the D input on a rising transition of the clock. The last line keeps the outputs the same otherwise.
??? 00=10 00- AB=AB 10- ??=10 01- ??=01 11- AB=BA ??? AB=ABThe first line sets the Q output if both outputs are low (this is needed when resetting the circuit). The next four lines implement the JK flip flop logic on a negative transition of the clock. The last line keeps the outputs the same otherwise.
ABC ABC=100 1?? 0??=010 A1? A0?=010 AB1 AB0=010 ??? ???=001The first lines checks if the two inputs are equal. The next three lines test if A is larger. Otherwise, B must be larger.