-
Notifications
You must be signed in to change notification settings - Fork 604
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
git-subtree add sifive/chisel-circt #2477
Conversation
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add a "handover" option that augments circt.stage.ChiselStage to lower using a combination of the Scala FIRRTL Compiler (SFC) followed by CIRCT. The handover can be set at CHIRRTL (don't run the SFC), High FIRRTL, Middle FIRRTL, Low FIRRTL, or Optimized Low FIRRTL. Include tests of this behavior by looking at the FirrtlCircuitAnnotation that exists before running CIRCT for different handover values. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add --handover option to lower partially using SFC
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add publishing to sonatype
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
- Add Maven release, Sonatype snapshots, and Javadoc.io badges - Improve setup instructions Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add an option to output using a "*.v" suffix. This is still using the CIRCT SystemVerilog back end, though. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change command line option passed to "firtool" due to upstream change. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change "RTL" to "HW"
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
* add mill build system * bump to Chisel 3.5.0 * use cross build to select Scala version. * add gitignore * Add/use Compiler Plugin
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add Scala 2.13, enable 2.13 CI
Change the default handover from optimized low FIRRTL to CHIRRTL. This is done because CIRCT is an essentially complete FIRRTL compiler now. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change ChiselStage to pass annotations to firtool via a file. Also, add logic to remove lots of annotations and convert them to equivalent firtool options. Any annotations that we don't know what to do with are passed on to firtool to let it deal with them. This has the effect of both communicating things like DontTouchAnnotation and also providing information to the user that they are passing annotations that firtool doesn't know how to handle. To do the latter checking "-warn-on-unprocessed-annotations" is turned on. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add numerous tests that are checking the behavior of annotation passing and consumption by CIRCT. This adds tests for: - InlineInstance - FlattenInstance - dontTouch (of wires and nodes) - forceName (of modules only) - Deduplication and doNotDedup Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add Annotation support and conversion to firtool CLI options.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add an annotation, FirtoolOption, that can be used to pass a command line option directly to firtool. More than one FirtoolOption can be specified. Add a test that shows using this to enable case statement emission through a "--lowering-option". Fixes #12. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Should this be in an |
Good point, Kevin. My plan is to block this PR (keep it as a draft) until we have binary releases available for CIRCT. |
Sounds good. Do you think it would be feasible to have some code that automatically determines the platform we are on and then downloads the latest firtool release (or a compatible version) for the current platform from github? |
* Add scalafmt files from chisel3 * Enable scalafmt in SBT * Scalafmt all the files * Add scalafmt check to CI
Add support for the new, finer-grained aggregate preservation options that were added to CIRCT/firtool. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
firtool binaries is now published on each release of CIRCT, so I plan to resurrect this PR |
6d87c27
to
fb844be
Compare
Specifically, this was added in llvm/circt#3617 and is automatically published as part of the release assets for CIRCT. E.g., the SiFive 1.11.0 release of CIRCT binaries are available here: https://github.com/llvm/circt/releases/tag/sifive%2F1%2F11%2F0 This is also what I'm using for CI in this PR. |
Change GitHub CI to use a tagged, published Ubuntu binary of CIRCT instead of relying on a nightly docker image. This is both: (1) more stable and (2) way faster. This also removes a barrier to upstreaming chisel-circt with chisel3. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Logistically, any feedback on this PR that actually requests code modifications I'll address on upstream |
ok, so you would prefer to merge outstanding chisel-circt PRs first before merging into chisel3? EDIT i misread the comment. Does this PR currently include at least the scalafmt change? |
I'd rather not block this on those PRs. We can move them over here once this lands. I was instead saying if Jack comes in and wants me to rewrite |
blackbox = true | ||
false | ||
/* Any emitters should not be passed to firtool. */ | ||
case _: firrtl.Emitter => false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you specify the target if you emitters are ignored? Like how would I distinguish between generating Firrtl or SystemVerilog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a CIRCTTargetAnnotation
that will control it. They main issue here is that there isn't a good way of adding multiple RunFirrtlTransformAnnotation(_: firrtl.Emitter)
s to CIRCT as it's trying to work towards a fixed target, e.g., FIRRTL Dialect, HW Dialect, SV Dialect, or SV.
It's reasonable that if there was one RunFirrtlTransformAnnotation(_ : firrtl.Emitter)
that this could be used to tell CIRCT what to compile to. However, it seemed cleaner to just strip this and force users to use the new annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this a bit more... it would probably be better to actually error on this. I can do this in a follow-up.
This should be basically dead code right now as the expectation is that a user is going to use circt.stage.ChiselStage
which is not going to use a RunFirrtlTransformAnnotation
to tell CIRCT what emitter to use. There's a separate API/Annotation for that, CIRCTTargetAnnotation
. A user could see weird behavior if they are doing one of the following:
- Generating a
RunFirrtlTransformAnnotation(_ : Emitter)
inside aChiselAnnotation
. - Building a custom stage out of Chisel3 phases and CIRCT phases.
- Possibly other weird things.
I agree that if there are tweaks we want to make to chisel-circt we can do that here once this is on. What is the story for backporting and backwards compatability binary checking for this chunk of code? For now will we just have this on |
No backporting, this is a Chisel 3.6 addition. |
Ok, if this is a 3.6 addition and we are stopping any development on the chisel-circt repo, that is a bit tricky for anyone who wants to use 3.5.x and chisel-circt and needs chisel-circt improvements... But I'm Ok with a workflow that makes parallel PRs to chisel-circt and this repo until this is actually released w chisel |
I wouldn't worry about this. |
…rrtool (#15) - Fix handling of EmitAllModulesAnnotation - Fix stderr handling/erroring out if firtool errors during compile
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Move the git-subtree added sifive/chisel-circt repository from "circt/" into "src/main/scala/circt/" and "src/test/scala/circtTests/". Update the chisel-circt README, which now lives in the src directory, to not indicate that this is a published dependency anymore. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Use the published Ubuntu 20.04 binary of CIRCT to enable chisel-circt tests in CI. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
fb844be
to
abab0dd
Compare
I force pushed this after landing a PR that @mwachs5 needed. That closes out any known needed development on |
Merging after verbal approval from @jackkoenig. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late view, but not too late, glad we didn't version 3.6.0 now.
Just some small questions:
- Is possible to add as less as possible public APIs to make room for future improvements.
- IIRC, the handover behavior will be removed eventually, what's the roadmap of this.
object Implicits { | ||
|
||
/** Helpers for working with Boolean */ | ||
implicit class BooleanImplicits(a: Boolean) { | ||
|
||
/** Construct an Option from a Boolean. */ | ||
def option[A](b: => A): Option[A] = | ||
if (a) | ||
Some(b) | ||
else | ||
None | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought these APIs may not be public?
object Implicits { | ||
|
||
/** Helpers for working with Boolean */ | ||
implicit class BooleanImplicits(a: Boolean) { | ||
|
||
/** Construct an Option from a Boolean. */ | ||
def option[A](b: => A): Option[A] = | ||
if (a) | ||
Some(b) | ||
else | ||
None | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay review:
Should we private these to avoid introducing more public APIs?
- name: Install CIRCT | ||
run: | | ||
mkdir usr | ||
wget https://github.com/llvm/circt/releases/download/sifive%2F1%2F11%2F0/circt-bin-ubuntu-20.04.tar.gz -O - | tar -zx -C usr/ | ||
echo "$(pwd)/usr/bin" >> $GITHUB_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope we can have a better way to install CIRCT in the system.
|
||
} | ||
|
||
object CIRCTHandover extends HasShellOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we might eventually get rid of the Handover
behavior. Am I right?
import firrtl.AnnotationSeq | ||
import firrtl.options.Phase | ||
|
||
class AddDefaults extends Phase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be private too?
import firrtl.options.Viewer.view | ||
import firrtl.stage.{Forms, RunFirrtlTransformAnnotation} | ||
|
||
class MaybeSFC extends Phase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
This commit is the first step towards enabling CIRCT-compiled Chisel natively inside Chisel (as opposed to relying on a separate library).
This does three things:
git-subtree
to add https://github.com/sifive/chisel-circt (with history) as a directory calledcirct/
.circt/
intosrc/main/scala/circt/
orsrc/test/scala/circt/
.This PR is expected to fail until we have a way of adding CIRCT as a dependency to the CI.