Simulating quantum mechanics with a θ -term and an ’t Hooft anomaly on a synthetic dimension