carlos-jenkins/csv2vcd

question

Opened this issue · 10 comments

Hi,

is the time (for row2 and row3 of input.csv) defined as time between those two samples, the absolute time? why is there a negative time?

0,1,0,0,-52.430000 us
0,1,0,0,-52.428333 us

when i open the coverted vcd file with GTKWave and move the cursor to the left, i can see:

CLK=1
CS=0
DIN=0
DOUT=0

but the csv file shows the first sample with, why are csv and vcd different? CLK=0 and CS=1...

"CLK","CS","DOUT","DIN","Time"
0,1,0,0,-52.430000 us

Thanks,
A

Hi,

why does the signal CLK of input.csv not use quotation marks like the other signals do it?

No idea why, this is the raw output generated by our signal analyzer equipment.

is the time (for row2 and row3 of input.csv) defined as time between those two samples, the absolute time? why is there a negative time?

It starts at negative values I suppose because some synchronization reason of our signal analyzer. If you see line #119:

https://github.com/carlos-jenkins/csv2vcd/blob/master/bin/csv2vcd#L119

Actually the CSV file is interpreted starting at time 0 ("breakpoint"). All previous lines are ignored. This is the expected behavior according to our documentation.

Now, the time between rows is an absolute time. The main difference between the CSV output generated by the IXIA and the VCD is that the CSV has the state of all signals at absolute time steps (samples). The VCD has the timestamp of signal changes and which signal changed, making it a lot more lightweight (in our example, CSV == 24MB, VCD = 150KB).

thanks for your reply.
great, did you test your tool with some traces?
do you know any other tools to visualize vcd besides GTKWave?
do you know a tool which converts vcd into a csv?

great, did you test your tool with some traces?

Sure, we developed this to debug some issues with some signals we were having, and this and GtkWave helped us to find the reason behind them.

do you know any other tools to visualize vcd besides GTKWave?

https://en.wikipedia.org/wiki/Waveform_viewer#List_of_the_best-known_viewers

do you know a tool which converts vcd into a csv?

No, but it can be easily programmed, is not that difficult. If you see, csv2vcd is quite small and straightforward.

ok.

how can you convert a csv file with analog signals (float instead int) to vcd?
i get this error:

Breakpoint at line #1.
Traceback (most recent call last):
  File "csv2vcd", line 207, in <module>
    main()
  File "csv2vcd", line 201, in main
    if not convert(module, infile, outfile):
  File "csv2vcd", line 133, in convert
    tinit, pinit = get_parts(l)
  File "csv2vcd", line 94, in get_parts
    cparts = [int(p) for p in parts]
ValueError: invalid literal for int() with base 10: '0.000000'

i think line 94 should be replaced with, in case of a float?

cparts = [float(p) for p in parts]

It really depends on the format of your CSV. If you read the comments on the get_parts() function it will tell you exactly what it is supposed to do.

https://github.com/carlos-jenkins/csv2vcd/blob/master/bin/csv2vcd#L71

my csv looks like that:

0.0,1.5,0.6,2.3,-52.415000 us

can you support that?

Floating point variables? So I suppose we're not in digital world anymore, and I assume your signal analyzer is reading some analog values. I'm not sure if VCD format allows other than 0/1, but according to Wikipedia:

The value change section contains a series of time-ordered value changes for the signals in a given simulation model. For scalar (single bit) signal the format is signal value denoted by 0 or 1 followed immediately by the signal identifier with no space between the value and the signal identifier. For vector (multi-bit) signals the format is signal value denoted by letter 'b' or 'B' followed by the value in binary format followed by space and then the signal identifier. Value for real variables is denoted by letter 'r' or 'R' followed by the data using %.16g printf() format followed by space and then the variable identifier.

So, maybe, if you read the variables as float and then output them as "r followed by the data using 16g printf() format followed by space and then the variable identifier" it could work.

I can try to sketch something if you provide me a relevant CSV file to test.

Regards.

Hi, I just created a new branch called real_variables that support real/float (analog?) signals in a CSV files:

https://github.com/carlos-jenkins/csv2vcd/compare/real_variables#diff-3d244f291ec130623f7f444cff889484

The changes were trivial. It seems to be working with the following example CSV file:

"CLK","CS","DOUT","DIN","Time"
0.0,0.0,0.0,0.0,-10.000 ns
0.0,0.0,0.0,0.0,-8.333 ns
0.0,0.0,0.0,0.0,-6.667 ns
0.0,0.0,0.0,0.0,-5.000 ns
0.0,0.0,0.0,0.0,-3.333 ns
0.0,0.0,0.0,0.0,-1.667 ns
1.0,0.0,0.0,0.0,0 s
2.0,0.0,0.0,0.0,1.667 ns
3.0,1.2,0.0,0.0,3.333 ns
3.5,3.4,0.0,0.0,5.000 ns
4.1,2.2,0.0,0.0,6.667 ns
2.3,2.1,0.0,0.0,8.333 ns

To view the resulting VCD file in GtkWave I had to add the signal (with the Append button) then select the signal, right click, Data Format -> Analog -> Step.

Regards

by floats i mean analog signals.
great, let me test if that works.

Hello Mr. Carlos Jenkins,

I tried to convert real data csv file to vcd with your scripts, but unfortunately, it's not successful. I could see the generated vcd files contains some random variable names (not the same in CSV file). I am also attaching the csv file for your reference. Could you please help me resolve the issue (I am attaching the respective *xls file here)?

Book1.xlsx

Thanks in advance!
Regards,
Mohan