Resource Management - 2020.2 English

Vivado Design Suite Reference Guide: Model-Based DSP Design Using System Generator (UG958)

Document ID
UG958
Release Date
2020-11-18
Version
2020.2 English

M-Hwcosim manages resources that it holds for a hardware co-simulation instance. It releases the held resources upon the invocation of the release instruction or when MATLAB exits. However, it is recommended to perform an explicit cleanup of resources when the simulation finishes or throws an error. To allow proper cleanup in case of errors, it is suggested to enclose M-Hwcosim instructions in a MATLAB try-catch block as illustrated below.


				try
				% M-Hwcosim instructions here
				catch
				err = lasterror;
				% Release any Hwcosim instances
				try release(hwcosim_instance); end
				rethrow(err);
				end
				
			

The following command can be used to release all hardware co-simulation instances.


				xlHwcosim('release');       % Release all Hwcosim instances