Due to a problem in the Quartus® II software version 11.1 and later, memories that have been inferred from HDL code may have incorrect read-during-write behavior if they have been converted from RAM to logic cells. Memories may be converted if the Auto RAM to Logic Cell Conversion option is turned on.
To avoid this problem, turn off the Auto RAM to Logic Cell Conversion option.
Inferred RAMs may still be implemented in logic cells by setting the ramstyle synthesis attribute to logic.
For more details on the ramstyle attribute, see the chapter Quartus II Integrated Synthesis in the Quartus II Handbook.