Skip to content

Commit 55dd49d

Browse files
chiselbotseldridge
andauthored
Mass deprecations, to be removed in Chisel 7 (backport #4754) (#4756)
* Mass deprecations, to be removed in Chisel 7 (#4754) Mass deprecation of APIs that we would like to delete in Chisel 7. Signed-off-by: Schuyler Eldridge <[email protected] (cherry picked from commit 868c195) # Conflicts: # firrtl/src/test/scala/firrtlTests/FileUtilsSpec.scala # src/test/scala/chiselTests/Harness.scala * fixup! Mass deprecations, to be removed in Chisel 7 (#4754) * fixup! Mass deprecations, to be removed in Chisel 7 (#4754) --------- Co-authored-by: Schuyler Eldridge <[email protected]>
1 parent 66580c0 commit 55dd49d

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

build.sbt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ lazy val warningSuppression = Seq(
8080
"cat=deprecation&origin=chisel3\\.stage\\.phases.MaybeAspectPhase:s",
8181
"cat=deprecation&origin=chisel3\\.InstanceId:s",
8282
"cat=deprecation&origin=chisel3\\.testers\\.BasicTester:s",
83-
"cat=deprecation&origin=chisel3\\.testers\\.TesterDriver:s"
83+
"cat=deprecation&origin=chisel3\\.testers\\.TesterDriver:s",
84+
"cat=deprecation&origin=firrtl\\.util\\.BackendCompilationUtilities.*:s",
85+
"cat=deprecation&origin=firrtl\\.transforms\\.BlackBoxSourceHelper.*:s"
8486
).mkString(",")
8587
)
8688

firrtl/src/main/scala/firrtl/FileUtils.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
package firrtl
44

5+
@deprecated("Use os-lib directly or scala.io", "Chisel 6.7.0")
56
object FileUtils {
67

78
/** Read a text file and return it as a Seq of strings

firrtl/src/main/scala/firrtl/transforms/BlackBoxSourceHelper.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ case class BlackBoxPathAnno(target: ModuleName, path: String)
2727
override def serialize: String = s"path\n$path"
2828
}
2929

30+
@deprecated("Use Chisel's HasBlockBoxResource/HasExtModuleResource APIs", "Chisel 6.7.0")
3031
case class BlackBoxResourceFileNameAnno(resourceFileName: String) extends BlackBoxHelperAnno with NoTargetAnnotation {
3132
override def serialize: String = s"resourceFileName\n$resourceFileName"
3233
}
@@ -40,6 +41,7 @@ class BlackBoxNotFoundException(fileName: String, message: String)
4041
s"BlackBox '$fileName' not found. Did you misspell it? Is it in src/{main,test}/resources?\n$message"
4142
)
4243

44+
@deprecated("Use Chisel's HasBlockBoxResource/HasExtModuleResource APIs", "Chisel 6.7.0")
4345
object BlackBoxSourceHelper {
4446

4547
/** Safely access a file converting [[FileNotFoundException]]s and [[NullPointerException]]s into
@@ -59,6 +61,7 @@ object BlackBoxSourceHelper {
5961
* @param dir the directory in which to write the file
6062
* @return the closed File object
6163
*/
64+
@deprecated("Use Chisel's HasBlockBoxResource/HasExtModuleResource APIs", "Chisel 6.7.0")
6265
def writeResourceToDirectory(name: String, dir: File): File = {
6366
val fileName = name.split("/").last
6467
val outFile = new File(dir, fileName)
@@ -72,13 +75,15 @@ object BlackBoxSourceHelper {
7275
* @param file the file to write it into
7376
* @throws BlackBoxNotFoundException if the requested resource does not exist
7477
*/
78+
@deprecated("Use Chisel's HasBlockBoxResource/HasExtModuleResource APIs", "Chisel 6.7.0")
7579
def copyResourceToFile(name: String, file: File): Unit = {
7680
val in = getClass.getResourceAsStream(name)
7781
val out = new FileOutputStream(file)
7882
safeFile(name)(Iterator.continually(in.read).takeWhile(-1 != _).foreach(out.write))
7983
out.close()
8084
}
8185

86+
@deprecated("Use Chisel's HasBlockBoxResource/HasExtModuleResource APIs", "Chisel 6.7.0")
8287
val defaultFileListName = "firrtl_black_box_resource_files.f"
8388

8489
}

firrtl/src/main/scala/firrtl/util/BackendCompilationUtilities.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,24 @@ import firrtl.FileUtils
1313

1414
import scala.sys.process.{ProcessBuilder, ProcessLogger, _}
1515

16+
@deprecated(
17+
"This object hasn't been practical to use since Chisel 5.0.0. If you are doing compilation to Verilog use `circt.stage.ChiselStage`. For simulation use ChiselSim.",
18+
"Chisel 6.7.0"
19+
)
1620
object BackendCompilationUtilities extends LazyLogging {
1721

1822
/** Parent directory for tests */
23+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
1924
lazy val TestDirectory = new File("test_run_dir")
2025

26+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
2127
def timeStamp: String = {
2228
val format = new SimpleDateFormat("yyyyMMddHHmmss")
2329
val now = Calendar.getInstance.getTime
2430
format.format(now)
2531
}
2632

33+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
2734
def loggingProcessLogger: ProcessLogger =
2835
ProcessLogger(logger.info(_), logger.warn(_))
2936

@@ -32,6 +39,7 @@ object BackendCompilationUtilities extends LazyLogging {
3239
* @param name the name of the resource
3340
* @param file the file to write it into
3441
*/
42+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
3543
def copyResourceToFile(name: String, file: File): Unit = {
3644
val in = getClass.getResourceAsStream(name)
3745
if (in == null) {
@@ -47,12 +55,14 @@ object BackendCompilationUtilities extends LazyLogging {
4755
* Will create outer directory called testName then inner directory based on
4856
* the current time
4957
*/
58+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
5059
def createTestDirectory(testName: String): File = {
5160
val outer = new File(TestDirectory, testName)
5261
outer.mkdirs()
5362
Files.createTempDirectory(outer.toPath, timeStamp).toFile
5463
}
5564

65+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
5666
def makeHarness(template: String => String, post: String)(f: File): File = {
5767
val prefix = f.toString.split("/").last
5868
val vf = new File(f.toString + post)
@@ -69,6 +79,7 @@ object BackendCompilationUtilities extends LazyLogging {
6979
* @param dir directory where file lives
7080
* @return true if compiler completed successfully
7181
*/
82+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
7283
def firrtlToVerilog(prefix: String, dir: File): ProcessBuilder = {
7384
Process(Seq("firrtl", "-i", s"$prefix.fir", "-o", s"$prefix.v", "-X", "verilog"), dir)
7485
}
@@ -98,6 +109,7 @@ object BackendCompilationUtilities extends LazyLogging {
98109
* @param resourceFileName specifies what filename to look for to find a .f file
99110
* @param extraCmdLineArgs list of additional command line arguments
100111
*/
112+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
101113
def verilogToCpp(
102114
dutFile: String,
103115
dir: File,
@@ -160,9 +172,11 @@ object BackendCompilationUtilities extends LazyLogging {
160172
command
161173
}
162174

175+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
163176
def cppToExe(prefix: String, dir: File): ProcessBuilder =
164177
Seq("make", "-C", dir.toString, "-j", "-f", s"V$prefix.mk", s"V$prefix")
165178

179+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
166180
def executeExpectingFailure(
167181
prefix: String,
168182
dir: File,
@@ -183,6 +197,7 @@ object BackendCompilationUtilities extends LazyLogging {
183197
triggered || (e != 0 && (e != 134 || !assertionMessageSupplied))
184198
}
185199

200+
@deprecated("BackendCompilationUtilities will be removed in Chisel 7.0.0", "Chisel 6.7.0")
186201
def executeExpectingSuccess(prefix: String, dir: File): Boolean = {
187202
!executeExpectingFailure(prefix, dir)
188203
}

firrtl/src/test/scala/firrtlTests/FileUtilsSpec.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ package firrtlTests
55
import firrtl.FileUtils
66
import org.scalatest.flatspec.AnyFlatSpec
77
import org.scalatest.matchers.should.Matchers
8+
import scala.annotation.nowarn
89

10+
@nowarn("msg=object FileUtils in package firrtl is deprecated")
911
class FileUtilsSpec extends AnyFlatSpec with Matchers {
1012

1113
private val sampleAnnotations: String = "annotations/SampleAnnotations.anno.json"

src/test/scala/chiselTests/Harness.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ package chiselTests
44

55
import java.io.File
66
import firrtl.util.BackendCompilationUtilities._
7+
import scala.annotation.nowarn
8+
9+
@nowarn("msg=object BackendCompilationUtilities in package util is deprecated")
10+
@nowarn("msg=method makeHarness in object BackendCompilationUtilities is deprecated")
11+
@nowarn("msg=method cppToExe in object BackendCompilationUtilities is deprecated")
12+
@nowarn("msg=method executeExpectingSuccess in object BackendCompilationUtilities is deprecated")
13+
@nowarn("msg=method executeExpectingFailure in object BackendCompilationUtilities is deprecated")
14+
@nowarn("msg=method createTestDirectory in object BackendCompilationUtilities is deprecated")
15+
@nowarn("msg=method verilogToCpp in object BackendCompilationUtilities is deprecated")
716
class HarnessSpec extends ChiselPropSpec {
817

918
def makeTrivialVerilog: (File => File) = makeHarness((prefix: String) => s"""

0 commit comments

Comments
 (0)