From 27b0dd8abe69fc85922d5fec1aea046993e19875 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 22 Feb 2023 11:11:06 -0800 Subject: [PATCH 1/4] Remove TLHelper, directly use tilelink node constructors TLHelper 1) obfuscates the underlying node architecture and 2) results in otherwise unnecessary dependencies on testchipip --- docs/Customization/DMA-Devices.rst | 2 +- .../NodeTypes.rst | 9 +++----- .../src/main/scala/example/InitZero.scala | 6 ++--- .../src/main/scala/example/NodeTypes.scala | 23 ++++++++++--------- generators/gemmini | 2 +- generators/icenet | 2 +- generators/testchipip | 2 +- 7 files changed, 22 insertions(+), 24 deletions(-) diff --git a/docs/Customization/DMA-Devices.rst b/docs/Customization/DMA-Devices.rst index d87b49aa..77907ec2 100644 --- a/docs/Customization/DMA-Devices.rst +++ b/docs/Customization/DMA-Devices.rst @@ -20,7 +20,7 @@ that writes zeros to the memory at a configured address. :start-after: DOC include start: DigitalTop :end-before: DOC include end: DigitalTop -We use ``TLHelper.makeClientNode`` to create a TileLink client node for us. +We use ``TLClientNode`` to create a TileLink client node for us. We then connect the client node to the memory system through the front bus (fbus). For more info on creating TileLink client nodes, take a look at :ref:`TileLink-Diplomacy-Reference/NodeTypes:Client Node`. diff --git a/docs/TileLink-Diplomacy-Reference/NodeTypes.rst b/docs/TileLink-Diplomacy-Reference/NodeTypes.rst index 74fe7854..c31aafba 100644 --- a/docs/TileLink-Diplomacy-Reference/NodeTypes.rst +++ b/docs/TileLink-Diplomacy-Reference/NodeTypes.rst @@ -16,8 +16,7 @@ on the C channel, and send grant acknowledgements on the E channel. The L1 caches and DMA devices in RocketChip/Chipyard have client nodes. -You can add a TileLink client node to your LazyModule using the TLHelper -object from testchipip like so: +You can add a TileLink client node to your LazyModule like so: .. literalinclude:: ../../generators/chipyard/src/main/scala/example/NodeTypes.scala :language: scala @@ -48,8 +47,7 @@ generators optimize the hardware by not arbitrating the client to managers with address ranges that don't overlap with its visibility. Inside your lazy module implementation, you can call ``node.out`` to get a -list of bundle/edge pairs. If you used the TLHelper, you only specified a -single client edge, so this list will only have one pair. +list of bundle/edge pairs. The ``tl`` bundle is a Chisel hardware bundle that connects to the IO of this module. It contains two (in the case of TL-UL and TL-UH) or five (in the case @@ -65,8 +63,7 @@ Manager Node ------------ TileLink managers take requests from clients on the A channel and send -responses back on the D channel. You can create a manager node using the -TLHelper like so: +responses back on the D channel. You can create a manager like so: .. literalinclude:: ../../generators/chipyard/src/main/scala/example/NodeTypes.scala :language: scala diff --git a/generators/chipyard/src/main/scala/example/InitZero.scala b/generators/chipyard/src/main/scala/example/InitZero.scala index a9885d34..5051c37d 100644 --- a/generators/chipyard/src/main/scala/example/InitZero.scala +++ b/generators/chipyard/src/main/scala/example/InitZero.scala @@ -5,14 +5,14 @@ import chisel3.util._ import freechips.rocketchip.subsystem.{BaseSubsystem, CacheBlockBytes} import freechips.rocketchip.config.{Parameters, Field, Config} import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, IdRange} -import testchipip.TLHelper +import freechips.rocketchip.tilelink._ case class InitZeroConfig(base: BigInt, size: BigInt) case object InitZeroKey extends Field[Option[InitZeroConfig]](None) class InitZero(implicit p: Parameters) extends LazyModule { - val node = TLHelper.makeClientNode( - name = "init-zero", sourceId = IdRange(0, 1)) + val node = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLClientParameters( + name = "init-zero", sourceId = IdRange(0, 1)))))) lazy val module = new InitZeroModuleImp(this) } diff --git a/generators/chipyard/src/main/scala/example/NodeTypes.scala b/generators/chipyard/src/main/scala/example/NodeTypes.scala index 914e5ba5..cafc470f 100644 --- a/generators/chipyard/src/main/scala/example/NodeTypes.scala +++ b/generators/chipyard/src/main/scala/example/NodeTypes.scala @@ -3,7 +3,6 @@ package chipyard.example import freechips.rocketchip.config.Parameters import freechips.rocketchip.diplomacy._ import freechips.rocketchip.tilelink._ -import testchipip.TLHelper // These modules are not meant to be synthesized. // They are used as examples in the documentation and are only here @@ -11,11 +10,11 @@ import testchipip.TLHelper // DOC include start: MyClient class MyClient(implicit p: Parameters) extends LazyModule { - val node = TLHelper.makeClientNode(TLMasterParameters.v1( + val node = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLClientParameters( name = "my-client", sourceId = IdRange(0, 4), requestFifo = true, - visibility = Seq(AddressSet(0x10000, 0xffff)))) + visibility = Seq(AddressSet(0x10000, 0xffff))))))) lazy val module = new LazyModuleImp(this) { val (tl, edge) = node.out(0) @@ -29,7 +28,7 @@ class MyClient(implicit p: Parameters) extends LazyModule { class MyManager(implicit p: Parameters) extends LazyModule { val device = new SimpleDevice("my-device", Seq("tutorial,my-device0")) val beatBytes = 8 - val node = TLHelper.makeManagerNode(beatBytes, TLSlaveParameters.v1( + val node = TLManagerNode(Seq(TLSlavePortParameters.v1(Seq(TLManagerParameters( address = Seq(AddressSet(0x20000, 0xfff)), resources = device.reg, regionType = RegionType.UNCACHED, @@ -40,7 +39,7 @@ class MyManager(implicit p: Parameters) extends LazyModule { supportsPutFull = TransferSizes(1, beatBytes), supportsPutPartial = TransferSizes(1, beatBytes), supportsHint = TransferSizes(1, beatBytes), - fifoId = Some(0))) + fifoId = Some(0))), beatBytes))) lazy val module = new LazyModuleImp(this) { val (tl, edge) = node.in(0) @@ -50,7 +49,8 @@ class MyManager(implicit p: Parameters) extends LazyModule { // DOC include start: MyClient1+MyClient2 class MyClient1(implicit p: Parameters) extends LazyModule { - val node = TLHelper.makeClientNode("my-client1", IdRange(0, 1)) + val node = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLClientParameters( + "my-client1", IdRange(0, 1)))))) lazy val module = new LazyModuleImp(this) { // ... @@ -58,7 +58,8 @@ class MyClient1(implicit p: Parameters) extends LazyModule { } class MyClient2(implicit p: Parameters) extends LazyModule { - val node = TLHelper.makeClientNode("my-client2", IdRange(0, 1)) + val node = TLClientNode(Seq(TLMasterPortParameters.v1(Seq(TLClientParameters( + "my-client2", IdRange(0, 1)))))) lazy val module = new LazyModuleImp(this) { // ... @@ -83,8 +84,8 @@ class MyClientGroup(implicit p: Parameters) extends LazyModule { // DOC include start: MyManagerGroup class MyManager1(beatBytes: Int)(implicit p: Parameters) extends LazyModule { - val node = TLHelper.makeManagerNode(beatBytes, TLSlaveParameters.v1( - address = Seq(AddressSet(0x0, 0xfff)))) + val node = TLManagerNode(Seq(TLSlavePortParameters.v1(Seq(TLManagerParameters( + address = Seq(AddressSet(0x0, 0xfff)))), beatBytes))) lazy val module = new LazyModuleImp(this) { // ... @@ -92,8 +93,8 @@ class MyManager1(beatBytes: Int)(implicit p: Parameters) extends LazyModule { } class MyManager2(beatBytes: Int)(implicit p: Parameters) extends LazyModule { - val node = TLHelper.makeManagerNode(beatBytes, TLSlaveParameters.v1( - address = Seq(AddressSet(0x1000, 0xfff)))) + val node = TLManagerNode(Seq(TLSlavePortParameters.v1(Seq(TLManagerParameters( + address = Seq(AddressSet(0x1000, 0xfff)))), beatBytes))) lazy val module = new LazyModuleImp(this) { // ... diff --git a/generators/gemmini b/generators/gemmini index b6389f3e..9e478ecc 160000 --- a/generators/gemmini +++ b/generators/gemmini @@ -1 +1 @@ -Subproject commit b6389f3ea7bbf070aa3dd40972daa5be7e2d4261 +Subproject commit 9e478ecce9e48bbc03b9bd3535d71e03a6269fba diff --git a/generators/icenet b/generators/icenet index fb23840e..90d52a6a 160000 --- a/generators/icenet +++ b/generators/icenet @@ -1 +1 @@ -Subproject commit fb23840eab7a33249eaa23cad7bed4137055e8dd +Subproject commit 90d52a6a8435c862e6435d04436f587c3b36c8c0 diff --git a/generators/testchipip b/generators/testchipip index 2906d503..6a2bc7c0 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit 2906d503cf6df42e5b6da576ff9e67d0c65368bc +Subproject commit 6a2bc7c036ea99264a99b62952552b19762fe667 From 25bd76cf06b6f31ff3d5952ab0d6a18b9f883e75 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 22 Feb 2023 11:36:37 -0800 Subject: [PATCH 2/4] Remove build.sbt from gemmini/icenet deps --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index e8f999c0..67116796 100644 --- a/build.sbt +++ b/build.sbt @@ -170,7 +170,7 @@ lazy val tracegen = (project in file("generators/tracegen")) .settings(commonSettings) lazy val icenet = (project in file("generators/icenet")) - .dependsOn(testchipip, rocketchip) + .dependsOn(rocketchip) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) @@ -206,7 +206,7 @@ lazy val sha3 = (project in file("generators/sha3")) .settings(commonSettings) lazy val gemmini = (project in file("generators/gemmini")) - .dependsOn(testchipip, rocketchip) + .dependsOn(rocketchip) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(chiselTestSettings) .settings(commonSettings) From f8fb8f38d80635e2709910a16685a30987f40d36 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 22 Feb 2023 14:49:43 -0800 Subject: [PATCH 3/4] Bump testchipip --- generators/testchipip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/testchipip b/generators/testchipip index 6a2bc7c0..6e8a6842 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit 6a2bc7c036ea99264a99b62952552b19762fe667 +Subproject commit 6e8a68424216c9a02916af16a15850f40a534a22 From 46225436c02893d0f170f20d76eabf3f2c2c00ba Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 22 Feb 2023 15:17:39 -0800 Subject: [PATCH 4/4] Update tutorial patches --- scripts/tutorial-patches/build.sbt.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tutorial-patches/build.sbt.patch b/scripts/tutorial-patches/build.sbt.patch index 74795d3c..db81b052 100644 --- a/scripts/tutorial-patches/build.sbt.patch +++ b/scripts/tutorial-patches/build.sbt.patch @@ -27,4 +27,4 @@ index ec36a85f..c0c2849a 100644 +// .settings(commonSettings) lazy val gemmini = (project in file("generators/gemmini")) - .dependsOn(testchipip, rocketchip) + .dependsOn(rocketchip)