1
0

tilelink2: add an intermediate type for simple factories

This commit is contained in:
Wesley W. Terpstra 2016-08-29 17:53:31 -07:00
parent 967d8f108c
commit 5f7711a0c0
4 changed files with 9 additions and 3 deletions

View File

@ -39,6 +39,12 @@ abstract class TLFactory
} }
} }
// Use this if you have only one node => makes factory adapters possible
abstract class TLSimpleFactory extends TLFactory
{
def node: TLBaseNode
}
abstract class TLModule(factory: TLFactory) extends Module abstract class TLModule(factory: TLFactory) extends Module
{ {
override def desiredName = factory.getClass.getName.split('.').last override def desiredName = factory.getClass.getName.split('.').last

View File

@ -59,7 +59,7 @@ object TLRegisterNode
// register mapped device from a totally abstract register mapped device. // register mapped device from a totally abstract register mapped device.
// See GPIO.scala in this directory for an example // See GPIO.scala in this directory for an example
abstract class TLRegFactory(address: AddressSet, concurrency: Option[Int], beatBytes: Int) extends TLFactory abstract class TLRegFactory(address: AddressSet, concurrency: Option[Int], beatBytes: Int) extends TLSimpleFactory
{ {
val node = TLRegisterNode(address, concurrency, beatBytes) val node = TLRegisterNode(address, concurrency, beatBytes)
} }

View File

@ -4,7 +4,7 @@ package uncore.tilelink2
import Chisel._ import Chisel._
class TLRAM(address: AddressSet, beatBytes: Int = 4) extends TLFactory class TLRAM(address: AddressSet, beatBytes: Int = 4) extends TLSimpleFactory
{ {
val node = TLManagerNode(beatBytes, TLManagerParameters( val node = TLManagerNode(beatBytes, TLManagerParameters(
address = List(address), address = List(address),

View File

@ -13,7 +13,7 @@ object TLXbar
} }
} }
class TLXbar(policy: (Vec[Bool], Bool) => Seq[Bool] = TLXbar.lowestIndex) extends TLFactory class TLXbar(policy: (Vec[Bool], Bool) => Seq[Bool] = TLXbar.lowestIndex) extends TLSimpleFactory
{ {
def mapInputIds (ports: Seq[TLClientPortParameters ]) = assignRanges(ports.map(_.endSourceId)) def mapInputIds (ports: Seq[TLClientPortParameters ]) = assignRanges(ports.map(_.endSourceId))
def mapOutputIds(ports: Seq[TLManagerPortParameters]) = assignRanges(ports.map(_.endSinkId)) def mapOutputIds(ports: Seq[TLManagerPortParameters]) = assignRanges(ports.map(_.endSinkId))