move gen_query and makefile into simulation