Skip to content

Commit

Permalink
move logger into firrtl2 namespace (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Jun 9, 2023
1 parent fc25174 commit 176a884
Show file tree
Hide file tree
Showing 29 changed files with 38 additions and 48 deletions.
7 changes: 2 additions & 5 deletions src/main/scala/firrtl2/Compiler.scala
Expand Up @@ -2,18 +2,15 @@

package firrtl2

import logger._
import java.io.Writer

import scala.collection.mutable
import scala.collection.immutable.VectorBuilder
import scala.util.Try
import scala.util.control.NonFatal
import firrtl2.annotations._
import firrtl2.ir.Circuit
import firrtl2.Utils.throwInternalError
import firrtl2.annotations.transforms.{EliminateTargetPaths, ResolvePaths}
import firrtl2.options.{Dependency, DependencyAPI, StageUtils, TransformLike}
import firrtl2.logger.{LazyLogging, Logger}
import firrtl2.options.{Dependency, DependencyAPI, TransformLike}
import firrtl2.stage.Forms
import firrtl2.transforms.DedupAnnotationsTransform

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/firrtl2/Parser.scala
Expand Up @@ -4,11 +4,11 @@ package firrtl2

import org.antlr.v4.runtime._
import org.antlr.v4.runtime.atn._
import logger.LazyLogging
import firrtl2.ir._
import firrtl2.parser.Listener
import firrtl2.Utils.time
import firrtl2.antlr._
import firrtl2.logger.LazyLogging

import scala.util.control.NonFatal

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/firrtl2/PrimOps.scala
Expand Up @@ -2,10 +2,10 @@

package firrtl2

import logger.LazyLogging
import firrtl2.ir._
import Implicits.{constraint2bound, constraint2width, width2constraint}
import firrtl2.constraint._
import firrtl2.logger.LazyLogging

/** Definitions and Utility functions for [[ir.PrimOp]]s */
object PrimOps extends LazyLogging {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/firrtl2/Utils.scala
Expand Up @@ -14,7 +14,7 @@ import scala.util.matching.Regex
import Implicits.{constraint2bound, constraint2width, width2constraint}
import firrtl2.constraint.{IsMax, IsMin}
import firrtl2.annotations.{ReferenceTarget, TargetToken}
import _root_.logger.LazyLogging
import firrtl2.logger.LazyLogging

object seqCat {
def apply(args: Seq[Expression]): Expression = args.length match {
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/firrtl2/annotations/JsonProtocol.scala
Expand Up @@ -4,11 +4,10 @@ package firrtl2
package annotations

import firrtl2.ir._
import firrtl2.logger.LazyLogging
import firrtl2.stage.AllowUnrecognizedAnnotations
import logger.LazyLogging

import scala.util.{Failure, Success, Try}

import org.json4s._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization
Expand Down
Expand Up @@ -6,14 +6,14 @@ package firrtl2.backends.experimental.smt
import firrtl2.annotations.{MemoryInitAnnotation, NoTargetAnnotation, PresetRegAnnotation}
import firrtl2._
import firrtl2.backends.experimental.smt.random._
import firrtl2.logger.LazyLogging
import firrtl2.options.Dependency
import firrtl2.passes.MemPortUtils.memPortField
import firrtl2.passes.PassException
import firrtl2.passes.memlib.VerilogMemDelays
import firrtl2.stage.Forms
import firrtl2.stage.TransformManager.TransformDependency
import firrtl2.transforms.{EnsureNamedStatements, PropagatePresetAnnotations}
import logger.LazyLogging

import scala.collection.mutable

Expand Down
@@ -1,12 +1,11 @@
// SPDX-License-Identifier: Apache-2.0

package logger
package firrtl2.logger

import java.io.{ByteArrayOutputStream, File, FileOutputStream, PrintStream}

import firrtl2.AnnotationSeq
import firrtl2.logger.phases.{AddDefaults, Checks}
import firrtl2.options.Viewer.view
import logger.phases.{AddDefaults, Checks}

import scala.util.DynamicVariable

Expand Down
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

package logger
package firrtl2.logger

import firrtl2.annotations.{Annotation, NoTargetAnnotation}
import firrtl2.options.{HasShellOptions, ShellOption}
Expand Down
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0

package logger
package firrtl2.logger

/** Internal options used to control the logging in programs that are part of the Chisel stack
*
* @param globalLogLevel the verbosity of logging (default: [[logger.LogLevel.None]])
* @param globalLogLevel the verbosity of logging (default: [[LogLevel.None]])
* @param classLogLevels the individual verbosity of logging for specific classes
* @param logToFile if true, log to a file
* @param logClassNames indicates logging verbosity on a class-by-class basis
Expand Down
@@ -1,3 +1,5 @@
package firrtl2

// SPDX-License-Identifier: Apache-2.0

import firrtl2.AnnotationSeq
Expand Down
@@ -1,12 +1,11 @@
// SPDX-License-Identifier: Apache-2.0

package logger.phases
package firrtl2.logger.phases

import firrtl2.AnnotationSeq
import firrtl2.logger.{LogLevelAnnotation, LoggerOption}
import firrtl2.options.Phase

import logger.{LogLevelAnnotation, LoggerOption}

/** Add default logger [[Annotation]]s */
private[logger] class AddDefaults extends Phase {

Expand Down
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: Apache-2.0

package logger.phases
package firrtl2.logger.phases

import firrtl2.AnnotationSeq
import firrtl2.annotations.Annotation
import firrtl2.logger.{LogFileAnnotation, LogLevelAnnotation, LoggerException}
import firrtl2.options.{Dependency, Phase}

import logger.{LogFileAnnotation, LogLevelAnnotation, LoggerException}

import scala.collection.mutable

/** Check that an [[firrtl2.AnnotationSeq AnnotationSeq]] has all necessary [[firrtl2.annotations.Annotation Annotation]]s
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/firrtl2/options/Phase.scala
Expand Up @@ -3,8 +3,7 @@
package firrtl2.options

import firrtl2.AnnotationSeq

import logger.LazyLogging
import firrtl2.logger.LazyLogging

import scala.collection.mutable.LinkedHashSet

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/firrtl2/options/Shell.scala
Expand Up @@ -3,8 +3,7 @@
package firrtl2.options

import firrtl2.AnnotationSeq

import logger.{ClassLogLevelAnnotation, LogClassNamesAnnotation, LogFileAnnotation, LogLevelAnnotation}
import firrtl2.logger.{ClassLogLevelAnnotation, LogClassNamesAnnotation, LogFileAnnotation, LogLevelAnnotation}

import scopt.OptionParser

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/firrtl2/options/Stage.scala
Expand Up @@ -3,8 +3,7 @@
package firrtl2.options

import firrtl2.AnnotationSeq

import logger.Logger
import firrtl2.logger.Logger

/** A [[Stage]] represents one stage in the FIRRTL hardware compiler framework. A [[Stage]] is, conceptually, a
* [[Phase]] that includes a command line interface.
Expand Down
Expand Up @@ -3,8 +3,7 @@
package firrtl2.stage.transforms

import firrtl2.Transform

import logger.Logger
import firrtl2.logger.Logger

/** A [[firrtl2.Transform]] that "wraps" a second [[firrtl2.Transform Transform]] to do some work before and after the
* second [[firrtl2.Transform Transform]].
Expand Down
Expand Up @@ -7,9 +7,8 @@ import java.nio.file.Files
import java.text.SimpleDateFormat
import java.util.Calendar

import logger.LazyLogging

import firrtl2.FileUtils
import firrtl2.logger.LazyLogging

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

Expand Down
Expand Up @@ -2,9 +2,9 @@

package firrtl2.backends.experimental.rtlil.end2end

import firrtl2.logger.LazyLogging
import firrtl2.stage.{FirrtlStage, OutputFileAnnotation}
import firrtl2.util.BackendCompilationUtilities
import logger.LazyLogging
import org.scalatest.flatspec.AnyFlatSpec

import java.io.File
Expand Down
Expand Up @@ -2,9 +2,9 @@

package firrtl2.backends.experimental.rtlil.end2end

import firrtl2.logger.LazyLogging
import firrtl2.stage.{FirrtlStage, OutputFileAnnotation}
import firrtl2.util.BackendCompilationUtilities
import logger.LazyLogging
import org.scalatest.flatspec.AnyFlatSpec

import java.io.File
Expand Down
Expand Up @@ -5,10 +5,10 @@ package firrtl2.backends.experimental.smt.end2end
import firrtl2.annotations.{Annotation, CircuitTarget, PresetAnnotation}
import firrtl2.backends.experimental.smt.random.{InvalidToRandomPass, UndefinedMemoryBehaviorPass}
import firrtl2.backends.experimental.smt.{Btor2Emitter, SMTLibEmitter}
import firrtl2.logger.{LazyLogging, LogLevel, LogLevelAnnotation}
import firrtl2.options.{Dependency, TargetDirAnnotation}
import firrtl2.stage.{FirrtlCircuitAnnotation, FirrtlStage, OutputFileAnnotation, RunFirrtlTransformAnnotation}
import firrtl2.util.BackendCompilationUtilities.timeStamp
import logger.{LazyLogging, LogLevel, LogLevelAnnotation}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.must.Matchers
import os._
Expand Down
Expand Up @@ -2,11 +2,11 @@

package firrtl2.backends.experimental.smt.end2end

import firrtl2.logger.LazyLogging
import java.io.File

import firrtl2.stage.{FirrtlStage, OutputFileAnnotation}
import firrtl2.util.BackendCompilationUtilities
import logger.LazyLogging
import org.scalatest.flatspec.AnyFlatSpec

import scala.sys.process.{Process, ProcessLogger}
Expand Down
3 changes: 1 addition & 2 deletions src/test/scala/firrtl2/testutils/FirrtlSpec.scala
Expand Up @@ -5,8 +5,6 @@ package firrtl2.testutils
import java.io._
import scala.sys.process._

import logger.{LazyLogging, LogLevel, LogLevelAnnotation}

import org.scalatest._
import org.scalatestplus.scalacheck._

Expand All @@ -17,6 +15,7 @@ import firrtl2.options.Dependency
import firrtl2.stage.{FirrtlFileAnnotation, InfoModeAnnotation, RunFirrtlTransformAnnotation}
import firrtl2.analyses.{GetNamespace, ModuleNamespaceAnnotation}
import firrtl2.annotations._
import firrtl2.logger.{LazyLogging, LogLevel, LogLevelAnnotation}
import firrtl2.transforms.{DontTouchAnnotation, NoDedupAnnotation, RenameModules}
import firrtl2.renamemap.MutableRenameMap
import firrtl2.util.BackendCompilationUtilities
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/firrtl2/testutils/LeanTransformSpec.scala
Expand Up @@ -2,11 +2,11 @@

package firrtl2.testutils

import firrtl2.logger.LazyLogging
import firrtl2.{ir, AnnotationSeq, CircuitState, EmitCircuitAnnotation}
import firrtl2.options.Dependency
import firrtl2.passes.RemoveEmpty
import firrtl2.stage.TransformManager.TransformDependency
import logger.LazyLogging
import org.scalatest.flatspec.AnyFlatSpec

class VerilogTransformSpec extends LeanTransformSpec(Seq(Dependency[firrtl2.VerilogEmitter]))
Expand Down
Expand Up @@ -8,7 +8,7 @@ import firrtl2.ir._
import firrtl2.options.Dependency
import firrtl2.transforms.DontTouchAnnotation
import scala.util.Failure
import _root_.logger.{LogLevel, LogLevelAnnotation, Logger}
import firrtl2.logger.{LogLevel, LogLevelAnnotation, Logger}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should._
import org.scalatest.Inside._
Expand Down
Expand Up @@ -4,12 +4,12 @@ package firrtlTests.annotationTests

import firrtl2.FileUtils
import firrtl2.annotations._
import firrtl2.logger.Logger
import firrtl2.passes.memlib.ReplSeqMemAnnotation
import firrtl2.stage.FirrtlMain
import firrtl2.testutils.FirrtlFlatSpec
import firrtl2.transforms.BlackBoxInlineAnno
import logger.Logger
import logger.Logger.OutputCaptor
import Logger.OutputCaptor
import org.json4s.convertToJsonInput

import java.io.{File, PrintWriter}
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/firrtlTests/formal/VerificationSpec.scala
Expand Up @@ -2,9 +2,9 @@

package firrtlTests.formal

import firrtl2.logger.{LogLevel, Logger}
import firrtl2.{ir, CircuitState, SystemVerilogCompiler}
import firrtl2.testutils.FirrtlFlatSpec
import logger.{LogLevel, Logger}
import firrtl2.options.Dependency
import firrtl2.stage.TransformManager

Expand Down
Expand Up @@ -9,9 +9,10 @@ import firrtl2.FileUtils
import firrtl2.testutils.LowTransformSpec
import firrtl2.stage._
import firrtl2.options.Dependency

import java.io.File
import firrtl2.util.BackendCompilationUtilities.createTestDirectory
import _root_.logger._
import firrtl2.logger.{LogLevel, LogLevelAnnotation}

class ChangeBlackBoxTargetDir extends Transform with DependencyAPIMigration {
override def prerequisites =
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/firrtlTests/transforms/MustDedupSpec.scala
Expand Up @@ -11,13 +11,13 @@ import firrtl2.graph.DiGraph
import firrtl2.analyses.InstanceKeyGraph
import firrtl2.annotations.CircuitTarget
import firrtl2.annotations.TargetToken.OfModule
import firrtl2.logger.{LogLevel, LogLevelAnnotation, Logger}
import firrtl2.transforms._
import firrtl2.transforms.MustDeduplicateTransform._
import firrtl2.transforms.MustDeduplicateTransform.DisjointChildren._
import firrtl2.util.BackendCompilationUtilities.createTestDirectory
import firrtl2.stage.{FirrtlSourceAnnotation, RunFirrtlTransformAnnotation}
import firrtl2.options.TargetDirAnnotation
import logger.{LogLevel, LogLevelAnnotation, Logger}

class MustDedupSpec extends AnyFeatureSpec with FirrtlMatchers with GivenWhenThen {

Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/loggertests/LoggerSpec.scala
Expand Up @@ -2,8 +2,8 @@

package loggertests

import logger.Logger.OutputCaptor
import logger.{LazyLogging, LogLevel, Logger}
import firrtl2.logger.{LazyLogging, LogLevel, Logger}
import firrtl2.logger.Logger.OutputCaptor
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
Expand Down

0 comments on commit 176a884

Please sign in to comment.