tested on Spartan-6 FPGA