VCDファイルを階層ごとに修正する

SystemCで信号波形をダンプする際には、VCD形式で出力することが多いと思います。
SystemCのダンプ形式だと、「階層.信号」といった感じでフラットに出力されてしまうのでどうしても波形ビューワーで見ると、見づらいかと思います。

そこで、こんなものがあります。

Manipulate the Hierarchy of VCDs generated by ASI (OSCI) PoC SystemC Simulator

ダウンロード&ビルド

$> git clone git://github.com/yTakatsukasa/vcd_hierarchy_manipulator.git
$> cd vcd_hierarchy_manipulator/
$> make

これで、「vcd_hier_manip.x」が生成されると思います。

実際に使ってみる。

予め用意していた「systemc.vcd」を試してみました。

$> vcd_hier_manip.x systemc.vcd --output output.vcd

オリジナルとの差分がこちらになります。

--- systemc.vcd 2013-03-15 09:42:38.523658600 +0900
+++ output.vcd  2013-05-01 13:40:59.340473416 +0900
@@ -10,35 +10,40 @@
      1 ps
 $end

-$scope module SystemC $end
-$var wire    1  aaa  utop.w_clk       $end
-$var wire    1  aab  utop.w_xrst       $end
-$var wire    4  aac  utop.w_addr [3:0]  $end
-$var wire   32  aad  utop.w_wdata [31:0]  $end
-$var wire    1  aae  utop.w_ce       $end
-$var wire    1  aaf  utop.w_we       $end
-$var wire   32  aag  utop.w_rdata [31:0]  $end
-$var wire    1  aah  utop.uTB.we       $end
-$var wire    1  aai  utop.uTB.ce       $end
-$var wire   32  aaj  utop.uTB.wdata [31:0]  $end
-$var wire    4  aak  utop.uTB.addr [3:0]  $end
-$var wire    1  aal  utop.uTB.xrst       $end
-$var wire    1  aam  utop.uTB.clk       $end
-$var wire   32  aan  utop.uTB.rdata [31:0]  $end
-$var wire   32  aao  utop.uRAM.rdata [31:0]  $end
-$var wire    1  aap  utop.uRAM.we       $end
-$var wire    1  aaq  utop.uRAM.ce       $end
-$var wire   32  aar  utop.uRAM.wdata [31:0]  $end
-$var wire    4  aas  utop.uRAM.addr [3:0]  $end
-$var wire    1  aat  utop.uRAM.xrst       $end
-$var wire    1  aau  utop.uRAM.clk       $end
-$upscope $end
-$enddefinitions  $end
+       $scope module SystemC $end
+               $scope module utop $end
+                       $var wire 4 aac w_addr [3:0] $end
+                       $var wire 1 aae w_ce $end
+                       $var wire 1 aaa w_clk $end
+                       $var wire 32 aag w_rdata [31:0] $end
+                       $var wire 32 aad w_wdata [31:0] $end
+                       $var wire 1 aaf w_we $end
+                       $var wire 1 aab w_xrst $end
+                       $scope module uRAM $end
+                               $var wire 4 aas addr [3:0] $end
+                               $var wire 1 aaq ce $end
+                               $var wire 1 aau clk $end
+                               $var wire 32 aao rdata [31:0] $end
+                               $var wire 32 aar wdata [31:0] $end
+                               $var wire 1 aap we $end
+                               $var wire 1 aat xrst $end
+                       $upscope $end
+                       $scope module uTB $end
+                               $var wire 4 aak addr [3:0] $end
+                               $var wire 1 aai ce $end
+                               $var wire 1 aam clk $end
+                               $var wire 32 aan rdata [31:0] $end
+                               $var wire 32 aaj wdata [31:0] $end
+                               $var wire 1 aah we $end
+                               $var wire 1 aal xrst $end
+                       $upscope $end
+               $upscope $end
+       $upscope $end
+$enddefinitions $end

 $comment
 All initial values are dumped below at time 0 sec = 0 timescale units.
 $end
-
 $dumpvars
 0aaa
 0aab

確かに階層化されてますね。
これは便利ですね!!!