Moves common code in hardware types to directive for reuse