// CD4086B: expandable 4-wide 2-input AND-OR-INVERT gate.
//
// Ports in pin order, named as in the datasheet.  The power pins, VSS (7)
// and VDD (14), are left out, and so is the unconnected pin 4.
// Synthesizable.
//
// J = ~ (A & B | C & D | E & F | G & H | INHIBIT | ~ ENABLE).  For a plain
// 4-wide AND-OR-INVERT gate tie INHIBIT to GND and ENABLE to +5V.  A
// second 4086 can extend the gate through INHIBIT or ENABLE.

module cd4086
(
    input  logic a,        // Pin 1
    input  logic b,        // Pin 2
    output logic j,        // Pin 3
                           // Pin 4:  not connected
    input  logic e,        // Pin 5
    input  logic f,        // Pin 6
                           // Pin 7:  VSS
    input  logic g,        // Pin 8
    input  logic h,        // Pin 9
    input  logic inhibit,  // Pin 10: 1 = J goes to 0
    input  logic enable,   // Pin 11: 0 = J goes to 0
    input  logic c,        // Pin 12
    input  logic d         // Pin 13
                           // Pin 14: VDD
);

    assign j = ~ (a & b | c & d | e & f | g & h | inhibit | ~ enable);

endmodule
