Класс: hdlcoder. ReferenceDesign
Пакет: hdlcoder
Дескриптор функции для функции обратного вызова, которая выполняется после задания Set Target Interface в помощнике по рабочим процессам HDL
PostTargetInterfaceFcn
PostTargetInterfaceFcn регистрирует дескриптор функции обратного вызова, который вызывается в конце задачи Set Target Interface в помощнике по рабочим процессам HDL. Если hRD - ссылочный объект конструкции, который создается с помощью hdlcoder.ReferenceDesign , затем используйте этот синтаксис для регистрации дескриптора функции.
hRD.PostTargetInterfaceFcn = @my_reference_design.callback_PostTargetInterface;
Чтобы определить функцию обратного вызова, создайте файл, определяющий функцию MATLAB ®, и добавьте ее в путь MATLAB. Для функции обратного вызова можно использовать любое имя. В этом примере имя функции: callback_PostTargetInterface, и находится в папке пакета ссылочного проекта +my_reference_design.
С помощью этой функции обратного вызова можно включить пользовательские проверки. В этом примере кода показано, как создать функцию обратного вызова. Если пользовательский параметр DUTPath имеет значение Rx, функция проверяет, что ссылочная конструкция не поддерживает LEDs General Purpose [0:7] интерфейс.
function callback_PostTargetInterface(infoStruct) % Reference design callback run at the end of the task Set Target Interface % % infoStruct: information in structure format % infoStruct.ReferenceDesignObject: current reference design registration object % infoStruct.BoardObject: current board registration object % infoStruct.ParameterStruct: custom parameters of the current reference design, in struct format % infoStruct.HDLModelDutPath: the block path to the HDL DUT subsystem % infoStruct.ProcessorFPGASynchronization: Processor/FPGA synchronization mode % infoStruct.InterfaceStructCell: target interface table information % a cell array of structure, for example: % infoStruct.InterfaceStructCell{1}.PortName % infoStruct.InterfaceStructCell{1}.PortType % infoStruct.InterfaceStructCell{1}.DataType % infoStruct.InterfaceStructCell{1}.IOInterface % infoStruct.InterfaceStructCell{1}.IOInterfaceMapping hRD = infoStruct.ReferenceDesignObject; refDesignName = hRD.ReferenceDesignName; % validate that when specific parameter is set to specific value, reference % design does not support specific interface paramStruct = infoStruct.ParameterStruct; interfaceStructCell = infoStruct.InterfaceStructCell; for ii = 1:length(interfaceStructCell) interfaceStruct = interfaceStructCell{ii}; if strcmp(paramStruct.DutPath, 'Rx') && ... strcmp(interfaceStruct.IOInterface, 'LEDs General Purpose [0:7]') error('LEDs General Purpose [0:7] must not be used when the DUT path is Rx'); end end end
В помощнике по рабочим процессам HDL, когда HDL Coder™ выполняет задачу Set Target Interface, он выполняет функцию обратного вызова в конце задачи. При указании Rx в качестве пути DUT и используйте LEDs General Purpose [0:7] для вашего порта DUT кодер генерирует ошибку.
При создании функции обратного вызова передайте infoStruct аргумент функции. Аргумент содержит ссылочную конструкцию и информацию о плате в structure формат. Эта информация используется для включения пользовательских проверок DUT в модели Simulink ®.