Factor out instruction generation and testing from simulation