You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MATLAB调用nclaunch启动Xcelium模拟器报extra characters after close-quote错误

问题原因与解决方案

错误extra characters after close-quote源于hdlsimmatlab命令的-input参数中存在嵌套双引号,导致Shell解析时提前闭合外层引号,使Tcl无法正确处理后续命令。例如原代码中-input "{@force clk_enable {"1"} -after 0ns}"这类语句,内层的"1"会被Shell误判为外层引号的闭合标记,剩余字符因此变成无效内容。

解决方案

将Tcl命令中包裹值的双引号替换为大括号{}(Tcl中可用大括号实现分组,无需嵌套引号即可正确传递值),同时将原代码中的HTML实体"替换为实际双引号。此外,移除simvision命令中不必要的反斜转义(如\[、\$w),确保Tcl能正确执行变量替换和命令调用。

修正后的代码

tclcmds = {  'exec xmvhdl -64bit osc_filter.vhd simple_osc.vhd osc_top.vhd',...
             'exec xmelab -64bit -access +wc osc_top',...
             ['hdlsimmatlab -gui osc_top -64bit ', ...
              ' -input "{@matlabcp :u_osc_filter -mfunc oscfilter}"',...
              ' -input "{@force clk_enable {1} -after 0ns}"',...
              ' -input "{@force reset {0} -after 0ns {1} -after 40ns {0} -after 120ns}"',...
              ' -input "{@force clk {1} -after 0ns {0} -after 40ns -repeat 80ns}"',...
              ' -input "{@simvision  {set w [waveform new]}}"',...
              ' -input "{@simvision  {waveform add -using $w -signals :clk_enable}}"',...
              ' -input "{@simvision  {waveform add -using $w -signals :clk}}"',...
              ' -input "{@simvision  {waveform add -using $w -signals :reset}}"',...
              ' -input "{@simvision  {waveform add -using $w -signals signed(:osc_out)}}"',...
              ' -input "{@simvision  {waveform add -using $w -signals signed(:filter8x_out)}}"',...
              ' -input "{@simvision  {waveform format -using $w signed(:osc_out) -trace analogSampleAndHold}}"',...
              ' -input "{@simvision  {waveform format -using $w signed(:filter8x_out) -trace analogSampleAndHold}}"',...
              ' -input "{@simvision  {waveform axis range -min -50000 -max 50000 -using $w signed(:osc_out)}}"',...
              ' -input "{@simvision  {waveform axis range -min -1.5e6 -max 1.5e6 -using $w signed(:filter8x_out)}}"',...  
              ' -input "{@database -open waves -into waves.shm -default}"',...
              ' -input "{@probe -create -shm :clk_enable :clk :reset :osc_out :filter8x_out}"',...
              ' -input "{@run 10000ns}"'
             ]};
nclaunch('tclstart',tclcmds);

内容的提问来源于stack exchange,提问作者PRIYANSHU MISHRA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 04:57:05