Due to a problem in the Quartus® Prime software version 18.1 Update 1 and later, you may see this internal error when you use different synchronous clearing signals to RAM two ports registers (porta and portb) in your design.
To work around the problem, you can either add this altera_attribute to your RTL code:
(* altera_attribute = "-name QII_AUTO_PACKED_REGISTERS OFF" *)
Or modify the .qsf file with the below setting:
set_instance_assignment -name QII_AUTO_PACKED_REGISTERS -to <RAM instance or register name> OFF