Hardware-dependent Software: Principles and Practice