1. A method for generating an assertion based on a user program code, the method comprising: receiving a user program comprising at least one assertion directive, a compiled result of the user program, and architecture information of a processor; and generating, based on the compiled result of the user program and the architecture information of the processor, an assertion which states an operation that the processor needs to perform in accordance with a code of the user program indicated by each of the at least one assertion directive.