В этом примере показано, как сгенерировать cosimulation модель в HDL Coder и интегрировать сгенерированный HDL-код в рабочий процесс HDL Verifier™. Автоматизация cosimulation генерации модели включает бесшовную верификацию сгенерированного аппаратного проекта.
Cosimulation является сложной задачей, особенно с автоматически сгенерированным кодом; нужно сохранить различные аспекты в синхронизации исходной модели включая частоты дискретизации, системы feedforward/сквозного соединения, и другие различные параметры и настройки используемыми во время генерации кода при подготовке блока HDL Verifier и целевого Средства моделирования EDA.
Автоматизированная cosimulation генерация модели вынимает догадки из HDL cosimulation блок и настройка средства моделирования путем дешифровки всей скомпилированной модели и информации о генерации кода; кроме того, все автоматизированные настройки документируются в сгенерированные скрипты. Конечный результат является cosimulation моделью, готовой проверять сгенерированный код.
% >> docsearch('Code Generation for HDL Cosimulation Model')
Давайте возьмем простой проект аккумулятора в Simulink и автоматически сгенерируем cosimulation модель для него как часть генерации испытательного стенда.
Откройте исходный проект/модель
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/BR2021bd_1747695_9596/publish_examples0/tp2759906c/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 поддерживает генерацию cosimulation модели с блоком HDL Verifier для Mentor Graphics 'Modelsim' или 'Острой' Кэденс
% 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'.
b.) Когда вы вызываете 'makehdltb', устанавливаете 'HDLCodeCoverage' на 'on'. Например:
makehdltb('hdl_cosim_demo1/MAC', 'targetlang', 'vh', 'GenerateCosimModel', 'ModelSim','HDLCodeCoverage','on');
Артефакты покрытия HDL-кода сгенерированы в исходной директории после того, как испытательный стенд будет симулирован.
Как вы видите из следующих сообщений генерации дополнительного кода в командном окне сгенерирована, cosimulation модель 'gm_hdl_cosim_demo1_mq'; В дополнение к коду, сгенерированному в целевой директории 'hdlsrc' дополнительный cosimulation скрипт, 'gm_hdl_cosim_demo1_mq_tcl.m' сгенерирован, чтобы подготовить целевое средство моделирования к cosimulation с 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.
Как видно из cosimulation модели исходное устройство под тестом (DUT) прерывается двумя подсистемами 'ToCosimSrc' и 'ToCosimSink'; Как показано ниже цели этих двух подсистем должен получить стимул и ответ DUT и использовать его для управления cosimulation использование блоков 'Goto'. Количество блоков 'Goto' в каждой следующей подсистеме совпадает с количеством вводов и выводов DUT.
open_system('gm_hdl_cosim_demo1_mq/ToCosimSrc') open_system('gm_hdl_cosim_demo1_mq/ToCosimSink')
Стимул, который первоначально управляет DUT, питается полностью сконфигурированный HDL cosimulation блок с помощью блока 'From' как показано ниже. В некоторых случаях введите сигналы стимула, не может непосредственно питаться блок HDL Cosimulation; например, блок HDL Cosimulation не позволяет комплексные и векторные сигналы, и в таких случаях, далее массажируя входных сигналов стимула сделан автоматически. В текущей модели 'От' блоков непосредственно питают содержимое соответствующих блоков 'Goto'.
open_system('gm_hdl_cosim_demo1_mq/FromCosimSrc')
Ответ от исходного DUT по сравнению с ответом от блока HDL Cosimulation в HDL Verifier с помощью блоков Приемника, обеспеченных Simulink для визуализации данных об ответе.
open_system('gm_hdl_cosim_demo1_mq/Compare')
Для каждого выхода устройства под тестовой подсистемой следующая проверяющая утверждение модель сгенерирована, который проверяет, что исходный выход ('dut касательно') с cosimulation вывел ('cosim'), и генерирует сообщения утверждения, когда вход с блоком утверждения обнаруживает несоответствие.
open_system('gm_hdl_cosim_demo1_mq/Compare/Assert_Out1')
Утверждения включены в блоке Assertion, но не останавливают симуляцию. Если, когда часть cosimulation там является какими-либо утверждениями от следующего блока, необходимо видеть предупреждение от блока 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. Панель 'Портов' полностью заполняется с 'Полным Именем HDL', информация 'о Типе данных' и 'Шаг расчета'. Столь же различные параметры настройки блока HDL Cosimulation, такие как TimeScale и tcl панели порта автоматически заполняются. Обратите внимание на то, что модель cosimulation всегда конфигурируется в методе связи 'Общей памяти'.
open_system('gm_hdl_cosim_demo1_mq/MAC_mq')
Теперь давайте посмотрим на автоматизацию, сопоставленную с запуском и настройкой целевого средства моделирования (ModelSim или Острый). Как видно в верхнем уровне сгенерированной модели, Запускается Подсистема с именем ', Средство моделирования' сгенерировано со следующей функцией обратного вызова; эта подсистема используется, чтобы запустить целевое предпочтительное средство моделирования.
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' для Острого) запускает целевое средство моделирования из среды MATLAB с необходимой настройкой для cosimulation. 'vsim' команда вызывается с 'tclstart' опцией, которая принимает строку tcl, которая конфигурирует средство моделирования на его запуске. Файл 'gm_hdl_cosim_demo1_mq_tcl' также автоматически сгенерирован HDL Coder наряду с cosimulation моделью.
Сгенерированный 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-08-19 17:27:40 % % Generated by MATLAB 9.11 and HDL Coder 3.19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 модели, для которой код сгенерирован и являющийся co-simulated. cosimulation DUT HDL Verifier помещается параллельно с нашей сгенерированной моделью DUT, (который получает любые модификации/изменения к битно-истинному или точности цикла исходной модели DUT как часть генерации кода),
Следующая часть tclstart файла скрипта показывает все makehdltb параметры испытательного стенда, поддержанные HDL Coder и их начальными значениями, используемыми в cosimulation скриптах.
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', то сингл 'действительно' управляет, сгенерирован. Если опцией 'EDAScriptGeneration' является превращенный 'off', то явные команды компиляции добавляются для компиляции сгенерированного HDL-кода для DUT.
Команды волны добавляются для всех интерфейсных сигналов верхнего уровня.
В блоке HDL Cosimulation "Предварительная симуляция параметр" команд Tcl содержит команды силы, которые управляют пакетом часов (часы, часы - включают, сбрасывают). "Время, чтобы запустить симулятор HDL прежде cosimulation запускает" параметр, инициирует симуляцию со временем выполнения, необходимым, чтобы вывести чип из сброса.
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; '
Двойной щелчок по Средству моделирования Запуска запускает средство моделирования с 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/BR2021bd_1747695_9596/publish_examples0/tp2759906c/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.
Давайте сгенерируем cosimulation модель как часть генерации испытательного стенда и давайте наблюдать часть стимула cosimulation модели:
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 содержит Векторную подсистему 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/BR2021bd_1747695_9596/publish_examples0/tp2759906c/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.
Давайте сгенерируем cosimulation модель как часть генерации испытательного стенда и давайте наблюдать часть стимула cosimulation модели для векторных сигналов в '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, который сконфигурирован с Каскадной реализацией и требует разгона как видно в сообщениях Генерации кода.
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/BR2021bd_1747695_9596/publish_examples0/tp2759906c/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.
Сообщения генерации кода показывают разгон, которые требуют в пять раз более быстрых часов относительно базовой ставки модели. Эта информация инкапсулируется в cosimulation модели как часть установки масштаба времени согласно следующему сообщению
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/BR2021bd_1747695_9596/publish_examples0/tp2759906c/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-08-19 17:28:34 % % Generated by MATLAB 9.11 and HDL Coder 3.19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 -64bit -v93 MAC.vhd',...% Compile the generated code 'exec ncelab -64bit -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