1.  
  2. self.sync += [
  3. If(scl & (counter != 20),
  4. counter.eq(counter + 1)
  5. ).ElIf(~scl & (counter != 0),
  6. counter.eq(counter - 1)
  7. ),
  8. If(counter < 5,
  9. scl_filtered.eq(0)
  10. ).ElIf(counter > 15,
  11. scl_filtered.eq(1)
  12. )
  13. ]