pminmo,
Let me add to what Marcus wrote. The attached thumbnail shows a simple but practical quadrature decoder. I'm using it to illustrate how a 4000-series CMOS logic circuit migrates to a CPLD implementation.
It's of paramount importance to minimize gate package count when using discrete logic. 4000-series CMOS logic lends itself well to analog RC timing elements and I believe the 3 XNOR gate circuit is as simple of a quadrature decoder as is possible. It is used in the G320 servodrive.
Going to a CPLD implementation requires a change in thinking when designing a circuit. Far more gates are available but good practice requires a fully synchronous design. This requirement adds to the complexity of the circuit when compared to an asynchronous design (the CD4077 version). Additional complexity results from not having RC generated time delays available.
The CPLD implementation is an equivalent of the 4000-series circuit. You should be able to see it in the red, blue and green highlighted areas. 3 XOR gates are still needed but it 'grows' by 5 D-flops which generate the time delays and insure synchronous operation.
The Verilog code shows how simple it is to convert the CPLD tailored logic schematic into very brief code. The top module 'QUAD_DECODER' declares all external inputs and outputs, The D-flop connections described next, boolean operators ('^' is the 'XOR' operator) complete the connection description and the STEP and DIR outputs are assigned. The module 'F_D' is a behavioral description of a D-flop. It functions similarly to a subroutine; defined only once, it is 'called' in F1, F2, F3, F4 and F5.
Mariss