Open mithro opened 7 years ago
'gateware/encoder/vhdl/header.hex' specifies the initial content of a memory block rambyte in the file (https://github.com/timvideos/HDMI2USB-litex-firmware/blob/master/gateware/encoder/vhdl/JFIFGen.vhd) , that is, the initial values for each address. One can see the initializing of memory block in -
https://github.com/timvideos/HDMI2USB-litex-firmware/blob/master/gateware/encoder/vhdl/JFIFGen.vhd
Where "initial $readmemh("header.hex", mem) " initializes the memory. Now this memory is assigned to q and ram_bytes in the JFIFGen.vhd(https://github.com/timvideos/HDMI2USB-litex-firmware/blob/master/gateware/encoder/vhdl/JFIFGen.vhd) is assigned to q.
So basically header.hex is basically initializing the the memory.
Process for creating hex file is as follows:
We compile Verilog to RTL netlists, then synthesize Verilog to EDIF, then place and route EDIF to produce HEX files that can be loaded into an FPGA.
So this hex file might be created in the same way.
GitHubHDMI2USB-litex-firmware - A version of the HDMI2USB firmware based around LiteX tools produced by @Enjoy-Digital (based on misoc+migen created by @M-Labs)
GitHubHDMI2USB-litex-firmware - A version of the HDMI2USB firmware based around LiteX tools produced by @Enjoy-Digital (based on misoc+migen created by @M-Labs)
@akhil-123 Yes, we understand what readmemh()
does in Verilog. What we don't understand is the contents of this file. See the title of this bug.
I think this is probably something like a JPEG header or something?
This header.hex file is a JPEG/JFIF file (minimal file format which enables JPEG bitstreams to be exchanged between a wide variety of platforms and applications) in which the contents are as follows:
But In the header.hex file i could not find the EOI (end of image) marker which is FF D9. I think it should be present in the file.
@akhil-123 Would you be interested in writing up a small Python program which uses the either struct
module or struct support in the ctypes
module (probably combined with the hexfile module) to read/write this data?
Yeah, I will try my best to finish it as soon as possible.
@akhil-123 No hurry!
FYI You should come and join us in our IRC chat room [irc://irc.freenode.net/#timvideos] if you haven't already! A web based client is available here.
can u increase the description on what these read and write operations should do ?
What is this file? How was it made? etc....