Constructing quantum circuits with global gates