# Path: pif_ir/bir/utils/exceptions.py
# class BIRError(Exception):
#     """ a base class for all bir exceptions
#     """
#     def __init__(self, msg="BIR Error!"):
#         self.value = msg


from pif_ir.bir.utils.exceptions import BIRError
                                           bit_offset)
        self._assign(sig[0], result, packet, bit_offset)

    # O Type instructions are the build-in functionality
    def _handle_o_call(self, sig, packet, bit_offset):
        op = sig[0]
        args = sig[1]

        if op == 'tLookup':
            resp = packet.metadata[args[0]]
            req = packet.metadata[args[1]]
            if self.table:
                resp.reset_values()
                self.table.lookup(req, resp)

        elif op == 'hInsert':
            length = args[0] if len(args) > 0 else len(self.header)
            packet.insert(length, bit_offset)
        elif op == 'hRemove':
            length = args[0] if len(args) > 0 else len(self.header)
            packet.remove(length, bit_offset)
        elif op == 'tInsert':
            mask = args[2] if len(args) > 2 else None
            if self.table:
                self.table.add_entry(args[0], args[1], mask)
        elif op == 'tRemove':
            mask = args[2] if len(args) > 2 else None
            if self.table:
                self.table.remove_entry(args[0], args[1], mask)
        else:

# Path: pif_ir/bir/utils/exceptions.py
# class BIRError(Exception):
#     """ a base class for all bir exceptions
#     """
#     def __init__(self, msg="BIR Error!"):
#         self.value = msg


# Path: pif_ir/bir/objects/instructions.py
from pif_ir.bir.utils.exceptions import BIRError

                                           bit_offset)
        self._assign(sig[0], result, packet, bit_offset)

    # O Type instructions are the build-in functionality
    def _handle_o_call(self, sig, packet, bit_offset):
        op = sig[0]
        args = sig[1]

        if op == 'tLookup':
            resp = packet.metadata[args[0]]
            req = packet.metadata[args[1]]
            if self.table:
                resp.reset_values()
                self.table.lookup(req, resp)

        elif op == 'hInsert':
            length = args[0] if len(args) > 0 else len(self.header)
            packet.insert(length, bit_offset)
        elif op == 'hRemove':
            length = args[0] if len(args) > 0 else len(self.header)
            packet.remove(length, bit_offset)
        elif op == 'tInsert':
            mask = args[2] if len(args) > 2 else None
            if self.table:
                self.table.add_entry(args[0], args[1], mask)
        elif op == 'tRemove':
            mask = args[2] if len(args) > 2 else None
            if self.table:
                self.table.remove_entry(args[0], args[1], mask)
        else:

            raise BIRError("unknown build-in function: {}".format(op))