ps2 curcuit implemented by heap