Quantcast
Channel: Cadence Custom IC Design Forum
Viewing all articles
Browse latest Browse all 4930

verilog-a syntax to read a 64-bit binary value from a file

$
0
0

I have a text file with this format:

1511874.802,0000000000000000000000000000000000000000000000000000000000000000
1512541.468,0000000000000001000000100000001100000100000001010000011000000111
1513208.134,0000100000001001000010100000101100001100000011010000111000001111

I want to read the 64-bit binary value, and then use a genvar to set an output vector, like this:

 for(i=0;i<64;i=i+1)
V(txdata[i]) <+ transition( binVal & (1<<i)?voh:vol, 0, 10n, 10n );

Using this to read the file:

$fscanf( file, "%f,%b", timeVal, binVal );

Here is where I am stuck.  What data type do I use for binVal?  I cannot read the binary value into an integer, since that is only 32 bits.  Reading it as a string or real will work, but it is not obvious how I convert a real/string back to an integer. 

Using a real returns a very small number, like 1e-316, since the MSB is a 0.

Is it possible to read it as a string, then do a character comparison?

Any ideas?


Viewing all articles
Browse latest Browse all 4930

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>