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.

is there any function like fopen in vhdl or verilog

Status
Not open for further replies.

Robin Khosla

Member level 4
Member level 4
Joined
Aug 2, 2012
Messages
76
Helped
7
Reputation
14
Reaction score
6
Trophy points
1,298
Visit site
Activity points
1,861
hii,

i want to create a bmp image using vhdl and then store it in pc so that i can watch the image

i know there is textio library in vhdl but it creates .txt files. How can i create bmp file?

is there any function like fopen in vhdl or verilog?
 

Writing data in and out of VHDL is technically possible, but how it works will depend on what similator you are using.
Luckily, modelsim/questa allows you access each byte of a file via chars. You need to declare a file of type character:

type char_file_t is file of character;

and then you can read and write to using the in built read/write functions for all types:

Code:
variable c_buf : character;
file my_file : char_file_t;

....
FILE_OPEN("somefile.bmp");

read(my_file, c_buf);

--do something with the char, like convert it to an integer with character'pos(c_buf)

Remember that BITMAPs have a specified header format, so you will have to read about all the fields in the header, which you will have to read and decode in your VHDL code.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top