System-Level Analysis and Design of Safety-Critical Cyber Physical Systems