Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip Object and Outer Class from desiredName #1194

Merged
merged 1 commit into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chiselFrontend/src/main/scala/chisel3/Module.scala
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ package experimental {
/** Desired name of this module. Override this to give this module a custom, perhaps parametric,
* name.
*/
def desiredName: String = this.getClass.getName.split('.').last
def desiredName: String = this.getClass.getName.split("\\.|\\$").last

/** Legalized name of this module. */
final lazy val name = try {
Expand Down
16 changes: 8 additions & 8 deletions src/test/scala/chiselTests/DataPrint.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ class DataPrintSpec extends ChiselFlatSpec with Matchers {
}

class BoundDataModule extends MultiIOModule { // not in the test to avoid anon naming suffixes
Wire(UInt()).toString should be("UInt(Wire in DataPrintSpec$BoundDataModule)")
Reg(SInt()).toString should be("SInt(Reg in DataPrintSpec$BoundDataModule)")
Wire(UInt()).toString should be("UInt(Wire in BoundDataModule)")
Reg(SInt()).toString should be("SInt(Reg in BoundDataModule)")
val io = IO(Output(Bool())) // needs a name so elaboration doesn't fail
io.toString should be("Bool(IO in unelaborated DataPrintSpec$BoundDataModule)")
io.toString should be("Bool(IO in unelaborated BoundDataModule)")
val m = Mem(4, UInt(2.W))
m(2).toString should be("UInt<2>(MemPort in DataPrintSpec$BoundDataModule)")
(2.U + 2.U).toString should be("UInt<2>(OpResult in DataPrintSpec$BoundDataModule)")
Wire(Vec(3, UInt(2.W))).toString should be ("UInt<2>[3](Wire in DataPrintSpec$BoundDataModule)")
m(2).toString should be("UInt<2>(MemPort in BoundDataModule)")
(2.U + 2.U).toString should be("UInt<2>(OpResult in BoundDataModule)")
Wire(Vec(3, UInt(2.W))).toString should be ("UInt<2>[3](Wire in BoundDataModule)")

class InnerModule extends MultiIOModule {
val io = IO(Output(new Bundle {
val a = UInt(4.W)
}))
}
val inner = Module(new InnerModule)
inner.clock.toString should be ("Clock(IO clock in DataPrintSpec$BoundDataModule$InnerModule)")
inner.io.a.toString should be ("UInt<4>(IO io_a in DataPrintSpec$BoundDataModule$InnerModule)")
inner.clock.toString should be ("Clock(IO clock in InnerModule)")
inner.io.a.toString should be ("UInt<4>(IO io_a in InnerModule)")
}

"Bound data types" should "have a meaningful string representation" in {
Expand Down