Logic of the ASM simulation