Drvgen is a code generation tool for developing VME device drivers for Linux or VxWorks. It is written in PHP to take advantage of it's native support for templating. C/C++ code is generated based on an input specification file which describes the device's registers, data regions and interrupts. Generated code includes a C++ class library, kernel module, command line utilities for debugging and an ACNET interface for accessing devices from the control system. Developer can extend the generated code via C++ inheritance, composition and other hooks.