fix memorymap, casez is used to build priority circuit