@@ -318,13 +318,20 @@ class PrintableSpec extends AnyFlatSpec with Matchers with FileCheck {
318318 it should " support all legal format specifiers" in {
319319 class MyModule extends Module {
320320 val in = IO (Input (UInt (8 .W )))
321- printf(cf " $HierarchicalName $in%d $in%x $in%b $in%c %% \n " )
321+ printf(cf " $HierarchicalModuleName $in%d $in%x $in%b $in%c %% \n " )
322322 }
323323 ChiselStage
324324 .emitCHIRRTL(new MyModule )
325325 .fileCheck()(
326- """ CHECK: printf(clock, UInt<1>(0h1), "%m %d %x %b %c %%\n", in, in, in, in)"""
326+ """ CHECK{LITERAL} : printf(clock, UInt<1>(0h1), "{{HierarchicalModuleName}} %d %x %b %c %%\n", in, in, in, in)"""
327327 )
328+ // Also check Verilog
329+ ChiselStage
330+ .emitSystemVerilog(new MyModule )
331+ .fileCheck()(
332+ """ CHECK: $fwrite(`PRINTF_FD_, "%m %d %x %b %c %%\n", in, in, in, in);"""
333+ )
334+
328335 }
329336
330337 it should " support modifiers to format specifiers" in {
@@ -383,7 +390,7 @@ class PrintableSpec extends AnyFlatSpec with Matchers with FileCheck {
383390 (Character (x), (" %c" , Seq (x))),
384391 (PString (" foo" ), (" foo" , Seq ())),
385392 (Percent , (" %%" , Seq ())),
386- (HierarchicalName , (" %m" , Seq ())),
393+ (HierarchicalModuleName , (" %m" , Seq ())),
387394 (Name (x), (" %n" , Seq (x))),
388395 (FullName (x), (" %N" , Seq (x)))
389396 )
0 commit comments