Fix some warnings and errors picked up by Xilinx synthesis.