A C++ model of an NMU and memory system