Re: read hex data from a file
On 29 Mar, 11:34, "vinoth" <jesuraj.vin...@gmail.com> wrote:
> Hi..
>
> how do i read hex data from a file..say for example the file
> contains the following data...
> e46e16c5891b3c295ed5f6c1db0087c3320
> I want to read 32 bits at a time...
> can anyone give me a suggestion..
Is the file you are reading binary, or is it a text file contain the
hex values?
Does the format of the data in the file have to be exactly as you have
defined, or can it be broken up with whitespace (for example)?
e46e16c5
891b3c29
5ed5f6c1
etc
If it's a text file and you can control the format, then look up
$fscanf (Verilog 2001 only - much the same as the C function of the
same name) or $readmemh.
If it's a binary file then you have to use $fread (Verilog 2001 only).
|