the present invention relates to a method for automatically generating hdl code , a code generator and a product for generating the code for the purpose of its implementation in programmable logic , based on a graphical representation for coding a state machine . with the method according to the invention , state transitions are executed on the basis of a modified query structure in that , starting from a target state , all the preconditions are derived which must be fulfilled in order to reach said target state .