On emulating hardware/software co-designed control algorithms for packet switches