Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem encountered when using verilog to simulate a coms image sensor

Status
Not open for further replies.

aspirinnnnn

Member level 1
Joined
Jan 4, 2012
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Beijing,China
Activity points
1,511
i want to use verilog to simulate a CMOS image sensor in testbench ,i use readmemb to load a image into a 2d reg array (ex: [7:0] Image_array [4095:0] ),but "this particular" image sensor only have one frame of image. is there any way i could use verilog to update the Image_array,so that the image in the sensor can update?
 

You can replace the 2D reg array anytime you desired ,in your test bench whit readmemb/readmemh.
It means you can read contents of a file and save them into the 2D reg array in any sequences you need.
I hope it could you and feel free to discuss problems I will try to answer as much as I know.

BR
Oveis
 
You can replace the 2D reg array anytime you desired ,in your test bench whit readmemb/readmemh.
It means you can read contents of a file and save them into the 2D reg array in any sequences you need.
I hope it could you and feel free to discuss problems I will try to answer as much as I know.

BR
Oveis

one more question ,if i have 100 sequential pictures(converted in the right format that can use by readmemb to load to the 2D array) in one directory ,and i want to replace the 2D reg with the next file content(next picture) when a signal is given.but how i pass the file names to the readmemb system function,i have 100 different file names .what i
am thinking is :
name the 100 files as 1.txt 、2.txt 、3.txt......100.txt, and use a for statement to loop as readmemb({"i","txt"},2D_array) ,but the "i" here is an integer,i doubt this would work
 

Dear Asprin,
You could not achieve your desired goal through the above approach.
I prefer do the job with merging all the file through one file and read each section of file (i.e. each successive 4096 byte) and reload to the 2D array with such syntax:

$readmemb ("file", memory_identifier [,begin_address[,end_address]]) ;
$readmemh ("file", memory_identifier [,begin_address[,end_address]]) ;


If you set proper begin_address and end_address, you can load different image throughout the file.
Please don't forget that if you use readmemb, Thefile must have only binary content and if you use readmemh, the file must have hexadecimal content such below:
Binary file content :
Code:
0000110101110100
0000000000000000
0000011101110100
1111101001110100
1111011110000111
0000010101011011
0000011011111000
...
Hexadecimal File Content
Code:
FFEA
14CD
23AB
CD10
...

Best Regards.
You prosperity is my happiness.
Oveis
 
Dear Oveis.Gharan:

Thanks very much for your very detailed answer.what you say above is a very good solution to my problem.
I actually have many sets of pictures,every set contains more than 100 sequential pictures,i need to test every set . if i do it in your method i can write a matlab or perl script to combine all those pictures in one set into a single binary file(as you demonstrate me above) and meanwhile modify my testbench a little bit(change begin,end address automatically).

I used to want to use DPI or VPI to communicate with verilog ,use C to detect how many BMP file in the current directory,use c to transfer them into binary format and then change the 2D array value with VPI. but now i find you way is more direct and more focus on the hardware design or the software. so THANKS VERY MUCH:wink:
 

Dear Asprin
I am so eager to know what is your project which you want to process the pictures with such test-bench.

Feel free to mention your problems. I would be so glad to help you buddy.


Best Regards.
Oveis
 
Last edited:

Sorry for the late Reply, the testbench is to verify a vision processor that targeted at high speed image processing , feel free to contact me ,my email is yangstone2006@gmail.com


Dear Asprin
I am so eager to know what is your project which you want to process the pictures with such test-bench.

Feel free to mention your problems. I would be so glad to help you buddy.


Best Regards.
Oveis
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top