added code and testbench for comparator