Simulation and implementation of a reconfigurable dual-function pixel