Esempio n. 1
0
    def toBDD(self, index):
        """Compute the corresponding ROBDD of the Ip

        Parameters
        ----------
        index : int. The start point of the variable name

        Return
        ------
        Return the corresponding ROBDD
        """
        # Ip: 32 bits
        res = Robdd.true()
        ip_size = 32
        for i in range(ip_size - (32 - Ip.MaskToCidr(self.mask))):
            if (self.ip >> (ip_size - i - 1)) & 1:
                res = synthesize(res, Bdd.AND, Robdd.make_x(index + i))
            else:
                res = synthesize(res, Bdd.AND, Robdd.make_not_x(index + i))
        return res
Esempio n. 2
0
    def toBDD(self, index):
        """Compute the corresponding ROBDD of the Ip

        Parameters
        ----------
        index : int. The start point of the variable name

        Return
        ------
        Return the corresponding ROBDD
        """
        # Ip: 32 bits
        res = Robdd.true()
        ip_size = 32
        for i in range(ip_size - (32 - Ip.MaskToCidr(self.mask))):
            if (self.ip >> (ip_size - i - 1)) & 1:
                res = synthesize(res, Bdd.AND, Robdd.make_x(index + i))
            else:
                res = synthesize(res, Bdd.AND, Robdd.make_not_x(index + i))
        return res
Esempio n. 3
0
    def toBDD(self, index, limit=0):
        """Construct the ROBDD.

        Parameters
        ----------
        index : int. Used for ROBDD variable index
        limit : int (optional, default=0). The limit bit used for range representation

        Return
        ------
        Return the computed ROBDD.
        """
        # Protocol : 8 bits
        res = Robdd.true()
        protocol_size = 8
        for i in range(protocol_size - limit):
            if (self.protocol >> (protocol_size - i - 1)) & 1:
                res = synthesize(res, Bdd.AND, Robdd.make_x(index + i))
            else:
                res = synthesize(res, Bdd.AND, Robdd.make_not_x(index + i))

        return res
Esempio n. 4
0
    def toBDD(self, index, limit=0):
        """Compute the ROBDD.

        Parameters
        ----------
        index : int. Used for ROBDD variable index
        limit : int (optional, default=0). The limit bit used for range representation.

        Return
        ------
        Return the comuted ROBDD
        """
        # Port: 16 bits
        res = Robdd.true()
        port_size = 16
        for i in range(port_size - limit):
            if (self.port >> (port_size - i - 1)) & 1:
                res = synthesize(res, Bdd.AND, Robdd.make_x(index + i))
            else:
                res = synthesize(res, Bdd.AND, Robdd.make_not_x(index + i))

        return res
Esempio n. 5
0
    def toBDD(self, index, limit=0):
        """Compute the ROBDD.

        Parameters
        ----------
        index : int. Used for ROBDD variable index
        limit : int (optional, default=0). The limit bit used for range representation.

        Return
        ------
        Return the comuted ROBDD
        """
        # Port: 16 bits
        res = Robdd.true()
        port_size = 16
        for i in range(port_size - limit):
            if (self.port >> (port_size - i - 1)) & 1:
                res = synthesize(res, Bdd.AND, Robdd.make_x(index + i))
            else:
                res = synthesize(res, Bdd.AND, Robdd.make_not_x(index + i))

        return res
Esempio n. 6
0
    def toBDD(self, index, limit=0):
        """Construct the ROBDD.

        Parameters
        ----------
        index : int. Used for ROBDD variable index
        limit : int (optional, default=0). The limit bit used for range representation

        Return
        ------
        Return the computed ROBDD.
        """
        # Protocol : 8 bits
        res = Robdd.true()
        protocol_size = 8
        for i in range(protocol_size - limit):
            if (self.protocol >> (protocol_size - i - 1)) & 1:
                res = synthesize(res, Bdd.AND, Robdd.make_x(index + i))
            else:
                res = synthesize(res, Bdd.AND, Robdd.make_not_x(index + i))

        return res