Hi All,
My_file.csv
Addr,cmdtype,burst_type,transaction_gap
5cab45,write,Wrap,random
11bbc,read,Incr,random
I want to read above .CSV file in systemverilog or uvm but problem is that When I am reading string through $fscanf function then I am getting whole string in one veritable .my sv code is as below,
module ready_csv();
initial begin
int addr;
string Trans_mode,cmd_type, transaction_gap,S1;
int fd;
fd= $fopen("My_file.csv","r");
$fscanf(fd,"%0s",S1);
$fscanf(fd,"%0h,%0s,%0s,%0s",addr,Trans_mode,cmd_type, transaction_gap);
$display("addr=%0h, Trans_mode=%0s,cmd_type=%0s, transaction_gap=%0s",addr,Trans_mode,cmd_type, transaction_gap);
end
endmodule
Result :
addr =5cab45, Trans_mode=write,Incr,random,cmd_type= , transaction_gap=
But I want to read as per below print,
addr =5cab45, Trans_mode=write,cmd_type=Incr , transaction_gap=random
Kindly help me .
Regards,
Prashant