В этом примере показано, как создать модель косимуляции в кодере ЛПВП и интегрировать сгенерированный код ЛПВП в рабочий процесс Verifier™ ЛПВП. Автоматизация формирования модели косимуляции обеспечивает непрерывную верификацию создаваемой аппаратной конструкции.
Косимуляция является сложной задачей, особенно с автоматически генерируемым кодом; необходимо поддерживать синхронизацию различных аспектов исходной модели, включая частоты дискретизации, системы передачи/передачи и другие различные параметры и настройки, используемые во время генерации кода, при настройке блока проверки HDL и целевого имитатора EDA.
Автоматизированная генерация модели косимуляции извлекает угадывание из блока косимуляции ЛПВП и настройки симулятора путем расшифровки всей скомпилированной информации о модели и генерации кода; кроме того, все автоматические настройки задокументированы в созданных сценариях. Конечным результатом является модель косимуляции, готовая к проверке созданного кода.
% >> docsearch('Code Generation for HDL Cosimulation Model')
Возьмем простую конструкцию накопителя в Simulink и автоматически создадим модель косимуляции для него как часть создания испытательного стенда.
Открытие исходной конструкции/модели
bdclose all; load_system('hdl_cosim_demo1') open_system('hdl_cosim_demo1/MAC') % Now generate vhdl code for the device under test 'MAC' in that % model in the source Simulink model. makehdl('hdl_cosim_demo1/MAC', 'targetlang', 'vh')
### Generating HDL for 'hdl_cosim_demo1/MAC'.
### Using the config set for model <a href="matlab:configset.showParameterGroup('hdl_cosim_demo1', { 'HDL Code Generation' } )">hdl_cosim_demo1</a> for HDL code generation parameters.
### Running HDL checks on the model 'hdl_cosim_demo1'.
### Begin compilation of the model 'hdl_cosim_demo1'...
### Applying HDL optimizations on the model 'hdl_cosim_demo1'...
### Begin model generation.
### Model generation complete.
### Begin VHDL Code Generation for 'hdl_cosim_demo1'.
### Working on hdl_cosim_demo1/MAC as hdlsrc/hdl_cosim_demo1/MAC.vhd.
### Code Generation for 'hdl_cosim_demo1' completed.
### Creating HDL Code Generation Check Report file:///tmp/BR2021ad_1584584_202060/publish_examples1/tp8fdc0684/hdlsrc/hdl_cosim_demo1/MAC_report.html
### HDL check for 'hdl_cosim_demo1' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.

HDL Coder поддерживает создание модели косимуляции с блоком HDL Verifier для Mentor Graphics 'Modelsim' или Cadence 'Incisive'
% Now as a part of test bench generation specify that in addition to the % textual based test bench a cosimulation model needs to be generated. Use % the new makehdl parameter 'GenerateCosimModel' with value 'ModelSim' or % 'Incisive' to choose between the two HDL Verifier blocks to generate the % cosimulation model. makehdltb('hdl_cosim_demo1/MAC', 'targetlang', 'vh', 'GenerateCosimModel', 'ModelSim')
### Begin TestBench generation.
### Generating HDL TestBench for 'hdl_cosim_demo1/MAC'.
### Begin compilation of the model 'hdl_cosim_demo1'...
### Begin compilation of the model 'gm_hdl_cosim_demo1'...
### Generating new cosimulation model: <a href="matlab:open_system('gm_hdl_cosim_demo1_mq')">gm_hdl_cosim_demo1_mq</a>.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_mq_tcl.m.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_mq_batch_tcl.m.
### Note: Option 'Allow Direct Feedthrough' has been set to 'on' on 'gm_hdl_cosim_demo1_mq/MAC_mq'
### Begin simulation of the model 'gm_hdl_cosim_demo1'...
### Collecting data...
### Generating test bench data file: hdlsrc/hdl_cosim_demo1/In1.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo1/In2.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo1/Out1_expected.dat.
### Working on MAC_tb as hdlsrc/hdl_cosim_demo1/MAC_tb.vhd.
### Generating package file hdlsrc/hdl_cosim_demo1/MAC_tb_pkg.vhd.
### HDL TestBench generation complete.


Для настройки имитатора HDL для создания базы данных покрытия кода выполните одно из следующих действий:
a.) На панели «Создание кода HDL > Испытательный стенд» установите флажок «Покрытие кода HDL».
б.) При вызове makehdltb установите значение HDLCodeCoverage на on. Например:
makehdltb('hdl_cosim_demo1/MAC', 'targetlang', 'vh', 'GenerateCosimModel', 'ModelSim','HDLCodeCoverage','on');
Артефакты покрытия кода HDL генерируются в исходном каталоге после моделирования тестового стенда.
Как видно из следующих дополнительных сообщений генерации кода в командном окне, создается модель косимуляции «gm _ hdl _ cosim _ demo1 _ mq»; В дополнение к коду, сгенерированному в целевом каталоге 'hdlsrc', генерируется дополнительный сценарий косимуляции 'gm _ hdl _ cosim _ demo1 _ mq _ tcl.m' для подготовки целевого симулятора к косимуляции с помощью Simulink.
### Generating new cosimulation model: gm_hdl_cosim_demo1_mq ### Generating new cosimulation tcl script: hdlsrc/gm_hdl_cosim_demo1_mq_tcl.m ### Cosimulation Model Generation Complete.
Как видно из модели косимуляции, исходное тестируемое устройство (DUT) перехватывается двумя подсистемами «ToCosimSrc» и «ToCosimSink»; Как показано ниже, назначение этих двух подсистем состоит в том, чтобы захватить стимул и отклик DUT и использовать его для управления косимуляцией с помощью блоков «Goto». Количество блоков «Goto» в каждой из следующих подсистем соответствует количеству входов и выходов DUT.
open_system('gm_hdl_cosim_demo1_mq/ToCosimSrc') open_system('gm_hdl_cosim_demo1_mq/ToCosimSink')

Стимул, который первоначально возбуждает DUT, подается в полностью сконфигурированный блок косимуляции HDL с использованием блока «From», как показано ниже. В некоторых случаях входные сигналы стимула не могут подаваться непосредственно в блок косимуляции ЛВП; например, блок косимуляции ЛВП не допускает сложных и векторных сигналов, и в таких случаях дальнейшее массирование входных сигналов стимула выполняется автоматически. В текущей модели блоки From непосредственно подают содержимое соответствующих блоков Goto.
open_system('gm_hdl_cosim_demo1_mq/FromCosimSrc')

Ответ от исходного DUT сравнивается с ответом от блока Cosimulation HDL в HDL Verifier с использованием блоков Sink, предоставленных Simulink для визуализации данных ответа.
open_system('gm_hdl_cosim_demo1_mq/Compare')

Для каждого выхода тестируемого устройства генерируется следующая модель проверки утверждения, которая проверяет исходный выход («dut ref») с выходом косимуляции («cosim») и генерирует сообщения утверждения, когда вход блока утверждения обнаруживает несоответствие.
open_system('gm_hdl_cosim_demo1_mq/Compare/Assert_Out1')

Утверждения включены в блоке Assertion, но не останавливают моделирование. Если как часть косимуляции есть какие-либо утверждения из следующего блока, вы должны увидеть предупреждение из блока Утверждение:
Warning: Assertion detected in 'gm_hdl_cosim_demo1_mq/Compare/Assert_Out1/AssertEq' at time 1.000000
open_system('gm_hdl_cosim_demo1_mq/Compare/Assert_Out1/AssertEq')
Блок косимуляции HDL автоматически заполняется скомпилированным входным выходным интерфейсом DUT. Панель «Ports» полностью заполнена данными «Full HDL Name», «Sample Time» и «Data type». Аналогично, автоматически заполняются различные параметры настройки блоков косимуляции HDL, такие как панели TimeScale и tcl-портов. Обратите внимание, что модель косимуляции всегда настраивается в методе подключения «Общая память».
open_system('gm_hdl_cosim_demo1_mq/MAC_mq')

Теперь рассмотрим автоматизацию, связанную с запуском и настройкой имитатора цели (ModelSim или Incisive). Как видно на верхнем уровне генерируемой модели, подсистема с именем «Start Simulator» генерируется со следующей функцией обратного вызова: эта подсистема используется для запуска выбранного имитатора цели.
get_param('gm_hdl_cosim_demo1_mq/Start Simulator', 'OpenFcn')
ans =
'try
cosimDirName = pwd;
cd 'hdlsrc/hdl_cosim_demo1';
vsim('tclstart',gm_hdl_cosim_demo1_mq_tcl);
cd (cosimDirName);
clear cosimDirName;
catch me
disp('Failed to launch cosimulator with "vsim"');
disp (me.message);
cd (cosimDirName);
clear cosimDirName;
end'
При запуске выполняется следующий сценарий
vsim('tclstart',gm_hdl_cosim_demo1_mq_tcl)Команда MATLAB «vsim» для ModelSim (или «hdlsimulink» для Incisive) запускает имитатор цели из среды MATLAB с необходимой настройкой для косимуляции. Команда «vsim» вызывается с параметром «tclstart», который принимает строку tcl, настраивающую симулятор при запуске. Файл «gm _ hdl _ cosim _ demo1 _ mq _ tcl» также автоматически генерируется кодером HDL вместе с моделью косимуляции.
Созданный файл tclstart содержит команды для настройки запускаемого симулятора, а также комментарии о том, как создаются различные настройки модели Cosimulation.
type hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_mq_tcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Auto generated cosimulation 'tclstart' script
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Source Model : hdl_cosim_demo1
% Generated Model : gm_hdl_cosim_demo1
% Cosimulation Model : gm_hdl_cosim_demo1_mq
%
% Source DUT : gm_hdl_cosim_demo1_mq/MAC
% Cosimulation DUT : gm_hdl_cosim_demo1_mq/MAC_mq
%
% File Location : hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_mq_tcl.m
% Created : 2021-01-27 13:51:52
%
% Generated by MATLAB 9.10 and HDL Coder 3.18
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ClockName : clk
% ResetName : reset
% ClockEnableName : clk_enable
%
% ClockLowTime : 5ns
% ClockHighTime : 5ns
% ClockPeriod : 10ns
%
% ResetLength : 20ns
% ClockEnableDelay : 10ns
% HoldTime : 2ns
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ModelBaseSampleTime : 1
% DutBaseSampleTime : 1
% OverClockFactor : 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mapping of DutBaseSampleTime to ClockPeriod
%
% N = (ClockPeriod / DutBaseSampleTime) * OverClockFactor
% 1 sec in Simulink corresponds to 10ns in the HDL Simulator(N = 10)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ResetHighAt : (ClockLowTime + ResetLength + HoldTime)
% ResetRiseEdge : 27ns
% ResetType : async
% ResetAssertedLevel : 1
%
% ClockEnableHighAt : (ClockLowTime + ResetLength + ClockEnableDelay + HoldTime)
% ClockEnableRiseEdge : 37ns
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function tclCmds = gm_hdl_cosim_demo1_mq_tcl
tclCmds = {
'do MAC_compile.do',...% Compile the generated code
'vsimulink -voptargs=+acc work.MAC',...% Initiate cosimulation
'add wave /MAC/clk',...% Add wave commands for chip input signals
'add wave /MAC/reset',...
'add wave /MAC/clk_enable',...
'add wave /MAC/In1',...
'add wave /MAC/In2',...
'add wave /MAC/ce_out',...% Add wave commands for chip output signals
'add wave /MAC/Out1',...
'set UserTimeUnit ns',...% Set simulation time unit
'puts ""',...
'puts "Ready for cosimulation..."',...
};
end
На верхнем уровне в комментариях указываются имена исходных и сгенерированных моделей той части модели DUT, для которой создается и совместно моделируется код. Cosimulation HDL Verifier DUT размещается параллельно с нашей генерируемой моделью DUT (которая фиксирует любые изменения/изменения битовой истинности или точности цикла исходной модели DUT как часть генерации кода).
В следующей части файла сценария tclstart показаны все параметры тестового стенда makehdltb, поддерживаемые кодером HDL, и их исходные значения, используемые в сценариях косимуляции.
ClockName, ResetName, ClockEnableName ClockLowTime, ClockHighTime, ClockPeriod ResetLength, ClockEnableDelay, HoldTime
Следующая часть раздела комментариев описывает время выборки в модели и то, как они повлияли на синхронизацию блока косимуляции ЛПВП в верификаторе ЛПВП.
N = (ClockPeriod / DutBaseSampleTime) * OverClockFactor 1 sec in Simulink corresponds to 10ns in the HDL Simulator(N = 10)
Функция в «gm _ hdl _ cosim _ demo1 _ mq _ tcl» генерирует необходимую командную строку tcl (tclCmds).
Если опция «EDAScriptGeneration» включена и файлы компиляции создаются для ModelSim как часть makehdl, то создается одна команда «do». Если параметр «EDAScriptGeneration» отключен, то для компиляции сгенерированного кода HDL для DUT добавляются явные команды компиляции.
Для всех интерфейсных сигналов верхнего уровня добавляются волновые команды.
В блоке Cosimulation HDL параметр «Pre-simulation Tcl commands» содержит силовые команды, управляющие пакетом часов (clock, clock-enable, reset). Параметр «Time to run HDL simulator before cosimulation start» (Время запуска имитатора ЛПВП перед запуском косимуляции) инициирует моделирование со временем выполнения, необходимым для сброса микросхемы.
get_param('gm_hdl_cosim_demo1_mq/MAC_mq','TclPreSimCommand')
ans =
'puts "Running Simulink Cosimulation block.";
puts "Chip Name: --> hdl_cosim_demo1/MAC";
puts "Target language: --> vhdl";
puts "Target directory: --> hdlsrc/hdl_cosim_demo1";
puts [clock format [clock seconds]];
# Clock force command;
force /MAC/clk 0 0ns, 1 5ns -r 10ns;
# Clock enable force command;
force /MAC/clk_enable 0 0ns, 1 37ns;
# Reset force command;
force /MAC/reset 1 0ns, 0 27ns;
'
Двойное нажатие кнопки Start Simulator запускает симулятор с командами tcl в сгенерированном сценарии MATLAB «tclstart». После запуска симулятора весь сгенерированный код компилируется, и блок косимуляции HDL готов к моделированию.
Модель hdl_cosim_demo2 содержит сложную подсистему MAC;
bdclose all; load_system('hdl_cosim_demo2'); open_system('hdl_cosim_demo2/Complex MAC'); makehdl('hdl_cosim_demo2/Complex MAC', 'targetlang', 'vh');
### Generating HDL for 'hdl_cosim_demo2/Complex MAC'.
### Using the config set for model <a href="matlab:configset.showParameterGroup('hdl_cosim_demo2', { 'HDL Code Generation' } )">hdl_cosim_demo2</a> for HDL code generation parameters.
### Running HDL checks on the model 'hdl_cosim_demo2'.
### Begin compilation of the model 'hdl_cosim_demo2'...
### Applying HDL optimizations on the model 'hdl_cosim_demo2'...
### Begin model generation.
### Model generation complete.
### Begin VHDL Code Generation for 'hdl_cosim_demo2'.
### Working on hdl_cosim_demo2/Complex MAC as hdlsrc/hdl_cosim_demo2/Complex_MAC.vhd.
### Code Generation for 'hdl_cosim_demo2' completed.
### Creating HDL Code Generation Check Report file:///tmp/BR2021ad_1584584_202060/publish_examples1/tp8fdc0684/hdlsrc/hdl_cosim_demo2/Complex_MAC_report.html
### HDL check for 'hdl_cosim_demo2' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.

Давайте создадим модель косимуляции как часть генерации тестового стенда и рассмотрим стимулирующую часть модели косимуляции:
makehdltb('hdl_cosim_demo2/Complex MAC', 'targetlang', 'vh', 'GenerateCosimModel', 'ModelSim')
### Begin TestBench generation.
### Generating HDL TestBench for 'hdl_cosim_demo2/Complex MAC'.
### Begin compilation of the model 'hdl_cosim_demo2'...
### Begin compilation of the model 'gm_hdl_cosim_demo2'...
### Generating new cosimulation model: <a href="matlab:open_system('gm_hdl_cosim_demo2_mq')">gm_hdl_cosim_demo2_mq</a>.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo2/gm_hdl_cosim_demo2_mq_tcl.m.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo2/gm_hdl_cosim_demo2_mq_batch_tcl.m.
### Note: Option 'Allow Direct Feedthrough' has been set to 'on' on 'gm_hdl_cosim_demo2_mq/Complex MAC_mq'
### Begin simulation of the model 'gm_hdl_cosim_demo2'...
### Collecting data...
### Generating test bench data file: hdlsrc/hdl_cosim_demo2/In1_re.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo2/In1_im.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo2/Out1_im_expected.dat.
### Working on Complex_MAC_tb as hdlsrc/hdl_cosim_demo2/Complex_MAC_tb.vhd.
### Generating package file hdlsrc/hdl_cosim_demo2/Complex_MAC_tb_pkg.vhd.
### HDL TestBench generation complete.


Входной комплексный сигнал автоматически разбивается на реальные и мнимые части перед возбуждением блока косимуляции ЛВП.
open_system('gm_hdl_cosim_demo2_mq/FromCosimSrc')

В разделе сравнения результаты проверяются для действительной и мнимой частей комплексных выходов по отдельности.
open_system('gm_hdl_cosim_demo2_mq/Compare/Assert_Out1')

Модель hdl_cosim_demo3 содержит подсистему Vector MAC;
bdclose all; load_system('hdl_cosim_demo3'); open_system('hdl_cosim_demo3/Vector MAC'); makehdl('hdl_cosim_demo3/Vector MAC', 'targetlang', 've');
### Generating HDL for 'hdl_cosim_demo3/Vector MAC'.
### Using the config set for model <a href="matlab:configset.showParameterGroup('hdl_cosim_demo3', { 'HDL Code Generation' } )">hdl_cosim_demo3</a> for HDL code generation parameters.
### Running HDL checks on the model 'hdl_cosim_demo3'.
### Begin compilation of the model 'hdl_cosim_demo3'...
### Applying HDL optimizations on the model 'hdl_cosim_demo3'...
### Begin model generation.
### Model generation complete.
### Begin Verilog Code Generation for 'hdl_cosim_demo3'.
### Working on hdl_cosim_demo3/Vector MAC as hdlsrc/hdl_cosim_demo3/Vector_MAC.v.
### Code Generation for 'hdl_cosim_demo3' completed.
### Creating HDL Code Generation Check Report file:///tmp/BR2021ad_1584584_202060/publish_examples1/tp8fdc0684/hdlsrc/hdl_cosim_demo3/Vector_MAC_report.html
### HDL check for 'hdl_cosim_demo3' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.

Давайте создадим модель косимуляции как часть генерации тестового стенда и понаблюдаем за стимулирующей частью модели косимуляции для векторных сигналов в «verilog», где мы выравниваем векторные сигналы для генерации кода.
makehdltb('hdl_cosim_demo3/Vector MAC', 'targetlang', 've', 'GenerateCosimModel', 'ModelSim')
### Begin TestBench generation.
### Generating HDL TestBench for 'hdl_cosim_demo3/Vector MAC'.
### Begin compilation of the model 'hdl_cosim_demo3'...
### Begin compilation of the model 'gm_hdl_cosim_demo3'...
### Generating new cosimulation model: <a href="matlab:open_system('gm_hdl_cosim_demo3_mq')">gm_hdl_cosim_demo3_mq</a>.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo3/gm_hdl_cosim_demo3_mq_tcl.m.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo3/gm_hdl_cosim_demo3_mq_batch_tcl.m.
### Note: Option 'Allow Direct Feedthrough' has been set to 'on' on 'gm_hdl_cosim_demo3_mq/Vector MAC_mq'
### Begin simulation of the model 'gm_hdl_cosim_demo3'...
### Collecting data...
### Generating test bench data file: hdlsrc/hdl_cosim_demo3/In1_0.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo3/In1_1.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo3/Out1_0_0_expected.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo3/Out1_0_1_expected.dat.
### Working on Vector_MAC_tb as hdlsrc/hdl_cosim_demo3/Vector_MAC_tb.v.
### HDL TestBench generation complete.


open_system('gm_hdl_cosim_demo3_mq/FromCosimSrc')

open_system('gm_hdl_cosim_demo3_mq/Compare')

Модель hdl_cosim_demo4 содержит подсистему MAC с блоком Sum of Elements, который сконфигурирован с реализацией Cascade и требует оверклокинга, как видно из сообщений генерации кода.
bdclose all; load_system('hdl_cosim_demo4'); open_system('hdl_cosim_demo4/LocalMR MAC'); makehdl('hdl_cosim_demo4/LocalMR MAC', 'targetlang', 'vh'); makehdltb('hdl_cosim_demo4/LocalMR MAC', 'targetlang', 'vh', 'GenerateCosimModel', 'ModelSim');
### Generating HDL for 'hdl_cosim_demo4/LocalMR MAC'.
### Using the config set for model <a href="matlab:configset.showParameterGroup('hdl_cosim_demo4', { 'HDL Code Generation' } )">hdl_cosim_demo4</a> for HDL code generation parameters.
### Running HDL checks on the model 'hdl_cosim_demo4'.
### Begin compilation of the model 'hdl_cosim_demo4'...
### Applying HDL optimizations on the model 'hdl_cosim_demo4'...
### The code generation and optimization options you have chosen have introduced additional pipeline delays.
### The delay balancing feature has automatically inserted matching delays for compensation.
### The DUT requires an initial pipeline setup latency. Each output port experiences these additional delays.
### Output port 1: 1 cycles.
### Begin model generation.
### Model generation complete.
### Begin VHDL Code Generation for 'hdl_cosim_demo4'.
### MESSAGE: The design requires 5 times faster clock with respect to the base rate = 1.
### Working on hdl_cosim_demo4/LocalMR MAC/Sum of Elements/serial_sum_operation as hdlsrc/hdl_cosim_demo4/serial_sum_operation.vhd.
### Working on hdl_cosim_demo4/LocalMR MAC/Sum of Elements as hdlsrc/hdl_cosim_demo4/Sum_of_Elements.vhd.
### Working on LocalMR MAC_tc as hdlsrc/hdl_cosim_demo4/LocalMR_MAC_tc.vhd.
### Working on hdl_cosim_demo4/LocalMR MAC as hdlsrc/hdl_cosim_demo4/LocalMR_MAC.vhd.
### Generating package file hdlsrc/hdl_cosim_demo4/LocalMR_MAC_pkg.vhd.
### Code Generation for 'hdl_cosim_demo4' completed.
### Creating HDL Code Generation Check Report file:///tmp/BR2021ad_1584584_202060/publish_examples1/tp8fdc0684/hdlsrc/hdl_cosim_demo4/LocalMR_MAC_report.html
### HDL check for 'hdl_cosim_demo4' complete with 0 errors, 0 warnings, and 3 messages.
### HDL code generation complete.
### Begin TestBench generation.
### Generating HDL TestBench for 'hdl_cosim_demo4/LocalMR MAC'.
### Begin compilation of the model 'hdl_cosim_demo4'...
### Begin compilation of the model 'gm_hdl_cosim_demo4'...
### Generating new cosimulation model: <a href="matlab:open_system('gm_hdl_cosim_demo4_mq')">gm_hdl_cosim_demo4_mq</a>.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo4/gm_hdl_cosim_demo4_mq_tcl.m.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo4/gm_hdl_cosim_demo4_mq_batch_tcl.m.
### Note: Option 'Allow Direct Feedthrough' has been set to 'on' on 'gm_hdl_cosim_demo4_mq/LocalMR MAC_mq'
### Begin simulation of the model 'gm_hdl_cosim_demo4'...
### Collecting data...
### Generating test bench data file: hdlsrc/hdl_cosim_demo4/In1.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo4/Out1_expected.dat.
### Working on LocalMR_MAC_tb as hdlsrc/hdl_cosim_demo4/LocalMR_MAC_tb.vhd.
### Generating package file hdlsrc/hdl_cosim_demo4/LocalMR_MAC_tb_pkg.vhd.
### HDL TestBench generation complete.



Сообщения генерации кода показывают оверклокинг, который требует в пять раз более быстрого тактового сигнала по отношению к базовой скорости модели. Эта информация инкапсулируется в модель косимуляции как часть настройки шкалы времени в соответствии со следующим сообщением
N = (ClockPeriod / DutBaseSampleTime) * OverClockFactor 1 sec in Simulink corresponds to 50ns in the HDL Simulator(N = 50)
bdclose all; load_system('hdl_cosim_demo1') makehdl('hdl_cosim_demo1/MAC', 'targetlang', 'vh') makehdltb('hdl_cosim_demo1/MAC', 'targetlang', 'vh', 'GenerateCosimModel', 'Incisive') type hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_in_tcl bdclose all; % close Modelsim %tclHdlSim('after 1000 quit -f');
### Generating HDL for 'hdl_cosim_demo1/MAC'.
### Using the config set for model <a href="matlab:configset.showParameterGroup('hdl_cosim_demo1', { 'HDL Code Generation' } )">hdl_cosim_demo1</a> for HDL code generation parameters.
### Running HDL checks on the model 'hdl_cosim_demo1'.
### Begin compilation of the model 'hdl_cosim_demo1'...
### Applying HDL optimizations on the model 'hdl_cosim_demo1'...
### Begin model generation.
### Model generation complete.
### Begin VHDL Code Generation for 'hdl_cosim_demo1'.
### Working on hdl_cosim_demo1/MAC as hdlsrc/hdl_cosim_demo1/MAC.vhd.
### Code Generation for 'hdl_cosim_demo1' completed.
### Creating HDL Code Generation Check Report file:///tmp/BR2021ad_1584584_202060/publish_examples1/tp8fdc0684/hdlsrc/hdl_cosim_demo1/MAC_report.html
### HDL check for 'hdl_cosim_demo1' complete with 0 errors, 0 warnings, and 0 messages.
### HDL code generation complete.
### Begin TestBench generation.
### Generating HDL TestBench for 'hdl_cosim_demo1/MAC'.
### Begin compilation of the model 'hdl_cosim_demo1'...
### Begin compilation of the model 'gm_hdl_cosim_demo1'...
### Generating new cosimulation model: <a href="matlab:open_system('gm_hdl_cosim_demo1_in')">gm_hdl_cosim_demo1_in</a>.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_in_tcl.m.
### Generating new cosimulation tcl script: hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_in_batch_tcl.m.
### Note: Option 'Allow Direct Feedthrough' has been set to 'on' on 'gm_hdl_cosim_demo1_in/MAC_in'
### Begin simulation of the model 'gm_hdl_cosim_demo1'...
### Collecting data...
### Generating test bench data file: hdlsrc/hdl_cosim_demo1/In1.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo1/In2.dat.
### Generating test bench data file: hdlsrc/hdl_cosim_demo1/Out1_expected.dat.
### Working on MAC_tb as hdlsrc/hdl_cosim_demo1/MAC_tb.vhd.
### Generating package file hdlsrc/hdl_cosim_demo1/MAC_tb_pkg.vhd.
### HDL TestBench generation complete.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Auto generated cosimulation 'tclstart' script
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Source Model : hdl_cosim_demo1
% Generated Model : gm_hdl_cosim_demo1
% Cosimulation Model : gm_hdl_cosim_demo1_in
%
% Source DUT : gm_hdl_cosim_demo1_in/MAC
% Cosimulation DUT : gm_hdl_cosim_demo1_in/MAC_in
%
% File Location : hdlsrc/hdl_cosim_demo1/gm_hdl_cosim_demo1_in_tcl.m
% Created : 2021-01-27 13:52:42
%
% Generated by MATLAB 9.10 and HDL Coder 3.18
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ClockName : clk
% ResetName : reset
% ClockEnableName : clk_enable
%
% ClockLowTime : 5ns
% ClockHighTime : 5ns
% ClockPeriod : 10ns
%
% ResetLength : 20ns
% ClockEnableDelay : 10ns
% HoldTime : 2ns
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ModelBaseSampleTime : 1
% DutBaseSampleTime : 1
% OverClockFactor : 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Mapping of DutBaseSampleTime to ClockPeriod
%
% N = (ClockPeriod / DutBaseSampleTime) * OverClockFactor
% 1 sec in Simulink corresponds to 10ns in the HDL Simulator(N = 10)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ResetHighAt : (ClockLowTime + ResetLength + HoldTime)
% ResetRiseEdge : 27ns
% ResetType : async
% ResetAssertedLevel : 1
%
% ClockEnableHighAt : (ClockLowTime + ResetLength + ClockEnableDelay + HoldTime)
% ClockEnableRiseEdge : 37ns
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function tclCmds = gm_hdl_cosim_demo1_in_tcl
tclCmds = {
'exec ncvhdl -v93 MAC.vhd',...% Compile the generated code
'exec ncelab -access +wc MAC',...
['hdlsimulink -gui MAC',...%Comment: Initiate cosimulation
' -input "{@simvision {set w \[waveform new\]}}"',...% Add wave commands for chip input signals
' -input "{@simvision {waveform add -using \$w -signals :clk}}"',...
' -input "{@probe -create -shm clk }"',...
' -input "{@simvision {waveform add -using \$w -signals :reset}}"',...
' -input "{@probe -create -shm reset }"',...
' -input "{@simvision {waveform add -using \$w -signals :clk_enable}}"',...
' -input "{@probe -create -shm clk_enable }"',...
' -input "{@simvision {waveform add -using \$w -signals :In1}}"',...
' -input "{@probe -create -shm In1 }"',...
' -input "{@simvision {waveform add -using \$w -signals :In2}}"',...
' -input "{@probe -create -shm In2 }"',...
' -input "{@simvision {waveform add -using \$w -signals :ce_out}}"',...% Add wave commands for chip output signals
' -input "{@probe -create -shm ce_out }"',...
' -input "{@simvision {waveform add -using \$w -signals :Out1}}"',...
' -input "{@probe -create -shm Out1 }"',...
' -input "{@database -open waves -into waves.shm -default}"',...
' -input "{@puts \"\"}"',...
' -input "{@puts \"Ready for cosimulation...\"}"',...
]
};
end