rewrite simGen