merging external internal code for fpga

no success so far
need to check code to find which initialization is missing