Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

BlackBoxSourceHelper: ensure trailing newline in .f file #2405

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

ekiwi
Copy link
Contributor

@ekiwi ekiwi commented Nov 4, 2021

It seems like some simulators require a trailing newline in every .f file: ucb-bar/chiseltest#429 (comment)

Contributor Checklist

  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?

Type of Improvement

  • bug fix

API Impact

  • none

Backend Code Generation Impact

  • none

Desired Merge Strategy

  • squash

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (1.2.x, 1.3.0, 1.4.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

@@ -135,7 +135,7 @@ class BlackBoxSourceHelper extends Transform with DependencyAPIMigration {
// make[1]: *** No rule to make target `test_run_dir/examples.AccumBlackBox_PeekPokeTest_Verilator345491158/AccumBlackBox.v', needed by `.../chisel-testers/test_run_dir/examples.AccumBlackBox_PeekPokeTest_Verilator345491158/VAccumBlackBoxWrapper.h'. Stop.
// or we end up including the same file multiple times.
if (verilogSourcesOnly.nonEmpty) {
writeTextToFile(verilogSourcesOnly.map(_.getCanonicalPath).mkString("\n"), filelistFile)
writeTextToFile(verilogSourcesOnly.map(_.getCanonicalPath).mkString("\n") + "\n", filelistFile)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
writeTextToFile(verilogSourcesOnly.map(_.getCanonicalPath).mkString("\n") + "\n", filelistFile)
writeTextToFile(verilogSourcesOnly.map(_.getCanonicalPath).mkString("", "\n", "\n"), filelistFile)

Just an FYI that there is a 3 argument mkString that has start and end arguments as well. Generally it's just a stylistic choice but since that append requires an extra String copy, it could be useful for very large Strings. Probably fine to leave as is in this case though.

@ekiwi ekiwi added the Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI. label Nov 4, 2021
@mergify mergify bot merged commit 7ef3e1b into chipsalliance:master Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Please Merge Accepted PRs that are ready to be merged. Useful when waiting on CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants