UCT: A Versatile Code Translation Framework Based on a Unified Intermediate Representation
Abstract
Model-driven design often requires the same model to support multiple downstream tasks, such as simulation, testing, verification, and deployment. However, existing tools usually build separate translation workflows for different tasks, causing repeated model parsing, redundant semantic reconstruction, and limited reuse across toolchains. In this paper, we present UCT, a versatile code translation framework based on a unified intermediate representation (CIR). UCT translates models into CIR once, preserves executable semantics, structural information, scheduling relations, and model-code mappings, and then generates task-specific code through unified instrumentation and backend translation. We implemented UCT and evaluated it on Simulink benchmark models. The results show that UCT can generate usable customized code for simulation, testing, verification, and deployment. The generated binary artifacts also provide additional benefits, improving model testing coverage by 85.9% on average and accelerating simulation by 19.8× on average over Simulink Rapid Accelerator. The video is presented at https://youtu.be/CCu5iO853p4. The implementation is available at https://github.com/CodeGen123/UCT.