def check_read_write(sc):
    """ Check if read() and write() function properly. """

    sc.reset()

    # Read data from address 0
    data = sc.read(0)

    # Calculate the negation of data
    neg_data = (~data & 0xFFFFFFFF)

    # Write inverse of data to address 0
    sc.write(0, "1111", neg_data)

    # Read inverse of data from address 0
    if sc.read(0) != neg_data:
        return False

    return True