SW function in SUB