【发布时间】:2019-02-19 21:53:22
【问题描述】:
举个例子
如果我的数据集是这样的。 LOG 1 (x.log) 包含
INFO @1102266 PHResourceLayer_Z4: mti_clk_chk:################ start of test ################ ; T=1102266
INFO @1102334 PHResourceLayer_Z4: mti_clk_chk:Checking the period of MTI, MTI10 clk from SV; T=1102334
LOG 2 (y.log) 包含
UVM_INFO @1092507 reporter Z4_COREA: mti_clk_chk: ################ start of test ################ ; T=1092507
UVM_INFO @1092563 reporter Z4_COREA: mti_clk_chk: Checking the period of MTI, MTI10 clk from SV; T=1092563
那么对于第一行我必须检查
################ start of test ################ ; T=1102266
和
################ start of test ################ ; T=1092507
因为 T 的值不一样,所以它应该在输出文件中给出这些细节,说明细节不匹配。
同样地,对于第 2 行,我们必须匹配
Checking the period of MTI, MTI10 clk from SV; T=1102334
和
Checking the period of MTI, MTI10 clk from SV; T=1092563
这里 T 的值也不匹配,所以将它传递给输出文件。
我必须逐行比较具有特定关键字mti_clk_chk 的两个日志文件中的详细信息。到现在为止,我可以将两个文件中的 required 关键字逐行解析为第三个文件。现在我想比较冒号之后的关键字(:)和输出文件中存在的数据,我必须打印第一个数据集中的不匹配行,以便将其与第二个数据集和第二个数据集中的行数进行比较第一个数据集中不存在的。下面给出解析两个日志文件后的数据。请帮助我如何比较两组数据之间每行提供的详细信息。
open(FILE, "<x.log");
my @array = <FILE>;
close(FILE);
open(FILE, "<y.log");
my @array1 = <FILE>;
close(FILE);
open(FILE, ">>file.txt");
my @array2 = <FILE>;
foreach $_ (@array & @array1) {
@array2 = grep {$_ =~ "mti_clk_chk:"} (@array);
print FILE "@array2";
print FILE "\n \n \n";
@array2 = grep {$_ =~ "mti_clk_chk:"} (@array1);
print FILE "@array2";
close(FILE);
exit;
}
解析两个输入日志(x.log和y.log)后file.txt中的样本数据
INFO @576892 mti_clk_chk: run_stimulus called; T=576892
INFO @1102266 PHResourceLayer_Z4: mti_clk_chk:################ start of test ################ ; T=1102266
INFO @1102334 PHResourceLayer_Z4: mti_clk_chk:Checking the period of MTI, MTI10 clk from SV; T=1102334
INFO @1102372 mti_clk_chk: Checking period of MTI CLk; T=1102372
INFO @1102377 mti_clk_chk: Period value of MTI Clock: 3.125000 ns; T=1102377
INFO @1102377 mti_clk_chk: MTI Clock is being generated correctly ; T=1102377
INFO @1102377 mti_clk_chk: Checking period of MTI10 CLk; T=1102377
INFO @1102418 mti_clk_chk: Period value of MTI10 Clock: 31.250000 ns; T=1102418
INFO @1102418 mti_clk_chk: MTI10 Clock is being generated correctly ; T=1102418
INFO @1102717 PHResourceLayer_Z4: mti_clk_chk: All clock period Checking done; T=1102717
INFO @1148661 mti_clk_chk: C-Code exit execution. code=<aa>; T=1148661
INFO @1148661 mti_clk_chk: ************************ SV END******************** ; T=1148661
UVM_INFO @0 reporter testbench.top_level_module.\mti_clk_chk::main : MTI_CLK_CHK_STIM Started .....; T=0
UVM_INFO @0 reporter testbench.top_level_module.\mti_clk_chk::main : run_stimulus called; T=0
UVM_INFO @1092507 reporter Z4_COREA: mti_clk_chk: ################ start of test ################ ; T=1092507
UVM_INFO @1092563 reporter Z4_COREA: mti_clk_chk: Checking the period of MTI, MTI10 clk from SV; T=1092563
UVM_INFO @1092598 reporter testbench.top_level_module.\mti_clk_chk::main : Checking period of MTI CLk; T=1092598
UVM_INFO @1092605 /proj/rru2_verif/usr/Tilak/SV_UVM/testbench/data_ipdss/v_ms_mti_stim_vip/testbench/classes_v/mti_clk_chk.sv(147) uvm_test_top.default_env.default_sequencer100@@mti_clk_chk mti_clk_chk:INFO: Period value of MTI Clock: 3.125000 ns; T=1092605
UVM_INFO @1092605 reporter testbench.top_level_module.\mti_clk_chk::main : MTI Clock is being generated correctly ; T=1092605
UVM_INFO @1092605 reporter testbench.top_level_module.\mti_clk_chk::main : Checking period of MTI10 CLk; T=1092605
UVM_INFO @1092655 /proj/rru2_verif/usr/Tilak/SV_UVM/testbench/data_ipdss/v_ms_mti_stim_vip/testbench/classes_v/mti_clk_chk.sv(165) uvm_test_top.default_env.default_sequencer100@@mti_clk_chk mti_clk_chk:INFO: Period value of MTI10 Clock: 31.250000 ns; T=1092655
UVM_INFO @1092655 reporter testbench.top_level_module.\mti_clk_chk::main : MTI10 Clock is being generated correctly ; T=1092655
UVM_INFO @1092850 reporter Z4_COREA: mti_clk_chk: All clock period Checking done; T=1092850
UVM_INFO @1092886 /proj/rru2_verif/usr/Tilak/SV_UVM/testbench/data_ipdss/v_ms_mti_stim_vip/testbench/classes_v/mti_clk_chk.sv(186) uvm_test_top.default_env.default_sequencer100@@mti_clk_chk mti_clk_chk:INFO: ************************ SV END******************** ; T=1092886
【问题讨论】:
-
我编辑了您的问题以使输入和输出更具可读性。请检查我是否无意中删除了一些相关信息。
标签: perl