cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ma76571
Participant
Participant
7,910 Views
Registered: ‎11-26-2009

How to store data in the rom?

Jump to solution

I wanna store data in a rom. The document says people can set "initial value vector" of the rom like "load('filename.txt')". However, the document doesn't say how to create the filename.txt and where filename.txt should be stored. Can anybody tell me how to solve the two problems?

0 Kudos
1 Solution

Accepted Solutions
ma76571
Participant
Participant
9,024 Views
Registered: ‎11-26-2009

Thanks for your reply. I solved my question myself.

 

My solution:

 

I used 'simout' block in simulink  to generate data to workspace first. Then, I saved the data in a noepad which was a filename.txt file. This file should be saved in 'work' file of matlab. When I set the initial value vector as 'load('filename.txt')', the data was stored in the rom. Waveform in wavescope proved my design was right.

 

 

 

View solution in original post

0 Kudos
5 Replies
7,895 Views
Registered: ‎01-05-2010

Hi ma76571 :-)

 

Try out this method

-> write an m-file to generate the vector

->run the m-code once

->type the name of the variable on the workspace of matlab

->in the initial value vector space in the block properties type the name of the variable

-> now run the sysgen module and it should be fine

 

For eg :

I am wanting to store a vector 'vec' in the ROM whose values are = i^2 where 'i' is the index

 

So I write an m-code

 

/---------------------------------------------------------/

 

clc;

vec = zeros(1,256)

for i=1:256

   vec(i) = i*i ;

end

 

/---------------------------------------------------------/

 

run the above m-code once

 

then go to workspace and type 'vec'

 

then go to the block properties of the ROM and in the initial value vector column type 'vec'.

 

That should do the job.

 

Thank  you and regards,

Anand

 

0 Kudos
7,890 Views
Registered: ‎08-28-2010

now i want to store a random matrix in a rom, so can i copy the matrix into m-code ?

and i have a another question, i'll acquisiton image by a webcam and put into DRAM of FPGA kit, how can i read image and put into system generator and processing? thanks a lot

0 Kudos
7,866 Views
Registered: ‎01-05-2010

Hi,

 

Sure you can copy the matrix into the m-code but you if you have the matrix ready you can put it on the workspace.

 

If you are looking to feed the image from webcam to your sysgen module for simulation then you can try the 'From video device' block in the image and video processing blocksets under 'source'

0 Kudos
ma76571
Participant
Participant
9,025 Views
Registered: ‎11-26-2009

Thanks for your reply. I solved my question myself.

 

My solution:

 

I used 'simout' block in simulink  to generate data to workspace first. Then, I saved the data in a noepad which was a filename.txt file. This file should be saved in 'work' file of matlab. When I set the initial value vector as 'load('filename.txt')', the data was stored in the rom. Waveform in wavescope proved my design was right.

 

 

 

View solution in original post

0 Kudos
G7
Visitor
Visitor
562 Views
Registered: ‎09-24-2020

Sir

How to store data to the notepad. Which is the 'work' file of matlab. Could you help me out

Thankyou in advance

0 Kudos