diff options
| author | Aditya Naik | 2023-11-23 03:11:56 -0800 |
|---|---|---|
| committer | Aditya Naik | 2023-11-23 03:11:56 -0800 |
| commit | af415532cf160e63e971ceb301833b8433c18a50 (patch) | |
| tree | 1fef70139846f57298c8e24a590490a74249f7dd /src/test/scala/chiselTests/DataPrint.scala | |
| parent | 8200c0cdf1d471453946d5ae24bc99757b2ef02d (diff) | |
cleanup
Diffstat (limited to 'src/test/scala/chiselTests/DataPrint.scala')
| -rw-r--r-- | src/test/scala/chiselTests/DataPrint.scala | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/src/test/scala/chiselTests/DataPrint.scala b/src/test/scala/chiselTests/DataPrint.scala deleted file mode 100644 index 82fa1519..00000000 --- a/src/test/scala/chiselTests/DataPrint.scala +++ /dev/null @@ -1,116 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -package chiselTests - -import org.scalatest._ - -import chisel3._ -import chisel3.experimental.FixedPoint -import chisel3.experimental.BundleLiterals._ -import chisel3.stage.ChiselStage -import org.scalatest.matchers.should.Matchers - -class DataPrintSpec extends ChiselFlatSpec with Matchers { - object EnumTest extends ChiselEnum { - val sNone, sOne, sTwo = Value - } - - class BundleTest extends Bundle { - val a = UInt(8.W) - val b = Bool() - } - - class PartialBundleTest extends Bundle { - val a = UInt(8.W) - val b = Bool() - val c = SInt(8.W) - val e = FixedPoint(5.W, 3.BP) - val f = EnumTest.Type() - } - - "Data types" should "have a meaningful string representation" in { - ChiselStage.elaborate { - new RawModule { - UInt().toString should be("UInt") - UInt(8.W).toString should be("UInt<8>") - SInt(15.W).toString should be("SInt<15>") - Bool().toString should be("Bool") - Clock().toString should be("Clock") - FixedPoint(5.W, 3.BP).toString should be("FixedPoint<5><<3>>") - Vec(3, UInt(2.W)).toString should be("UInt<2>[3]") - EnumTest.Type().toString should be("EnumTest") - (new BundleTest).toString should be("BundleTest") - new Bundle { val a = UInt(8.W) }.toString should be("AnonymousBundle") - new Bundle { val a = UInt(8.W) }.a.toString should be("UInt<8>") - } - } - } - - class BoundDataModule extends Module { // not in the test to avoid anon naming suffixes - Wire(UInt()).toString should be("BoundDataModule.?: Wire[UInt]") - Reg(SInt()).toString should be("BoundDataModule.?: Reg[SInt]") - val io = IO(Output(Bool())) // needs a name so elaboration doesn't fail - io.toString should be("BoundDataModule.io: IO[Bool]") - val m = Mem(4, UInt(2.W)) - m(2).toString should be("BoundDataModule.?: MemPort[UInt<2>]") - (2.U + 2.U).toString should be("BoundDataModule.?: OpResult[UInt<2>]") - Wire(Vec(3, UInt(2.W))).toString should be("BoundDataModule.?: Wire[UInt<2>[3]]") - - class InnerModule extends Module { - val io = IO(Output(new Bundle { - val a = UInt(4.W) - })) - } - val inner = Module(new InnerModule) - inner.clock.toString should be("InnerModule.clock: IO[Clock]") - inner.io.a.toString should be("InnerModule.io.a: IO[UInt<4>]") - - class FooTypeTest extends Bundle { - val foo = Vec(2, UInt(8.W)) - val fizz = UInt(8.W) - } - val tpe = new FooTypeTest - val fooio: FooTypeTest = IO(Input(tpe)) - fooio.foo(0).toString should be("BoundDataModule.fooio.foo[0]: IO[UInt<8>]") - - class NestedBundle extends Bundle { - val nestedFoo = UInt(8.W) - val nestedFooVec = Vec(2, UInt(8.W)) - } - class NestedType extends Bundle { - val foo = new NestedBundle - } - - val nestedTpe = new NestedType - val nestedio = IO(Input(nestedTpe)) - (nestedio.foo.nestedFoo.toString should be("BoundDataModule.nestedio.foo.nestedFoo: IO[UInt<8>]")) - (nestedio.foo.nestedFooVec(0).toString should be("BoundDataModule.nestedio.foo.nestedFooVec[0]: IO[UInt<8>]")) - } - - "Bound data types" should "have a meaningful string representation" in { - ChiselStage.elaborate { new BoundDataModule } - } - - "Literals" should "have a meaningful string representation" in { - ChiselStage.elaborate { - new RawModule { - 3.U.toString should be("UInt<2>(3)") - 3.U(5.W).toString should be("UInt<5>(3)") - -1.S.toString should be("SInt<1>(-1)") - false.B.toString should be("Bool(false)") - true.B.toString should be("Bool(true)") - 2.25.F(6.W, 2.BP).toString should be("FixedPoint<6><<2>>(2.25)") - -2.25.F(6.W, 2.BP).toString should be("FixedPoint<6><<2>>(-2.25)") - Vec(3, UInt(4.W)).toString should be("UInt<4>[3]") - EnumTest.sNone.toString should be("EnumTest(0=sNone)") - EnumTest.sTwo.toString should be("EnumTest(2=sTwo)") - EnumTest(1.U).toString should be("EnumTest(1=sOne)") - (new BundleTest).Lit(_.a -> 2.U, _.b -> false.B).toString should be("BundleTest(a=UInt<8>(2), b=Bool(false))") - (new PartialBundleTest).Lit().toString should be( - "PartialBundleTest(a=UInt<8>(DontCare), b=Bool(DontCare), c=SInt<8>(DontCare), e=FixedPoint<5><<3>>(DontCare), f=EnumTest(DontCare))" - ) - DontCare.toString should be("DontCare()") - } - } - } -} |
