{"id":460,"date":"2024-11-01T16:33:34","date_gmt":"2024-11-01T20:33:34","guid":{"rendered":"https:\/\/www.compdigitec.com\/labs\/?p=460"},"modified":"2024-11-01T16:33:34","modified_gmt":"2024-11-01T20:33:34","slug":"vcd-dumping-in-chisel-6-5-svsim","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2024\/11\/01\/vcd-dumping-in-chisel-6-5-svsim\/","title":{"rendered":"VCD dumping in Chisel 6.5 \/ svsim"},"content":{"rendered":"<p>Since Chisel 5, <a href=\"https:\/\/github.com\/chipsalliance\/chisel\/blob\/v7.0.0-M2\/docs\/src\/appendix\/migrating-from-chiseltest.md\" data-type=\"URL\" data-id=\"https:\/\/github.com\/chipsalliance\/chisel\/blob\/v7.0.0-M2\/docs\/src\/appendix\/migrating-from-chiseltest.md\">chiseltest (formerly known as chisel-testers2) is no longer supported and has been replaced with svsim in the default chisel-template<\/a>. Unfortunately, the new system doesn&#8217;t provide an easy way to dump VCDs from tests.<\/p>\n\n\n\n<p>On vanilla Chisel 6.5 this ended up requiring two separate hacks against <code>EphemeralSimulator<\/code>:<\/p>\n\n\n\n<ol>\n<li><a href=\"https:\/\/github.com\/edwardcwang\/decoupled-serializer\/blob\/master\/src\/main\/scala\/VCDHackedEphemeralSimulator.scala#L44\">https:\/\/github.com\/edwardcwang\/decoupled-serializer\/blob\/master\/src\/main\/scala\/VCDHackedEphemeralSimulator.scala#L44<\/a><br>Inserting <code>traceStyle = Some(verilator.Backend.CompilationSettings.TraceStyle.Vcd(traceUnderscore = true))<\/code> into the <code>backendSpecificCompilationSettings<\/code> of the <code>DefaultSimulator<\/code>.<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/edwardcwang\/decoupled-serializer\/blob\/master\/src\/main\/scala\/VCDHackedEphemeralSimulator.scala#L31\">https:\/\/github.com\/edwardcwang\/decoupled-serializer\/blob\/master\/src\/main\/scala\/VCDHackedEphemeralSimulator.scala#L31<\/a><br>The above was not enough as it added support for tracing but did not actually call the functions to enable &amp; start the dumping.<br>Hacking the <code>simulate()<\/code> method to insert a call to <code>module.controller.setTraceEnabled(true)<\/code> to actually enable the dump of the <code>.vcd<\/code> file.<\/li>\n<\/ol>\n\n\n\n<p>Third bonus hack: use the local <code>test_run_dir<\/code> directory (from older versions of Chisel) instead of a temporary one which gets deleted.<br><a href=\"https:\/\/github.com\/edwardcwang\/decoupled-serializer\/blob\/master\/src\/main\/scala\/VCDHackedEphemeralSimulator.scala#L61\">https:\/\/github.com\/edwardcwang\/decoupled-serializer\/blob\/master\/src\/main\/scala\/VCDHackedEphemeralSimulator.scala#L61<\/a><\/p>\n\n\n\n<p>See also:<br><a href=\"https:\/\/github.com\/chipsalliance\/chisel\/issues\/4246\">https:\/\/github.com\/chipsalliance\/chisel\/issues\/4246<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/chipsalliance\/chisel\/issues\/4203\">https:\/\/github.com\/chipsalliance\/chisel\/issues\/4203<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/chipsalliance\/chisel\/discussions\/3957\">https:\/\/github.com\/chipsalliance\/chisel\/discussions\/3957<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Since Chisel 5, chiseltest (formerly known as chisel-testers2) is no longer supported and has been replaced with svsim in the default chisel-template. Unfortunately, the new system doesn&#8217;t provide an easy way to dump VCDs from tests. On vanilla Chisel 6.5 this ended up requiring two separate hacks against EphemeralSimulator: Third bonus hack: use the local [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[900],"tags":[954,955,956],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/460"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=460"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/460\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=460"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}