Method and apparatus for emulation of a programmable unit