Replace comparator & and gate with a dedicated module.

Preparation for the exercise2.