Hi,
I am trying to generate 1 million random numbers. I was earlier trying to do it using looping within the descriptor but my subtraction was not taking place and I couldn't figure out the error (the thread related to it is :Math Operation(Subtraction CAAM) ). So I have now implemented the same without using the loops as follows:
I have taken one descriptor to produce N random numbers (total size of descriptor N+3) and then it jumps to another similar (actually same) descriptor. I have created an array of similar descriptors (size= S). Finally when the total number of random numbers is close to 1 million (N*S=1000000) then I make it jump to another similar descriptor which is the last descriptor of the code and doesn't jump further. I have a couple of doubts.
1. It seems I cannot produce random numbers more than something around 1900. Irrespective of the value of N and S, it starts giving me errors when (N*S) reaches somewhere around 1900. Why is that happening?
In order to generate 1 million random numbers, after every 1500 random number generation, I brought the control back to software and then again assigned the descriptor which jumped through some N descriptors before again coming back to the software. This is continued till 1 million random numbers are produced. This seems to be working fine and also giving significant time improvement as compared to random number generation using software. But I wanted to produce all 1 million random numbers without coming back to software. Why is that creating a problem when (N*S) exceed 1900?
2. When I try to store the Random numbers using FIFO store by the following descriptor command:
#define RNG_DESC54 0x60300010
#define RNG_DESC55 0x00000000 // assign the memory address to this in the main program where you call it
It stores the value once but when I try to use it again and again to store all random numbers , the code seems to stall infinitely when it is used the second time. Why is such error arising? (because of this I am able to store only 4 random numbers which are present in the Output FIFO at the end of the program.)
I am attaching the descriptor file that I have written (rng_desc.h). I am also attaching the C code that is finally making the descriptors and handing it over to CAAM.
I hope I have made my doubts clear.
Thanks.
Original Attachment has been moved to: rng_desc.c.zip
Original Attachment has been moved to: rng_desc.h.zip
Any suggestions would be helpful. :smileyhappy:
It is needed to wait for job ring to complete the job, before next job starts.
Have a great day,
Yuri
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I am waiting for the job ring to complete its job in rng_desc.c. as follows:
/* Wait for job ring to complete the job: completed job expected */
while(reg32_read(CAAM_ORSFR0) != 1);
}
Isn't it sufficient for waiting or I have to write some command in the descriptor for the same?
Thanks,
Apoorva