VHDL-AMS-RT to Simulink - Tool use description: - Tested with Borland C++ 5.02, Matlab 5.3.0 (R11) and Simulink 3.0 (R11) for Windows. Hopefully compatible with minimal changes for Matlab on other platforms. - Translator itself is a Java application, thus platform independent. - There is no need to put VHDLAMS.JAR file on CLASSPATH, if scripts - batch files are run from directory where JAR file is. - There can be just one compiled model in the same directory. Tool generates binary model always in file model.dll. Just one main architecture (generated S-Function) can be used in Simulink at the same time. If you need more of them, encapsulate them as instantiated entities in another main entity. - Matlab and Simulink must exit before model is recompiled by tools modelmex or mex. - Matlab's 'mex' skript must be on PATH and configured to use your C++ compiler. Java or Java Runtime Environment must be on PATH. - Create separate directory for each model. Copy vhdlams.jar, *.bat skripts and cpp directory there. Or put them on CLASSPATH, PATH and change skripts. 1. vhdlams It runs compiler. Because it doesn't process definitions of instantiated entities, those must be compiled first, in correct order "from bottom up". Module dependency checking is left for make or similiar tool. Compiler generates C++ .H file and extra .ENT, .ARC data files. Report about parsed definitions is shown, paged by 'more'. Class 'Call' is used there so error output is redirected to standard output and piped to 'more' also on Win95. '| more' can be ommited when redirecting output to a file by '>outfile'. 2. modelmex It generates .cpp file for main entity, that initalizes interface to Simulink, creates and calls all instantiated entities. Then it calls Matlab's mex skript that compiles and links whole model to shared library, that is model.dll on Windows platform. Parameters are not case sensitive. Instead of 'modelmex', 'model' and then 'mex' scripts can be used: 2a. model It generates CPP file for main entity, that initalizes interface to Simulink, creates and calls all instantiated entities. 2b. mex model.cpp real.cpp vector.cpp It compiles and linkes whole model. The order of first file model.cpp is significant. Filenames are case sensitive on Unix, all in lowercase. Example: vhdlams ball.vhd vhdlams model.vhd modelmex model first 3. Use S-function "model" in Simulink (independent from architecture/entity name) Add it to new or existing model from Simulink Library Browser: Simulink-> Functions&Tables-> S-Function. MDL is not generated automatically because it's not a compiler feature and is platform and version specific. Set continuous fixed or variable simulation step ODE solver. Multistep ODE solvers can be delayed or unstable at augmentation points.