Author Topic: VCD to CSV Conversion  (Read 2489 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
VCD to CSV Conversion
« on: July 26, 2021, 01:34:20 pm »
Hi,
I have written some test benches that would read csv files and apply signals to DUT, Now I have a VCD file, I want to know is there a tool or utility to convert it to a csv file?

My sample file is attached for reference.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: VCD to CSV Conversion
« Reply #1 on: July 26, 2021, 03:05:10 pm »
It's a simple ASCII file.  You can write your own VCD file reader directly in your verilog testbench.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: VCD to CSV Conversion
« Reply #2 on: July 27, 2021, 08:23:03 am »
It's way more complicated than a csv file, I have written something like this for my csv file


Code: [Select]

reg r_i_clk  [0:65536];
reg r_G_MISO [0:65536];
reg r_G_SCK  [0:65536];
reg r_G_MOSI [0:65536];
reg r_G_SS   [0:65536];

integer file;
string line;
integer lineNumber = 0,timeunitCsv,rePlayLineNumber = 0;
//file operation
initial
    begin
////////////// Read the input file and fill the input array
file=$fopen("STM32SlaveSPI/SPIwrite25_core0_window0.csv","r");
if(file)
$display("File opened succesfuly %d",file);
else
$display("Can not open the file %d",file);

//if we have valid file read it for me!
if(file) begin
//Read the top 3 lines of the file, becuase they are string info and we do not need them
$fgets(line,file);
$display("%s",line);

$fgets(line,file);
$display("%s",line);

$fgets(line,file);
$display("%s",line);

//now read the content of the whole file
while(!$feof(file)) begin
$fgets(line,file);
$sscanf(line,"%d, %b, %b, %b, %b, %b",timeunitCsv,r_i_clk[lineNumber],r_G_MISO[lineNumber],r_G_SCK[lineNumber],r_G_MOSI[lineNumber],r_G_SS[lineNumber]);

/*$display("linenumber %d",lineNumber);
$display("time unit: %d us",timeunitCsv);
$display("ick %b",r_i_clk[lineNumber]);
$display("miso %d",r_G_MISO[lineNumber]);
$display("sck %d",r_G_SCK[lineNumber]);
$display("mosi %d",r_G_MOSI[lineNumber]);
$display("ss %d",r_G_SS[lineNumber]);*/

lineNumber++;
end

$fclose(file);
end


end

ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf