chipsalliance / chisel

Chisel: A Modern Hardware Design Language

Home Page:https://www.chisel-lang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Workspace path parsing fails on Windows

zhc7 opened this issue · comments

commented

Type of issue: Bug Report

Please provide the steps to reproduce the problem:

  1. clone chisel template
  2. run sbt test
  3. it fails

What is the current behavior?

I traced it down to this:
EphemeralSimulator.makeSimulator creates a Simulator with workspace path that starts with "C:", then when parsing this temp dir at

if (path.startsWith("/"))
, it is mistakenly considered as a relative path which leads to errors.

What is the expected behavior?

Maybe we can find a way that is more friendly to Windows? For example add || path(1) == ':'.

Please tell us about your environment:

  • version: 6.2.0
  • OS: Windows with msys2 environment

Other Information

What is the use case for changing the behavior?

To run it on Windows.

Acutally I'm not sure if chisel is intended not to support Windows. I didn't see any warnings about this. If so, please tell me.

Thanks for the report!

Chisel is supposed to support Windows, although the level of support is a bit up in the air at the moment. We definitely support emitting Verilog, but it gets trickier when it comes to running simulations. Prior to Chisel 5.0.0 when we were still using the Scala FIRRTL Compiler, we had an interpreter written in Scala (Treadle) which made it easy to support simulations on Windows. Now, we rely on Verilator to simulate our emitted Verilog and I believe Verilator's support for Windows is pretty limited. That being said, the Scala code in Chisel should not be the limiting factor here so we should fix this issue you're seeing. I also suspect Verilator should work on MSYS2 so that excuse doesn't apply 😉.

There is also movement toward having Chisel link against CIRCT directly rather than just running the firtool binary (the later is published for Windows). Unfortunately, LLVM's build flow doesn't support building Windows DLLs so how we make the direct linking work on Windows is unclear. It may be the case that we just need to push Chisel Windows users to use WSL2 which should allow us to just use the Linux shared libraries.

A bit rambly, but hopefully this provides a little bit more context for where things are at. We would love someone who uses Windows to help improve Windows support 🙂

commented

Thanks for replying!

WSL2 is probably the best work around. After resolving this issue locally, I found that there's still some subtle traps, including but not limited to: verilator 5.x does not work; path separator \ should be replaced by / in makefile; g++ provided by msys2 can't resolve getline in cpp, etc. It's much easier to just embrace wsl. Though, I'm still looking forward to running chisel natively on Windows. I'm happy to help if needed!

For those issue you described, I think maybe it’s a right time for chisel to deprecate native Windows support ;p