- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-05-2009 02:55 PM
Hello,
I'm not sure if I'm going about this in the right way, but I'll give it a shot. I have a sequence of 100 numbers (1:100) and I want to grab the first 10, then the third ten, then the fifth ten, so that my data will be (1:10)(30:40) (60:70), etc. How can I do this? I think a RAM block might come in handy here; I write the whole sequence to the RAM block, so that the first 100 memory locations would be my whole data, then use a counter of some sort to read out memory address 1:10, then address 30:40, etc. Am I thinking about this properly? I looked at the single port RAM block and the hlep file didn't really help...perhaps a dual port RAM block is necesssary? These RAM blocks are a little overwhlemeing, any help from some xilinx gurus out there would be much appreciated. Thanks!
Alexander
Solved! Go to Solution.
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-06-2009 11:05 AM
Hello,
I think you can do this using a single-port block ram initialized with the values 1:100 and then you can simply write a state machine which access the addresses you want to get the corresponding data. The state machine can be written either using the Mcode block (The state m/c is written in Matlab) or the Sysgen Black Box (The state m/c to be written in verilog or vhdl.
Regards,
Walid F.
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-11-2009 11:30 PM
hello, i am doing something like that. I have to receive continue data and work for block. In this case i receive a block of 52 bytes and i have to eliminate the last 12 bytes. I am using 2 single port RAM but the resuts are not successful. The output data must be continuo. (Receive 52 bytes and the output have 40 bytes and next to the last byte i have the first byte of the 2nd block ).
thanks...
Re: Using RAM Blocks to manipulate data
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-14-2009 07:38 AM - edited 10-14-2009 08:13 AM
You can put a counter counting from 0 to 29 and glue it into a ROM storing pointers. The ROM is connected directly to the Memory address input.
The pointers can be [1:10 30:40 60:70]-1
Whenever I need to rearrange the format of a serial data input, for example after a FFT, I need to make something like "fftshift" from Matlab, I use this ROM-storing-pointers strategy.
You can use a dual-port RAM if the input data is coming continuosly all the time...
You can also use a FIFO. Just work the write signal. Keep 'we' high when the inputs 1:10 , 30:40 and 60:70 are coming. Then just read at the output. If you want continuous data like gotcha25, your read signal should have a lower rate then we signal.
For a 100-sample input data, you are outputting 30 samples. So the normalized sample rates '10' (for read signal) and '3' (for we signal).
Hope this helps
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-16-2009 05:49 PM
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-06-2012 04:24 AM
Hello,
I am trying to do the similar things. I use FIFO and I need to read 100 samples to this and then to calculate average value. The problem is how to calculate this average, because the function mean(x) works with arrays and I don't know how to convert my input digital signal to array.
Thank you for any help!
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-06-2012 04:36 AM
Hello, Evgenia.
It's better to start new thread.
Do you want to calculate average value using blocks of the System Generator for further netlist generation? Or to find average value using standard Matlab function (mean(x))?
Vitaly.
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-06-2012 05:03 AM
Vitaly,
I think it's better to use System Generator blocks, but the using of mean(x) is also possible because of block MCode where I can write the code.
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-06-2012 05:16 AM
Evgenia,
'MCode' block supports only restricted subset of Matlab language as you can see on page 224 of System Generator Reference Guide:
http://www.xilinx.com/support/sw_manuals/sysgen_re
But there is an 'Accumulator' block which can be used to solve your problem.
Averaging is basically accumulation:
mean(X) = (X_1 + X_2 + ... + X_N) / N,
accumulated_sum(X) = X_1 + X_2 + ... + X_N.
Accumulator expects single samples at its input (not array).
Just make sure to chose proper bitwidth of accumulator in order to prevent overflow.
Vitaly.
Re: Using RAM Blocks to manipulate data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-06-2012 06:18 AM
Thank you, Vitaly, it really can help in solving the problem.
But the thing is that I need to put into a memory any amount of points (let's say 1000), and then to calculate average of all these point. It should be one number but it seems that the block 'Accumulator' works for every point independently:
1st line - input signal;
2nd line - counter;
3d line - output of accumulator.
Or maybe I don't understand anything.











