All-In-One Analog Ai Hardware For On-Chip Training And Inference: From Physical Modeling To Beol Integration Of Analog Reram Devices