with m.If(am.C(0)): m.d.sync += self.count.eq(0) with m.If((~am.C(0)) & am.C(1)): m.d.sync += self.count.eq(self.count + 1)