Hardware algorithm for variable precision multiplication on FPGA