pattern rf_dsp_mad state add_ba state mul_nusers state add_nusers match mul select mul->type.in($mul) select nusers(port(mul, \Y)) <= 3 set mul_nusers nusers(port(mul, \Y)) endmatch match add select add->type.in($add, $sub) choice AB {\A, \B} define BA (AB == \A ? \B : \A) index port(add, AB) === port(mul, \Y) select nusers(port(add, \Y)) <= 3 set add_nusers nusers(port(add, \Y)) set add_ba BA endmatch code accept; endcode