%% Terminate Unconnected Block Outputs

% Copyright 2018 The MathWorks, Inc.

%% Guideline ID
% |1.1.9|
%
%% Severity
% _Mandatory_
%
%% Description
% If you generate HDL code for a Subsystem that has unconnected output ports,
% HDL Coder(TM) generates an error. For output ports that are not connected 
% to downstream logic, connect them to a 
% <matlab:helpview(fullfile(docroot,'simulink/slref/terminator.html')) 
% Terminator> block. 
%%
% This model illustrates a |DUT0| Subsystem that has an unconnected output
% port |Out2|. 
open_system('hdlcoder_terminateout')
%%
% If you generate HDL code for this Subsystem, HDL Coder(TM)
% generates this error:
% 
% |error in validation model generation: Failed to find source for outport 2 on
% 'DUT0' Please create a fully connected subsystem when generating the
% cosimulation model|.
close_system('hdlcoder_terminateout')
%%
% You can use the |addterms| function to add Terminator blocks to
% unconnected ports in your model.
load_system('hdlcoder_terminateout')
addterms('hdlcoder_terminateout')
open_system('hdlcoder_terminateout')