def depth(self):
<EOL>reg_offset = <NUM_LIT:0><EOL>reg_map = {}<EOL>for reg in self.qregs+self.cregs:<EOL><INDENT>reg_map[reg.name] = reg_offset<EOL>reg_offset += reg.size<EOL><DEDENT>op_stack = [<NUM_LIT:0>]*reg_offset<EOL>for instr, qargs, cargs in self.data:<EOL><INDENT>if instr.name not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>levels = []<EOL>reg_ints = []<EOL>for ind, reg in enumerate(qargs+cargs):<EOL><INDENT>reg_ints.append(reg_map[reg[<NUM_LIT:0>].name]+reg[<NUM_LIT:1>])<EOL>levels.append(op_stack[reg_ints[ind]] + <NUM_LIT:1>)<EOL><DEDENT>if instr.control:<EOL><INDENT>cint = reg_map[instr.control[<NUM_LIT:0>].name]<EOL>for off in range(instr.control[<NUM_LIT:0>].size):<EOL><INDENT>if cint+off not in reg_ints:<EOL><INDENT>reg_ints.append(cint+off)<EOL>levels.append(op_stack[cint+off]+<NUM_LIT:1>)<EOL><DEDENT><DEDENT><DEDENT>max_level = max(levels)<EOL>for ind in reg_ints:<EOL><INDENT>op_stack[ind] = max_level<EOL><DEDENT><DEDENT><DEDENT>return max(op_stack)<EOL>
Return circuit depth (i.e. length of critical path).
        This does not include compiler or simulator directives
        such as 'barrier' or 'snapshot'.

        Returns:
            int: Depth of circuit.

        Notes:
            The circuit depth and the DAG depth need not bt the
            same.