is the mem file encoded correctly? With readmemh you can also try giving the start position and end position.