def check_dirty(sc):
    """ Check if is_dirty() functions properly. """

    sc.reset()

    # Read from address 0
    sc.read(0)

    # Address 0 is not dirty
    if sc.is_dirty(0):
        return False

    # Write 1 to address 0
    sc.write(0, "1111", 1)

    # Address 0 is dirty
    if not sc.is_dirty(0):
        return False

    return True