Computational circuit design with desired functions in a living cell is a challenging task in synthetic biology. To achieve this task, numerous methods that either focus on small scale networks or use evolutionary algorithms have been developed. Here, we propose a two-step approach to facilitate the design of functional circuits. In the first step, the search space of possible topologies for target functions is reduced by reverse engineering using a Boolean network model. In the second step, continuous simulation is applied to evaluate the performance of these topologies. We demonstrate the usefulness of this method by designing an example biological function: the SOS response of E. coli. Our numerical results show that the desired function can be faithfully reproduced by candidate networks with different parameters and initial conditions. Possible circuits are ranked according to their robustness against perturbations in parameter and gene expressions. The biological network is among the candidate networks, yet novel designs can be generated. Our method provides a scalable way to design robust circuits that can achieve complex functions, and makes it possible to uncover design principles of biological networks.