In the excellent PLL text by Roland Best 1, several types of PLLs are described in sufficient detail to implement them in software. Here is a C++ file containing modules for a linear PLL, a digital PLL and an all software PLL.
A screen shot of a PLL simulator using the software and VPDP technology is shown above.
1 Roland E. Best, "PHASE-LOCKED LOOPS Theory, Design and Applications", 2nd Ed., McGraw-Hill, 1993.