Implemented control for mem_wr_mode and mem_rd_mode.