主要内容

内存映射的MATLAB函数块

这个例子展示了如何将持续数组映射到内存使用MapPersistentVarsToRAM块级参数。RAM的大小必须大于或等于RAMMappingThreshold。资源报告显示区域的差异导致改进内存映射。

行缓冲模型

打开模型hdlcoder_ram_mapping_matlab_function

open_system (“hdlcoder_ram_mapping_matlab_function”)set_param (“hdlcoder_ram_mapping_matlab_function”,“SimulationCommand”,“更新”)

DUT子系统模型驱动行缓冲MATLAB功能块。

open_system (“hdlcoder_ram_mapping_matlab_function / HDL_DUT”)

看到的MATLAB®代码实现线缓冲区,打开MATLAB功能块。

open_system (“hdlcoder_ram_mapping_matlab_function / HDL_DUT /线缓冲区”)

生成HDL代码

1。使生成的资源利用率报告。这份报告显示的蛇,减法器,乘数,寄存器,公羊设计使用。

hdlset_param (“hdlcoder_ram_mapping_matlab_function”,“resourcereport”,“上”)

2。生成HDL代码HDL_DUT子系统。

makehdl (“hdlcoder_ram_mapping_matlab_function / HDL_DUT”)

高密度脂蛋白编码器™显示代码生成报告。在报告中,选择高层资源报告部分,设计消耗81年寄存器和648年出的寄存器。默认情况下,MapPersistentVarsToRAM房地产是禁用和代码生成器不推断或消耗内存资源。

启用内存映射和生成HDL代码

1。启用MapPersistentVarsToRAM高密度脂蛋白在MATLAB功能块参数。

ml_subsys =“hdlcoder_ram_mapping_matlab_function / HDL_DUT /线缓冲区”;hdlset_param (ml_subsys“MapPersistentVarsToRAM”,“上”)

2。生成HDL代码HDL_DUT子系统。

makehdl (“hdlcoder_ram_mapping_matlab_function / HDL_DUT”)

在代码生成报告,选择高层资源报告部分。设计使用一个注册,8比特寄存器,一只公绵羊。公羊的数量取决于RAMMappingThreshold你指定。看到内存映射参数

内存映射与MATLAB Datapath公司的架构

MATLAB Datapath公司架构将MATLAB功能块就像一个普通的子系统。架构将MATLAB仿真软件中的代码,你写一个数据流表示®。金宝app高密度脂蛋白编码器可以更广泛地使用在MATLAB优化模型与其他仿真软件模块功能块。金宝app

1。启用MATLAB Datapath公司高密度脂蛋白架构,然后设置MapPersistentVarsToRAM参数在MATLAB函数块。

hdlset_param (ml_subsys“架构”,MATLAB Datapath公司的)hdlset_param (ml_subsys“MapPersistentVarsToRAM”,“上”)
错误使用cell / ismember(34)行输入的类细胞和B类细胞必须细胞阵列的特征向量,除非你是一个特征向量。错误internal.matlab.publish.compareFigures(35)行[不变,iNewToOld] = ismember (newId oldId);在internal.matlab.publish错误。Publish金宝appSimulinkSystems / leavingCell(28)行systemsToSnap = internal.matlab.publish.compareFigures (obj.savedState newSystems);错误snapnow > leavingCell(第208行)newfile中= data.plugins (iPlugins) .instance.leavingCell (iCell);错误snapnow(第144行)数据= leavingCell (iCell (k),数据,doCapture (k));错误RAMMappingWithMATLABFunctionBlockExample(28)行hdlset_param (‘hdlcoder_ram_mapping_matlab_function’,‘resourcereport’,‘上’)错误evalmxdom > instrumentAndRun(第114行)文本= evalc (evalstr);错误evalmxdom(21)行(数据、文本、laste) = instrumentAndRun(文件、cellBoundaries imageDir、imagePrefix选项);错误发布(第207行)dom = evalmxdom(文件、dom cellBoundaries,前缀,imageDir, outputDir,选项);错误publishMainFile(19)行发布(metadata.main选择); Error in examples.previewExampleInSandbox (line 79) publishMainFile(metadata, metadata.filepath); Error in examples.connector.previewExampleInSandbox (line 3) examples.previewExampleInSandbox(id); Error using cell/ismember (line 34) Input A of class cell and input B of class cell must be cell arrays of character vectors, unless one is a character vector. Error in internal.matlab.publish.compareFigures (line 35) [unchanged, iNewToOld] = ismember(newId, oldId); Error in internal.matlab.publish.PublishSimulinkSystems/leavingCell (line 28) systemsToSnap = internal.matlab.publish.compareFigures(obj.savedState, newSystems); Error in snapnow>leavingCell (line 208) newFiles = data.plugins(iPlugins).instance.leavingCell(iCell); Error in snapnow (line 144) data = leavingCell(iCell(k), data, doCapture(k)); Error in RAMMappingWithMATLABFunctionBlockExample (line 68) hdlset_param(ml_subsys, 'Architecture', 'MATLAB Datapath') Error in evalmxdom>instrumentAndRun (line 114) text = evalc(evalstr); Error in evalmxdom (line 21) [data,text,laste] = instrumentAndRun(file,cellBoundaries,imageDir,imagePrefix,options); Error in publish (line 207) dom = evalmxdom(file,dom,cellBoundaries,prefix,imageDir,outputDir,options); Error in publishMainFile (line 19) publish(metadata.main,opts); Error in examples.previewExampleInSandbox (line 79) publishMainFile(metadata, metadata.filepath); Error in examples.connector.previewExampleInSandbox (line 3) examples.previewExampleInSandbox(id);

2。生成HDL代码HDL_DUT子系统。

makehdl (“hdlcoder_ram_mapping_matlab_function / HDL_DUT”)

高层资源报告表明设计消耗相同数量的资源使用默认架构的设计的MATLAB函数块。来看看MATLAB Datapath公司架构修改模型的MATLAB代码数据流表示,打开生成的模型金宝appgm_hdlcoder_ram_mapping_matlab_function和导航到HDL_DUT子系统。有一个行缓冲子系统的MATLAB函数块。子系统内部的块显示的数据流表示的内存块。

学习设计模式,使高效持久的数组的内存映射MATLAB函数块,看到eml_hdl_design_patterns /公羊图书馆。

相关的话题