-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1213 from freechipsproject/driver-deprecations
Deprecate Driver methods in favor of ChiselStage
- Loading branch information
Showing
4 changed files
with
200 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// See LICENSE for license details. | ||
|
||
package chiselTests.stage | ||
|
||
import chisel3._ | ||
import chisel3.stage.ChiselStage | ||
|
||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
object ChiselStageSpec { | ||
|
||
class Foo extends MultiIOModule { | ||
val addr = IO(Input(UInt(4.W))) | ||
val out = IO(Output(Bool())) | ||
val bar = SyncReadMem(8, Bool()) | ||
out := bar(addr) | ||
} | ||
|
||
} | ||
|
||
class ChiselStageSpec extends FlatSpec with Matchers { | ||
|
||
import ChiselStageSpec._ | ||
|
||
private trait ChiselStageFixture { | ||
val stage = new ChiselStage | ||
} | ||
|
||
behavior of "ChiselStage.emitChirrtl" | ||
|
||
it should "return a CHIRRTL string" in new ChiselStageFixture { | ||
stage.emitChirrtl(new Foo) should include ("infer mport") | ||
} | ||
|
||
behavior of "ChiselStage.emitFirrtl" | ||
|
||
it should "return a High FIRRTL string" in new ChiselStageFixture { | ||
stage.emitFirrtl(new Foo) should include ("mem bar") | ||
} | ||
|
||
behavior of "ChiselStage.emitVerilog" | ||
|
||
it should "return a Verilog string" in new ChiselStageFixture { | ||
stage.emitVerilog(new Foo) should include ("endmodule") | ||
} | ||
|
||
behavior of "ChiselStage$.elaborate" | ||
|
||
it should "generate a Chisel circuit from a Chisel module" in { | ||
ChiselStage.elaborate(new Foo) | ||
} | ||
|
||
behavior of "ChiselStage$.convert" | ||
|
||
it should "generate a CHIRRTL circuit from a Chisel module" in { | ||
ChiselStage.convert(new Foo) | ||
} | ||
|
||
} |