when you use the megafunction custom rom, that means only it is a block which can be only read by the rest of your logic. it does not mean it is really a rom. obviously when the fpga turns off , since it is an sram based device all of the programming data will be cleared. The next time we turn on the fpga, it loads the programming data from the flash memory chip.