Skip to content

Chisel drops escaped % in printf if it is the last character in the format string and preceded by a space #4818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jackkoenig opened this issue Mar 21, 2025 · 0 comments

Comments

@jackkoenig
Copy link
Contributor

Type of issue: Bug Report

Please provide the steps to reproduce the problem:

//> using repository "sonatype-s01:snapshots"
//> using scala "2.13.16"
//> using dep "org.chipsalliance::chisel:7.0.0-M2+618-2ce6ab30-SNAPSHOT"
//> using plugin "org.chipsalliance:::chisel-plugin:7.0.0-M2+618-2ce6ab30-SNAPSHOT"
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

import chisel3._
// _root_ disambiguates from package chisel3.util.circt if user imports chisel3.util._
import _root_.circt.stage.ChiselStage

class Foo extends Module {
  val foo, bar = IO(Input(UInt(8.W)))
  val out = IO(Output(UInt(8.W)))

  out := foo + bar
  printf(cf" %%")
}

object Main extends App {
  println(ChiselStage.emitCHIRRTL(gen = new Foo))
}

What is the current behavior?

The printf in the FIRRTL will be:

printf(clock, UInt<1>(0h1), " ")

What is the expected behavior?

The printf should be

printf(clock, UInt<1>(0h1), " %%")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant