FPGARelated.com
Forums

Question about initializing on-chip block mem in XPS?

Started by cathy September 20, 2006
Hello, if my system is organized as the following

	---------Microblaze-----lmb-----8k BRAM
                            |
                     Opb Bus
                            |
                    64k BRAM-----opb bus-----customized circuit


I initialized my opb bram with the following sentence.
float *y, *z;

y=(float *)(XPAR_OPB_BRAM_IF_CNTLR_1_BASEADDR+YBaseAddr);
 z=(float *)(XPAR_OPB_BRAM_IF_CNTLR_1_BASEADDR+ZBaseAddr);

/* data initialization					*/
 for(i=0;i<N;i++)
	{
		y[i] = i+1;
		z[i+10] = i+2;
	}

But when I do simulation, the above initialization process is very time
consuming. So I am wondering is there an easy way to do the OPBBRAM
initialization at the configuring time?
One way I think it is doable is to manually replace the configuration
of the OPB BRAM in the system_init.vhd file generated by XPS. But with
64kB BRAM, implemented as 32 ramb16_s1_s1. I need time to figure out
how the XPS store data there and fill them with my own data. And every
time when the application program changes I need to do this again.
It seems to me XPS only initialize the instruction memory with the
application program. Can it do the initialization of other BRAM when
simulation model is generated, eg, by providing some data file?

Thanks a lot

cathy schrieb:

> Hello, if my system is organized as the following > > ---------Microblaze-----lmb-----8k BRAM > | > Opb Bus > | > 64k BRAM-----opb bus-----customized circuit > > > I initialized my opb bram with the following sentence. > float *y, *z; > > y=(float *)(XPAR_OPB_BRAM_IF_CNTLR_1_BASEADDR+YBaseAddr); > z=(float *)(XPAR_OPB_BRAM_IF_CNTLR_1_BASEADDR+ZBaseAddr); > > /* data initialization */ > for(i=0;i<N;i++) > { > y[i] = i+1; > z[i+10] = i+2; > } > > But when I do simulation, the above initialization process is very time > consuming. So I am wondering is there an easy way to do the OPBBRAM > initialization at the configuring time? > One way I think it is doable is to manually replace the configuration > of the OPB BRAM in the system_init.vhd file generated by XPS. But with > 64kB BRAM, implemented as 32 ramb16_s1_s1. I need time to figure out > how the XPS store data there and fill them with my own data. And every > time when the application program changes I need to do this again. > It seems to me XPS only initialize the instruction memory with the > application program. Can it do the initialization of other BRAM when > simulation model is generated, eg, by providing some data file? > > Thanks a lot
of course you can initialize BRAMs from file I havent done that with multiply BRAM blocks being used but it is defenetly doable. one way that DEFENETLY works (if all others fail) is to create manually .BMM file with PLACED constraints and add matching LOC's for the BRAMs into the UCF but I hope XPS can handle multi BRAM inits also in more easy manner Antti
> of course you can initialize BRAMs from file > I havent done that with multiply BRAM blocks being used but it is > defenetly > doable. >
Would you tell me how to do it in more detail? How the files look like and how to use it? Or some link to the guidance? Thanks a lot
> one way that DEFENETLY works (if all others fail) > is to create manually .BMM file with PLACED constraints > and add matching LOC's for the BRAMs into the UCF > > but I hope XPS can handle multi BRAM inits also in more easy manner > > Antti
I want to do the BRAM initialzation in simulation. The XPS generated system_init.bmm file automatically like this: opbBram64k/opbBram64k/ramb16_s1_s1_0 [31:31] ; opbBram64k/opbBram64k/ramb16_s1_s1_1 [30:30] ; opbBram64k/opbBram64k/ramb16_s1_s1_2 [29:29] ; ........................... opbBram64k/opbBram64k/ramb16_s1_s1_30 [1:1] ; opbBram64k/opbBram64k/ramb16_s1_s1_31 [0:0] ; the data is store in another file called system_init.vhd. And in this case, I need to split my each bit of my 32-bit data into different BRAM, so I need 32 different files to do that. Is that correct? Then I need to write another program to generated these files. That doable, but require some time. How do I give data in the .bmm file? Thanks a lot
cathy schrieb:

> > of course you can initialize BRAMs from file > > I havent done that with multiply BRAM blocks being used but it is > > defenetly > > doable. > > > Would you tell me how to do it in more detail? How the files look like > and how to use it? Or some link to the guidance? > Thanks a lot > > one way that DEFENETLY works (if all others fail) > > is to create manually .BMM file with PLACED constraints > > and add matching LOC's for the BRAMs into the UCF > > > > but I hope XPS can handle multi BRAM inits also in more easy manner > > > > Antti > I want to do the BRAM initialzation in simulation. The XPS generated > system_init.bmm file automatically like this: > opbBram64k/opbBram64k/ramb16_s1_s1_0 [31:31] ; > opbBram64k/opbBram64k/ramb16_s1_s1_1 [30:30] ; > opbBram64k/opbBram64k/ramb16_s1_s1_2 [29:29] ; > ........................... > opbBram64k/opbBram64k/ramb16_s1_s1_30 [1:1] ; > opbBram64k/opbBram64k/ramb16_s1_s1_31 [0:0] ; > the data is store in another file called system_init.vhd. > And in this case, I need to split my each bit of my 32-bit data into > different BRAM, so I need 32 different files to do that. Is that > correct? Then I need to write another program to generated these files. > That doable, but require some time. > How do I give data in the .bmm file? > > Thanks a lot
look at data2mem options it can convert quite many different things of course the easiest is just to test in FPGA :) I am NEVER doing microblaze hdl sims. maybe I am forced todo them someday, but usually its easier to test in FPGA with XMD and ChipScope then doing sims Antti
Antti =E5=86=99=E9=81=93=EF=BC=9A

> cathy schrieb: > > > > of course you can initialize BRAMs from file > > > I havent done that with multiply BRAM blocks being used but it is > > > defenetly > > > doable. > > > > > Would you tell me how to do it in more detail? How the files look like > > and how to use it? Or some link to the guidance? > > Thanks a lot > > > one way that DEFENETLY works (if all others fail) > > > is to create manually .BMM file with PLACED constraints > > > and add matching LOC's for the BRAMs into the UCF > > > > > > but I hope XPS can handle multi BRAM inits also in more easy manner > > > > > > Antti > > I want to do the BRAM initialzation in simulation. The XPS generated > > system_init.bmm file automatically like this: > > opbBram64k/opbBram64k/ramb16_s1_s1_0 [31:31] ; > > opbBram64k/opbBram64k/ramb16_s1_s1_1 [30:30] ; > > opbBram64k/opbBram64k/ramb16_s1_s1_2 [29:29] ; > > ........................... > > opbBram64k/opbBram64k/ramb16_s1_s1_30 [1:1] ; > > opbBram64k/opbBram64k/ramb16_s1_s1_31 [0:0] ; > > the data is store in another file called system_init.vhd. > > And in this case, I need to split my each bit of my 32-bit data into > > different BRAM, so I need 32 different files to do that. Is that > > correct? Then I need to write another program to generated these files. > > That doable, but require some time. > > How do I give data in the .bmm file? > > > > Thanks a lot > > look at data2mem > options it can convert quite many different things > of course the easiest is just to test in FPGA :) > > I am NEVER doing microblaze hdl sims. > maybe I am forced todo them someday, but usually > its easier to test in FPGA with XMD and ChipScope then doing sims > > Antti
Thanks, I have to do the simulation becasue I don't have the board. :)
On 20 Sep 2006 13:20:34 -0700, "cathy" <hy34@njit.edu> wrote:

>Hello, if my system is organized as the following > > ---------Microblaze-----lmb-----8k BRAM > | > Opb Bus > | > 64k BRAM-----opb bus-----customized circuit > > >I initialized my opb bram with the following sentence. > >But when I do simulation, the above initialization process is very time >consuming. So I am wondering is there an easy way to do the OPBBRAM >initialization at the configuring time?
Here's an approach that might work, though I haven't tried locating data this way, only code. You can declare a constant array in your "C" code, preferably in a separate ".h" file, so you can write a script or program to generate it. (I have even used a spreadsheet, written the output as a .csv file, and hand edited the "C" array declaration around the comma separated values) Using "Generate Linker Scripts" in EDK you can generate a new code segment, called "myrom", and map its base address to your OPBRAM. Then you have to persuade the linker to locate that constant array in that segment - XAPP642 and Answer Record 16547 show how to locate code, but it should work for constant data. When you have built the application and generated the sim files, you can check system_init.vhd to see if the expected BRAM is there. - Brian
Thank you very much, Brain. I will try today.

Thank you very much, Brian. I have succeeded to write the data to
desired location by modifying the linker script. 
Thank,
Cathy.