模块化设计思维:Model Composer

在算法描述时,可借助ModelComposer提供的各种丰富的模块搭建算法模型,借助Simulink提供的测试源与强大的可视化分析功能对算法模型进行分析验证。最终可生成IP(可导入Vivado IP Catalog中直接使用)、面向HLS的C++代码(可供VitisHLS使用)或System Generator模型(可以模块的形式在System Generator中使用),如下图所示。

Model Composer提供了丰富的模块,从逻辑运算到数学运算,从信号路由到信号属性等,如下图所示。同时,这些模块和标准的Simulink模块是兼容的,这意味着两者可以同时应用于模块搭建环节,但是只有很少一部分Simulink模块可与Model Composer模块一起用于代码生成。此外,用户还可以将自己的C++代码导入到Model Composer中用于算法模型的搭建。


再来看一下ModelComposer的设计流程,如下图所示。首先搭建算法模型。其中测试激励可借助Simulink中的Sources生成,可视化分析工具可使用Simulink中的Sinks,除此之外的算法单元则由Model Composer中的模块搭建。其次,进行算法级仿真,验证算法功能。最后,借助Model Composer Hub生成目标模型(可以是IP、C++代码或者SysGen模型)。此外,在生成C++代码时还可生成相应的测试平台,用于Vitis HLS下的C仿真和C/RTL协同仿真。


Model Composer还提供了Interface Spec模块,用于指定接口类型,如下图所示。通常要将该模块与待综合的Model Composer算法模型放在Simulink同一子系统(Subsystem)下。


