Two dimensional matrices can be handled in VHDL if we directly enter the elements of the matrix in the VHDL module. But if the matrix is very large typing all the elements could be time consuming and so the matrix can be given as input through text files. How to manipulate such two dimensional matrices through text files in VHDL.
Where is the data coming from (that you would otherwise have to type in?)
Can you generate it programmatically?
Or if it's image data, you could use my PGM reading functions:
Beware, think of where it is going to be stored in the FPGA - you can not usually store the whole thing at once without external memory - so you will need to stream it through your processing.
Thanks for the help @martinthompson.For the time being if I ignore the hardware implementation n focus on simulation of the LSB based image steganography algorithm. How do I start developing the code for the algorithm in VHDL. I have very little knowledge of VHDL.
Sounds like you need to learn VHDL first... (think about the response you would get if you went to a software-based message board and said "How do I start developing the algorithm in C. I have very little knowledge of C" - the answer would be similar - learn some C first)
A suggested first project:
Try making a simulation of a counter.
Then synthesise it - use that counter to turn an LED on and off at a slow enough rate to see by eye. This is the FPGA equivalent of "Hello World".
* Create a memory block - ideally infer it, use your vendor's synthesis guidelines for sample code
* Get a small image into the memory - read it from disk and manipulate the memory block pins to write it in
* Write more code to read the memory block out and write it to disk. Check that you get the same image that you put in
* Now write the code to manipulate the LSB of the image and place it in between the memory read process and the writing to disk process.
is this a testbench or synthesizeable code?
This is not a test bench.
What fpga are you targeting? If it is spartan 6, seven series or later i would use the free HLS in C and use the matrix manipulation libraries.
You can then use c to open and read in the text files the core to manipulate your matrix as you desire and then save it back to a file for analysis
I am going to use Spartan 6.
I need to manipulate matrices of image pixels to implement LSB based steganography algorithm in VHDL.
In such a situation, I usually use something like perl script to generate the vhdl text with the matrix content. (Perl can be built in the simulator). But in modelling, it would be better to load the file with the data into the vhdl model. I use the loader of .bmp files because it is rather simple to describe it in vhdl. The computation results I output to the .bmp file as well and see, analyse it by the usual image tool.
I'm intrigued, why do you need to use an FPGA for that? That seems like a software task...