weiqi7777

pxp的ixcom模式,memory不能定义太大问题

0
阅读(2045)

定义4G大小空间的memory,位宽是128bit,地址位宽28bit,总共地址位宽32bit,4G大小。

在initial中,使用$readmemh系统函数,读取hex文件,载入到memory中。

在ixcom模式下,irun阶段编译,会报错,提示memory太大。因为EDA编译时,对于很多的memory,是通过hash的方式,来实现管理的,因此这样,就不能定义很大的memory。

此时,需要在ixcom编译阶段,加入以下选项:

-ncelabargs "-sparsearray 10000000"

该选项的意思是,在环境中,如果有memory超过了 10000000 大小,那么这个memory,使用hash的方式去管理。

这样,irun阶段的编译,就通过了。

但是在执行的时候,发现当swap到pxp上,执行的时候,pxp就卡住了。

为了解决pxp上会卡住,不能跑到问题。采用以下方案来进行解决。

首先在文件的初始化中,如果是pxp模式,就不要调用$readmemh函数来对memory进行初始化。

// in pxp mode, shouldn't use $readmemh to load hex file to mem

// should use memory -load $readmemh mem_location -file hex_file in run_tcl

`ifndef PXP

    initialbegin

        $display("memory model will be initialized");

        $readmemh("mem_init_ns.hex", mem);

    end

`endif

修改提供给xeDebug工具的执行tcl脚本,加入memory –load,将hex文件,载入到DUT中的memory中。

注意,该载入,需要在swap到pxp后之后,再进行载入。

run 100ns

xc xt0 zt0 tbrun

memory -load%readmemh tbench_top.u_uto_tb.u_secure_mem.mem -file mem_init.s.hex

memory -load%readmemh tbench_top.u_uto_tb.u_non_seucre_mem.mem -file mem_init_ns.hex

run

使用以上方式,pxp仿真,就可以正常运行了。