UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer jacko0088
Observer
1,621 Views
Registered: ‎06-27-2018

Am I going out of memory? ZYNQ7010 (ZTurn Board)

Hello all!
Now that all works as expected, I wish to share which should be my last problem here:
I'm using memcpy inside a for loop, which should run until an high N number is reached.

Launching it this way it just freeze when i = 1536 is reached

My question is: knowing I should have 1024MB of RAM, and DDR option is enabled into my a basic Zynq PS Design. Am I going out of memory? Is this trying to copy data into OCM or enabling DDR gives the possibility to run on external RAM by default? 

int N = 1048576;
for (i = 0; i < N; i++) {
		memcpy(&V[i * 32], X, 128);
		xor_salsa8(&X[0], &X[16]);
		xor_salsa8(&X[16], &X[0]);
	}

Thank you all!
jacko0088

0 Kudos
12 Replies
Scholar u4223374
Scholar
1,539 Views
Registered: ‎04-26-2015

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

What is the definition (type/size) of "V", and what is its address in memory?

0 Kudos
Observer jacko0088
Observer
1,533 Views
Registered: ‎06-27-2018

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

It gets launched in this way

core(uint32_t *X, uint32_t *V, int N)

This is X

uint8_t X[32*4] = {
		0x2c, 0xea, 0xa9, 0x0e, 0x59, 0x44, 0x8a, 0x45, 0x31, 0x89, 0x2e, 0xac, 0xf5, 0xb8, 0x7b, 0x22,
		0x63, 0xfe, 0xb1, 0xf2, 0x78, 0xca, 0xf4, 0x65, 0x0a, 0xe8, 0x3e, 0xc1, 0xb9, 0xa8, 0xd6, 0x9d,
		0x62, 0x09, 0xa7, 0x37, 0x6e, 0x55, 0x24, 0xce, 0xaf, 0x81, 0x90, 0x16, 0x4c, 0x6c, 0xa0, 0x73,
		0xbe, 0xfb, 0xef, 0x7f, 0x14, 0x86, 0x18, 0x90, 0x52, 0x41, 0x9f, 0x49, 0xcf, 0x00, 0x4f, 0x17,
		0xa9, 0x89, 0x2f, 0x5a, 0x71, 0xd1, 0x98, 0x9f, 0x82, 0x07, 0xf5, 0x2f, 0xb1, 0x51, 0xc5, 0xc8,
		0xa2, 0xfb, 0x4a, 0xcf, 0xf0, 0x45, 0x97, 0x08, 0x1f, 0x3b, 0x55, 0x37, 0xec, 0x0e, 0xa6, 0xbc,
		0x25, 0xd2, 0x3e, 0x19, 0xa1, 0x2d, 0x4c, 0x0d, 0x74, 0x06, 0x67, 0x4a, 0x5c, 0x64, 0x20, 0x44,
		0x7e, 0xad, 0x2e, 0x43, 0x96, 0x84, 0x0b, 0xa7, 0x34, 0x23, 0x99, 0x1d, 0xde, 0x14, 0x2b, 0x84,
	};

 

 

This is what I'm passing as parameter for uint32_t *V

(void *)scratchpad

Which is just something like this:

unsigned char *scratchpad;
scratchpad = malloc(size + 63);

 

 

 

0 Kudos
Moderator
Moderator
1,261 Views
Registered: ‎10-06-2016

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Hi @jacko0088

 

Did you made any progress on this? I'm just curious to see if you found the root cause or still struggling with this :)

 

Regards

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Observer jacko0088
Observer
1,257 Views
Registered: ‎06-27-2018

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Went on vacation 4 days after this post was maded, now I'm back home but..nope. Still stuck. (and feeling a bit stupid too because maybe it's a simple thing) :(

0 Kudos
Moderator
Moderator
1,255 Views
Registered: ‎10-06-2016

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Hi @jacko0088,

Ok let me try to test it on my end and I will try to give you some feedback.

Hope you had great holidays :)

Regards
Ibai

Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Observer jacko0088
Observer
1,249 Views
Registered: ‎06-27-2018

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Thank you! I'm trying it over PS, then I wish to port it on PL… :)

0 Kudos
Moderator
Moderator
1,244 Views
Registered: ‎10-06-2016

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Hi @jacko0088,

 

Taking a look to you code still is not clear the amount of memory you are allocating for V.

unsigned char *scratchpad;
scratchpad = malloc(size + 63);

In the loop you are trying to access up to 33554336 elements in the array so that means you should be allocating (N*32*4) bytes.

 

Regards

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Observer jacko0088
Observer
1,093 Views
Registered: ‎06-27-2018

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Hi Ibaie!
size should be equals to

 

N * 32 * sizeof(uint32_t)

 

:)

0 Kudos
Moderator
Moderator
931 Views
Registered: ‎10-06-2016

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

Hi @jako0088,

So is (size + 63) equal to that amount of bytes? does it work if you use that value?

Regards
Ibai

Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Observer jacko0088
Observer
622 Views
Registered: ‎06-27-2018

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

It does not :(

0 Kudos
Scholar ericv
Scholar
605 Views
Registered: ‎04-13-2015

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

@jacko0088

 

did you check if the returned value of malloc() is not NULL.?

Your heap may not be large enough.

 

 

0 Kudos
Observer jacko0088
Observer
593 Views
Registered: ‎06-27-2018

Re: Am I going out of memory? ZYNQ7010 (ZTurn Board)

I've not, I'll check tonight!

0 Kudos