Skip to content

Commit

Permalink
add smoketest
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jan 22, 2024
1 parent 8dd26dd commit 4694f41
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 45 deletions.
16 changes: 0 additions & 16 deletions lit/tests/CompilerPlugin/WithCompilerPlugin.sc

This file was deleted.

12 changes: 0 additions & 12 deletions lit/tests/CompilerPlugin/WithoutCompilerPlugin.sc

This file was deleted.

17 changes: 0 additions & 17 deletions lit/tests/PanamaConverter/BindingSpec.sc

This file was deleted.

48 changes: 48 additions & 0 deletions lit/tests/SomkeTest.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// RUN: not scala-cli --server=false --java-home=%JAVAHOME --extra-jars=%RUNCLASSPATH --scala-version=%SCALAVERSION %s -- chirrtl 2>&1 | FileCheck %s -check-prefix=NO-COMPILER-PLUGIN
// RUN: scala-cli --server=false --java-home=%JAVAHOME --extra-jars=%RUNCLASSPATH --scala-version=%SCALAVERSION --scala-option="-Xplugin:%SCALAPLUGINJARS" %s -- chirrtl | FileCheck %s -check-prefix=SFC-FIRRTL
// RUN: scala-cli --server=false --java-home=%JAVAHOME --extra-jars=%RUNCLASSPATH --scala-version=%SCALAVERSION --scala-option="-Xplugin:%SCALAPLUGINJARS" %s -- chirrtl | firtool -format=fir | FileCheck %s -check-prefix=VERILOG
// RUN: scala-cli --server=false --java-home=%JAVAHOME --extra-jars=%RUNCLASSPATH --scala-version=%SCALAVERSION --scala-option="-Xplugin:%SCALAPLUGINJARS" --java-opt="--enable-native-access=ALL-UNNAMED" --java-opt="--enable-preview" --java-opt="-Djava.library.path=%JAVALIBRARYPATH" %s -- panama-firrtl | FileCheck %s -check-prefix=MFC-FIRRTL
// RUN: scala-cli --server=false --java-home=%JAVAHOME --extra-jars=%RUNCLASSPATH --scala-version=%SCALAVERSION --scala-option="-Xplugin:%SCALAPLUGINJARS" --java-opt="--enable-native-access=ALL-UNNAMED" --java-opt="--enable-preview" --java-opt="-Djava.library.path=%JAVALIBRARYPATH" %s -- panama-verilog | FileCheck %s -check-prefix=VERILOG

import chisel3._

class FooBundle extends Bundle {
val foo = Input(UInt(3.W))
}

// SFC-FIRRTL-LABEL: circuit FooModule :
// SFC-FIRRTL-NEXT: module FooModule :
// SFC-FIRRTL-NEXT: input clock : Clock
// SFC-FIRRTL-NEXT: input reset : UInt<1>
// SFC-FIRRTL-NEXT: output io : { flip foo : UInt<3>}
// SFC-FIRRTL: skip

// MFC-FIRRTL-LABEL: circuit FooModule :
// MFC-FIRRTL-NEXT: module FooModule :
// MFC-FIRRTL-NEXT: input clock : Clock
// MFC-FIRRTL-NEXT: input reset : UInt<1>
// MFC-FIRRTL-NEXT: output io : { flip foo : UInt<3> }

// VERILOG-LABEL: module FooModule(
// VERILOG-NEXT: input clock,
// VERILOG-NEXT: reset,
// VERILOG-NEXT: input [2:0] io_foo
// VERILOG-NEXT: );

// NO-COMPILER-PLUGIN-LABEL: assertion failed: The Chisel compiler plugin is now required for compiling Chisel code.

class FooModule extends Module {
val io = IO(new FooBundle)
}

args.head match {
case "chirrtl" => {
print(circt.stage.ChiselStage.emitCHIRRTL(new FooModule))
}
case "panama-firrtl" => {
print(lit.utility.panamaconverter.firrtlString(new FooModule))
}
case "panama-verilog" => {
print(lit.utility.panamaconverter.verilogString(new FooModule))
}
}

0 comments on commit 4694f41

Please sign in to comment.