Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
796 Views

DSP builder - loading and indexing a vector

Hi  

 

I'm using the DSP builder in Simulink (Matlab), where I am implemeting a split-radix FFT. I would like to load in a vector from my workspace and then adress each element in the vector as I choose. When this is done I would like to store an element in the vector again. 

 

I have different index variables.. I have put a example of the matlab-code below: 

 

r1=x+x[j]; 

x=[i]x[j]; 

 

Can anyonew help me with this? I am really stuck in this problem! 

 

-thanks
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
37 Views

You (sort of) explain what you want to achieve but don't really say what the problem is. Are you saying that you get an error when you execute the code you gave? 

 

If so then it's because your brackets are wrong. MATLAB uses "(" and ")" for array indexing. 

 

e.g. r1 = x(i) + x(j)
Altera_Forum
Honored Contributor I
37 Views

Hi - thank you for the quick answer 

My problem is that I would like to load a vector generated in Matlab and then access it via the FPGA. I have managed to load the vector into simulink and store it in RAM, but I would really like to have a more "free" access to each element of the vector. My problem is that I have 4 different variabels which I use to index the vector with.  

I have thought of a solution where I have a mux block which will choose which of the four variables index the RAM. Depending on which index variabel I use the output will have to be loaded to different adders. Therefore I will need a demux block after the RAM. 

Unfortunately this solution will require a lot of control. Therefore I would like to know if it possible to get a register which I can access independently of the other registers?  

 

 

-thanks
Altera_Forum
Honored Contributor I
37 Views

Have you tried using a counter followed by a Look-Up-Table. The LUT block can use variables from matlab workspace and the value will be preserved also for the compilation and the implementation into the hardware.

Altera_Forum
Honored Contributor I
37 Views

Thanks for the answer 

 

Yes I tried with LUTs, but the problem is that I can not write the result, I obtain after processing the loaded values, back into the LUTs. 

 

I have made an implementation where I use a combination of multiplexers, demultiplexers and Single Port RAM. It is complicated but it works!
Altera_Forum
Honored Contributor I
37 Views

 

--- Quote Start ---  

Thanks for the answer 

 

Yes I tried with LUTs, but the problem is that I can not write the result, I obtain after processing the loaded values, back into the LUTs. 

 

I have made an implementation where I use a combination of multiplexers, demultiplexers and Single Port RAM. It is complicated but it works! 

--- Quote End ---  

 

 

Hello i am having the same issue. I am using the FFT block and generate the controller and everything, the problem is that I would like to stroe the data on the DE2board. I satrted using the RAM block from the storage library with its controller I designed and works. However, I ahve problems when compiling the model. I have a fit error I think it is because my the data I am using has more memory than the M4K memory chip.  

So I was thinking to stored the info in a SDRAM but do you konw guys how can I do this form DSP builder?? or how can I do it in SOPC nad thne import it into my Simulink model using HDL import block? 

 

Please any help is useful 

 

thanks!! 

 

ismagine
Reply