В этом примере показано, как сгенерировать модель косимуляции в HDL Coder и интегрировать сгенерированный HDL-код в рабочий процесс HDL- Verifier™. Автоматизация генерации модели косимуляции позволяет бесперебойно верифицировать сгенерированное оборудование проекта.
Косимуляция является сложной задачей, особенно с автоматически сгенерированным кодом; необходимо сохранить в синхронизации различные аспекты исходной модели, включая частоты дискретизации, системы с прямой/прямой связью и другие различные параметры и настройки, используемые во время генерации кода, при настройке блока HDL Verifier и целевого симулятора EDA.
Автоматическая генерация модели косимуляции выводит догадку из блока косимуляции HDL и настройки симулятора путем расшифровки всей скомпилированной информации о модели и генерации кода; в сложение все автоматизированные настройки задокументированы в сгенерированных скриптах. Конечным результатом является модель косимуляции, готовая к проверке сгенерированного кода.
% >> 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 code coverage».
б) При вызове 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', как показано ниже. В некоторых случаях входные сигналы стимула не могут быть непосредственно поданы на блок HDL Cosimulation; например, блок HDL Cosimulation не допускает сложных и векторных сигналов и в таких случаях дальнейшее массирование входных сигналов стимула осуществляется автоматически. В текущей модели блоки 'From' непосредственно питают содержимое соответствующих блоков 'Goto'.
open_system('gm_hdl_cosim_demo1_mq/FromCosimSrc')
Ответ от исходного DUT сравнивается с ответом от блока HDL Cosimulation в HDL Verifier, используя блоки Sink, предоставленные Simulink для визуализации данных отклика.
open_system('gm_hdl_cosim_demo1_mq/Compare')
Для каждого вывода устройства в тестовой подсистеме генерируется следующая модель проверки типа «assertion», которая проверяет исходный выход ('dut ref') с выходом косимуляции ('cosim') и генерирует сообщения типа «assertion», когда вход в блок определения типа «assertion» обнаруживает несоответствие.
open_system('gm_hdl_cosim_demo1_mq/Compare/Assert_Out1')
Утверждения включены в блоке Assertion, но не останавливают симуляцию. Если в качестве части косимуляции существуют какие-либо утверждения из следующего блока, вы должны увидеть предупреждение от блока 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 Cosimulation автоматически заполняется скомпилированным входным выходом DUT. Панель 'Ports' полностью заполнена данными 'Full HDL Name', 'Шаг Расчета' и 'Data Type'. Точно так же автоматически заполняются различные параметры настройки блоков HDL Cosimulation, такие как панели портов TimeScale и tcl. Обратите внимание, что модель косимуляции всегда сконфигурирована в методе соединения 'Shared Memory'.
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 Coder вместе с моделью косимуляции.
Сгенерированный файл 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 (которая захватывает любые изменения/изменения в bit-true или точности цикла исходной модели DUT как части генерации кода)
В следующей части файла скрипта tclstart показаны все параметры makehdltb испытательного стенда, поддерживаемые HDL Coder, и их начальные значения, используемые в скриптах косимуляции.
ClockName, ResetName, ClockEnableName ClockLowTime, ClockHighTime, ClockPeriod ResetLength, ClockEnableDelay, HoldTime
Следующая часть комментария посвящена шагам расчета в модели и тому, как они повлияли на синхронизацию блока HDL Cosimulation в HDL Verifier.
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' включена ' on ', и файлы компиляции генерируются для ModelSim как часть 'makehdl', то генерируется одна команда 'do'. Если опция 'EDAScriptGeneration' повернута ' off ', то для компиляции сгенерированного HDL-кода для DUT добавляются явные команды компиляции.
Команды Wave добавляются для всех сигналов интерфейса верхнего уровня.
В блоке HDL Cosimulation параметр «Pre-simulation Tcl commands» содержит команды силы, которые управляют пакетом часов (часы, clock-enable, reset). Параметр «Время запуска Симулятора HDL перед началом косимуляции» инициирует симуляцию со временем выполнения, необходимым для вывода чипа из сброса.
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 в сгенерированном скрипте 'tclstart' MATLAB. После запуска симулятора все сгенерированный код компилируется, и блок HDL Cosimulation готов к симуляции.
Модельный 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.
Вход комплексный сигнал автоматически разбивается на действительные и мнимые части перед движением блока HDL Cosimulation.
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