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

ExtModule's lacked support built in support for providing #1154

Merged
merged 7 commits into from
Oct 13, 2020

Conversation

chick
Copy link
Contributor

@chick chick commented Aug 12, 2019

Inconsistent API between ExtModule and BlackBox
ExtModule's lacked support built in support for providing the verilog source. This changes creates traits that can be used with ExtModule to provide the support currently found in BlackBox

  • Add support for ExtModule helpers
    • HasExtModuleResource to use addResource
    • HasExtModuleInline to use setInline
    • HasExtModulePath to use addPath
  • Add tests of the above support.
    • Note: These tests use Stage instead of Driver
  • Added ScalaDoc for HasBlackBoxInline#setInline

Type of change: Make ExtModule consistent with BlackBox

Impact: API addition (no impact on existing code)

Development Phase: implementation

Release Notes
ExtModule now has support for 3 methods of providing the underlying verilog implementations: in-line string, scala/java resource (best for use in libraries), and via a file path name.

the verilog source. This changes creates traits that
can be used with ExtModule to provide the support currently found in
BlackBox

- Add support for ExtModule helpers
  - HasExtModuleResource to use addResource
  - HasExtModuleInline to use setInline
  - HasExtModulePath to use addPath
- Add tests of the above support.
  - Note: These tests use Stage instead of Driver
- Added ScalaDoc for HasBlackBoxInline#setInline
@chick chick added release issue Feature New feature, will be included in release notes labels Aug 12, 2019
@chick chick requested a review from a team as a code owner August 12, 2019 22:53
@chick chick self-assigned this Aug 12, 2019
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a real review, but this is failing due to Scala 2.11 trailing comma support.

src/test/scala/chiselTests/ExtModuleImpl.scala Outdated Show resolved Hide resolved
src/test/scala/chiselTests/ExtModuleImpl.scala Outdated Show resolved Hide resolved
src/test/scala/chiselTests/ExtModuleImpl.scala Outdated Show resolved Hide resolved
@chick
Copy link
Contributor Author

chick commented Aug 19, 2019

@seldridge Thanks, I like the idea of trailing commas, but I've got to find some mechanism for warning me when I commit with them. BTW, I haven't seen the suggested change in a code comment before. Is that some new feature?

@seldridge seldridge dismissed their stale review August 19, 2019 16:24

Dismiss trailing comma review.

Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this missing API, @chick!

One comment, but feel free to merge when ready.

TargetDirAnnotation(targetDir),
ChiselGeneratorAnnotation(() => new UsesExtModuleAddViaInline)
)
val newAnnotations = (new ChiselStage).run(annotations)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use the transform or execute methods instead of run. The latter is what the user is supposed to implement, while the former two are running all the pre- and post-run steps.

Ditto for other usages below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use .transform

@chick chick merged commit fd92809 into master Oct 13, 2020
@jackkoenig jackkoenig deleted the extmodule-verilog-access-support branch October 19, 2020 19:40
@jackkoenig jackkoenig added this to the 3.4.x milestone Nov 2, 2020
@jackkoenig
Copy link
Contributor

We forgot to backport this which is causing the tests in #1650 to fail on 3.4.x

@jackkoenig
Copy link
Contributor

@Mergifyio backport 3.4.x

mergify bot pushed a commit that referenced this pull request Nov 2, 2020
* ExtModule's lacked support built in support for providing
the verilog source. This changes creates traits that
can be used with ExtModule to provide the support currently found in
BlackBox

- Add support for ExtModule helpers
  - HasExtModuleResource to use addResource
  - HasExtModuleInline to use setInline
  - HasExtModulePath to use addPath
- Add tests of the above support.
  - Note: These tests use Stage instead of Driver
- Added ScalaDoc for HasBlackBoxInline#setInline

* Fix the danged trailing commas.

* Change to use `.transform` as the correct API for `ChiselStage`

(cherry picked from commit fd92809)
@mergify
Copy link
Contributor

mergify bot commented Nov 2, 2020

Command backport 3.4.x: success

Backports have been created

@jackkoenig jackkoenig added the Backported This PR has been backported label Nov 2, 2020
mergify bot added a commit that referenced this pull request Nov 2, 2020
)

* ExtModule's lacked support built in support for providing
the verilog source. This changes creates traits that
can be used with ExtModule to provide the support currently found in
BlackBox

- Add support for ExtModule helpers
  - HasExtModuleResource to use addResource
  - HasExtModuleInline to use setInline
  - HasExtModulePath to use addPath
- Add tests of the above support.
  - Note: These tests use Stage instead of Driver
- Added ScalaDoc for HasBlackBoxInline#setInline

* Fix the danged trailing commas.

* Change to use `.transform` as the correct API for `ChiselStage`

(cherry picked from commit fd92809)

Co-authored-by: Chick Markley <chick@qrhino.com>
jackkoenig pushed a commit that referenced this pull request Feb 28, 2023
* Fixes #1154
* Tests that #1154 example produces SyntaxErrorsException
* Generally helps catch trailing syntax errors
* Performance-neutral relative to previous grammar
* Recommended by antlr4 devs, can help performance in some cases
* See antlr/antlr4#1540
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported This PR has been backported Feature New feature, will be included in release notes release issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants