问题的提出
整个WR的ISE工程比较大,编译时间很长,导致开发效率低。通过分析发现,ISE在综合的时候大量的时间都花在了初始化DPRAM上。调研发现Xilinx提供了BMM文件和DATA2MEM工具,可以将软核CPU的运行代码在HDL综合完后再与bit文件合并,这样可以节约大量的编译时间。但是在wr工程中使用这些工具的时候出现了错误,软核的代码并没有被成功初始化。

原始代码分析
具体编译wr工程的时候发现,代码ip_cores/general-cores/modules/wishbone/wb_dpram/xwb_dpram.vhd中存在对有无RAM初始化文件进行判断,进而采用了不同的调用DPRAM的方法。
其具体实现如下:

GEN_INITF: if g_init_file /= "" and g_init_file /= "none" generate
U_DPRAM : generic_dpram
generic map(
-- standard parameters
g_data_width => ,
g_size => g_size,
g_with_byte_enable => true,
g_addr_conflict_resolution => "dont_care",
g_init_file => g_init_file,
g_dual_clock => false
)
port map(
rst_n_i => rst_n_i,
-- Port A
clka_i => clk_sys_i,
bwea_i => s_bwea,
wea_i => s_wea,
aa_i => slave1_in.adr(f_log2_size(g_size)- downto ),
da_i => slave1_in.dat,
qa_o => slave1_out.dat,
-- Port B
clkb_i => clk_sys_i,
bweb_i => s_bweb,
web_i => s_web,
ab_i => slave2_in.adr(f_log2_size(g_size)- downto ),
db_i => slave2_in.dat,
qb_o => slave2_out.dat
);
end generate; GEN_NO_INITF: if g_init_file = "" or g_init_file = "none" generate
GEN_BYTESEL: for i in to generate
U_DPRAM: generic_dpram
generic map(
g_data_width => ,
g_size => g_size,
g_with_byte_enable => false,
g_addr_conflict_resolution => "dont_care",
g_init_file => "",
g_dual_clock => false)
port map(
rst_n_i => rst_n_i,
-- Port A
clka_i => clk_sys_i,
wea_i => s_bwea(i),
aa_i => slave1_in.adr(f_log2_size(g_size)- downto ),
da_i => slave1_in.dat((i+)*- downto i*),
qa_o => slave1_out.dat((i+)*- downto i*),
-- Port B
clkb_i => clk_sys_i,
web_i => s_bweb(i),
ab_i => slave2_in.adr(f_log2_size(g_size)- downto ),
db_i => slave2_in.dat((i+)*- downto i*),
qb_o => slave2_out.dat((i+)*- downto i*)
);
end generate;
end generate;

当GEN_NO_INITF的时候,原作者采用了一个很取巧的办法来避免ise综合出来block ram的同时生成大量的mux(LUT5),但此时综合出来RAM模块的形式是1bit(数据位)*16K.

而如果要用BMM的方式来对RAM进行初始化,我们想要的RAM模块的形式是32bit*512. GEN_INITF这部分代码综合出来的结果满足需求。

对于SPEC板而言,他们采用的是PCIe的方法来upload软核的初始化代码,所以他们可以使用他们预先定义的办法来使得elf的文件格式满足前述要求(实际不需要额外的工作即可满足,因为他们是用wishbone总线直接烧写进去的)。

而如果是初始化ram文件,或者采用BMM的方法初始化文件,1bit(数据位)*16K形式的RAM会导致软核代码错误,软核无法工作。

问题结论

为了在cute上面能够更快速的编译,采用无RAM的方式,所以需要将判断语句及GEN_NO_INITF部分的代码全都注释掉。

另外,附上注释后cute的bmm文件,在工程项目中加入bmm文件后会随着工程的编译生成*_bd.bmm文件,之后使用data2mem工具将elf文件和bit文件进行合并。

data2mem -bm ../../elf/cutewr_bd.bmm -bd ../../elf/wrc.elf -bt cutewr.bit -o b cutewr_wrc.bit
/* FILE : cutewr.bmm
* Define a BRAM map for the LM32 memory "xwb_dpram".
* Run ISE Translate -> "Floorplan Area/IO/Logic (PlanAhead)" once (without this BMM file
* attached to the ISE Project) to find out that there are 46 ramloops and each RAMB16
* Note: *THE RAMLOOP ORDER WITHIN A BUS_BLOCK IS VERY IMPORTANT!!!*
* Define ramloop 45 downto 0 and databits 31 downto 0 !!! Otherwise the memory
* content will be swapped and the program fails to execute. Aperently the ramloop
* number and bit definitions are not read by data2mem.
*
*
* Address space LM32 memory "xwb_dpram"
* g_dpram_size = 131072/4
* 64 stacks of size 2048 bytes is 131072 bytes
*
****************************************************************************************/ ADDRESS_SPACE lm32_wrpc_memory RAMB16 [0x00000000:0x0001FFFF]
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram1 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram2 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram3 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram4 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram5 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram6 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram7 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram8 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram9 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram10 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram11 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram12 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram13 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram14 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram15 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram16 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram17 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram18 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram19 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram20 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram21 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram22 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram23 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram24 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram25 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram26 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram27 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram28 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram29 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram30 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram31 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram32 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram33 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram34 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram35 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram36 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram37 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram38 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram39 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram40 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram41 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram42 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram43 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram44 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram45 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram46 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram47 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram48 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram49 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram50 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram51 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram52 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram53 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram54 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram55 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram56 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram57 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram58 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram59 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram60 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram61 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram62 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram63 [:];
END_BUS_BLOCK;
BUS_BLOCK
U_WR_CORE/U_WR_CORE/DPRAM/U_DPRAM/gen_single_clk.U_RAM_SC/Mram_ram64 [:];
END_BUS_BLOCK;
END_ADDRESS_SPACE;

wrHDL编译中软核代码初始化及编译耗时长的问题的更多相关文章

  1. java如何在eclipse编译时自动生成代码

    用eclipse写java代码,自动编译时,如何能够触发一个动作,这个动作是生成本项目的代码,并且编译完成后,自动生成的代码也编译好了, java编辑器中就可以做到对新生成的代码的自动提示? 不生成代 ...

  2. 各种软核处理器二进制文件FPGA初始化文件生成程序

    不管是MIPS, Nios II, MicroBlaze, MSP430, 8051, OpenRISC, OpenSPARC, LEON2/LEON3等等软核处理器,在FPGA上实现的时候我们通常需 ...

  3. Java中String的intern方法,javap&cfr.jar反编译,javap反编译后二进制指令代码详解,Java8常量池的位置

    一个例子 public class TestString{ public static void main(String[] args){ String a = "a"; Stri ...

  4. C++中引用编译过的C代码为什么要用“extern c”

    函数经过编译系统的翻译成汇编,函数名对应着汇编标号.  因为C编译函数名与得到的汇编代号基本一样,如:fun()=>_fun, main=>_main  但是C++中函数名与得到的汇编代号 ...

  5. 【小梅哥FPGA进阶教程】MC8051软核在FPGA上的使用

    十.MC8051软核在FPGA上的使用 本教程内容力求以详细的步骤和讲解让读者以最快的方式学会 MC8051 IP core 的应用以及相关设计软件的使用,并激起读者对 SOPC 技术的兴趣.本实验重 ...

  6. [置顶] 基于FPGA的VGA简易显存设计&NIOS ii软核接入

    项目简介 本项目基于Altera公司的Cyclone IV型芯片,利用NIOS II软核,2-port RAM与时序控制模块,实现64*48分辨率的显存(再大的显存板载资源m9k不够用) 实现效果如下 ...

  7. Spartan6上软核系统自定义外设调用AXI Stream FFT经验

    这几天希望能在Spartan系列新品xc6slx16csg324-2运行带有FFT的软核处理系统,基本系统早就搭建好了.需要做的就是建立一个封装有Xilinx提供的FFT IP的自定义外设.由于Xil ...

  8. 关于Quartus构建nios软核以及eclipse建立c语言工程以及成功下载到FPGA芯片过程遇到的各种问题以及解决方法详解

    这不是一篇构建nios的教程,而是遇到的各种问题以及解决方法.至于构建教程,网上一大把,我推荐正点原子的FPGA教程,比较新,比较详细,通俗易懂!!! 这里以一个点亮LED灯的Nios软核为例,很明显 ...

  9. 【lattice软核】ROM的使用

    =======================>>>>> 一.ROM核调用:==================>>>>> ======== ...

随机推荐

  1. oracle exp imp 导入 正在跳过表 plsql 导入表 成功终止 数据 被导入

    http://blog.csdn.net/agileclipse/article/details/12968011 .导入过程中,所有表导入都出现提示, 正在跳过表...某某表名 最后提示成功终止导入 ...

  2. linux服务器TCP并发连接数优化

    1.查看用户单一进程最大文件打开数 [root@localhost ~]# ulimit -n 1024 2.修改/etc/security/limits.conf文件,添加下面两行, [root@l ...

  3. 使用HttpClient 4.3.4 自动登录并抓取中国联通用户基本信息和账单数据,GET/POST/Cookie

    一.什么是HttpClient? HTTP 协议可能是现在 Internet 上使用得最多.最重要的协议了,越来越多的 Java 应用程序需要直接通过 HTTP 协议来访问网络资源.虽然在 JDK 的 ...

  4. oracle win7下 卸载

    1 右击“计算机”-->管理-->服务和应用程序-->服务,停掉所有Oracle相关的服务(以Oracle打头的,比如OracleDBConsoleorcl). 2 开始--> ...

  5. JSONP跨域的原理解析( 一种脚本注入行为)

    JavaScript是一种在Web开发中经常使用的前端动态脚本技术.在JavaScript中,有一个很重要的安全性限制, 被称为“some-Origin Policy”(同源策略).这一策略对于Jav ...

  6. Abp项目中的领域模型实体类访问仓储的方法

    首先声明,不推荐使用这种方法.实体访问仓储是不被推荐的! 1.简单粗暴的方法 Abp.Dependency.IocManager.Instance.Resolve>(); 2.绕个弯子的方法 首 ...

  7. 深入理解Java虚拟机(一)、Java内存区域与内存溢出异常

    Java虚拟机所管理的内存包括以下几个运行时数据区: 程序计数器(PCR): 1.是一块较小的内存空间,可以看做是当前线程所执行的字节码的行号指示器 2.为线程私有 3.执行Java方法有PCR,执行 ...

  8. TCP/IP详解系列 --- 概念总结02

    TCP复位报文段(RST)的用途: 1.当客户端程序访问不存在的端口时,目标主机将给它发送一个复位报文段:收到复位报文段的一端应该关闭连接或者重新连接,而不能回应这个复位报文段. 2.当客户端程序向服 ...

  9. [MOSEK] Stupid things when using mosek

    1.2016-8-14 我希望把一个qp问题的代码从conic constraints改为无外加约束,仅适用variable bounds的线性不等式约束 于是原来的约束代码为 if (r == MS ...

  10. WinForm开发之取送货管理1

    一.取送货管理项目需求 该系统的业务背景如下:客户是一个针织半成品生产加工作坊,有很多生产加工人员从客户工厂那里取走半成品,加工成成品后送回来.客户根据加工每种半成品的加工单价和完成数量,付费用给生产 ...