Skip to content
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

Source line + carat for errors should work for Scala CLI Example #4172

Open
jackkoenig opened this issue Jun 13, 2024 · 0 comments
Open

Source line + carat for errors should work for Scala CLI Example #4172

jackkoenig opened this issue Jun 13, 2024 · 0 comments

Comments

@jackkoenig
Copy link
Contributor

Type of issue: Bug Report

Please provide the steps to reproduce the problem:

Consider the following example built from the Scala CLI template chisel-example.scala:

//> using scala "2.13.12"
//> using dep "org.chipsalliance::chisel:6.4.0"
//> using plugin "org.chipsalliance:::chisel-plugin:6.4.0"
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-Ywarn-unused", "-Ymacro-annotations"

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

class Foo extends Module {
  val out = IO(Output(Probe(UInt(8.W))))

  val w = Wire(UInt(8.W))
  define(out, w)

}

object Main extends App {
  println(
    ChiselStage.emitSystemVerilog(
      gen = new Foo,
      firtoolOpts = Array("-disable-all-randomization", "-strip-debug-info")
    )
  )
}

What is the current behavior?

This prints the following error:

[error] Users/koenig/work/t/define/chisel-example.scala 15:9: Expected source to be a probe expression.
[error] There were 1 error(s) during hardware elaboration.
Exception in thread "main" chisel3.internal.Errors: Fatal errors during hardware elaboration. Look above for error list. Rerun with --throw-on-first-error if you wish to see a stack trace.

What is the expected behavior?

If you emit CHIRRTL from a working build, you'll see that when using Scala-CLI, the source locators are absolute but missing the root /, e.g.:

input clock : Clock @[Users/koenig/work/t/define/chisel-example.scala 11:7]

It seems that Scala-CLI compiles in the root directory but then runs in .. The leading / is stripped here:

val pathNoStartingSlash = if (path(0) == '/') path.tail else path

I'm not sure why we're stripping it, but I think we can stop doing that and this will work.

Please tell us about your environment:

Other Information

What is the use case for changing the behavior?

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