2012-03-25 00:56:59 +01:00
package rocket
import Chisel._
2012-10-02 01:08:41 +02:00
import uncore._
2012-11-18 02:24:08 +01:00
import Util._
2012-03-25 00:56:59 +01:00
2014-04-02 02:15:46 +02:00
case class RocketConfiguration ( tl : TileLinkConfiguration , as : AddressSpaceConfiguration ,
2012-11-16 11:39:33 +01:00
icache : ICacheConfig , dcache : DCacheConfig ,
2014-02-28 22:39:35 +01:00
fpu : Option [ FPUConfig ] = None ,
rocc : Option [ RocketConfiguration => RoCC ] = None ,
2014-01-25 01:36:36 +01:00
retireWidth : Int = 1 ,
2013-09-24 22:58:23 +02:00
vm : Boolean = true ,
2012-11-25 07:01:08 +01:00
fastLoadWord : Boolean = true ,
2013-01-06 12:47:17 +01:00
fastLoadByte : Boolean = false ,
fastMulDiv : Boolean = true )
2012-11-06 08:52:32 +01:00
{
2014-02-23 07:53:04 +01:00
val dcacheReqTagBits = 7 // enforce compliance with require()
2012-11-18 02:24:08 +01:00
val xprlen = 64
val nxpr = 32
val nxprbits = log2Up ( nxpr )
2012-11-25 07:01:08 +01:00
if ( fastLoadByte ) require ( fastLoadWord )
2012-11-06 08:52:32 +01:00
}
2012-11-05 01:59:36 +01:00
2014-01-21 21:08:42 +01:00
class Tile ( resetSignal : Bool = null ) ( confIn : RocketConfiguration ) extends Module ( _reset = resetSignal )
2012-03-25 00:56:59 +01:00
{
2013-11-06 02:12:09 +01:00
val memPorts = 2 + ! confIn . rocc . isEmpty // Number of ports to outer memory system from tile: 1 from I$, 1 from D$, maybe 1 from Rocc
2013-03-20 22:05:12 +01:00
val dcachePortId = 0
val icachePortId = 1
2013-11-06 02:12:09 +01:00
val roccPortId = 2
2013-09-25 20:51:10 +02:00
val dcachePorts = 2 + ! confIn . rocc . isEmpty // Number of ports into D$: 1 from core, 1 from PTW, maybe 1 from RoCC
2013-08-02 23:54:16 +02:00
implicit val tlConf = confIn . tl
implicit val lnConf = confIn . tl . ln
2013-08-12 19:39:11 +02:00
implicit val icConf = confIn . icache
2013-09-25 20:51:10 +02:00
implicit val dcConf = confIn . dcache . copy ( reqtagbits = confIn . dcacheReqTagBits + log2Up ( dcachePorts ) , databits = confIn . xprlen )
2012-11-06 08:52:32 +01:00
implicit val conf = confIn . copy ( dcache = dcConf )
2014-01-25 01:36:36 +01:00
require ( conf . retireWidth == 1 ) // for now...
2012-11-06 08:52:32 +01:00
2012-03-25 00:56:59 +01:00
val io = new Bundle {
2013-01-07 22:38:59 +01:00
val tilelink = new TileLinkIO
2013-03-01 06:03:37 +01:00
val host = new HTIFIO ( lnConf . nClients )
2012-03-25 00:56:59 +01:00
}
2012-11-06 08:52:32 +01:00
2013-08-12 19:39:11 +02:00
val core = Module ( new Core )
val icache = Module ( new Frontend )
val dcache = Module ( new HellaCache )
2013-11-06 02:12:09 +01:00
val ptw = Module ( new PTW ( if ( confIn . rocc . isEmpty ) 2 else 5 ) ) // 2 ports, 1 from I$, 1 from D$, maybe 3 from RoCC
2012-03-25 00:56:59 +01:00
2013-09-25 20:51:10 +02:00
val dcacheArb = Module ( new HellaCacheArbiter ( dcachePorts ) )
2013-09-13 07:34:38 +02:00
dcacheArb . io . requestor ( 0 ) <> ptw . io . mem
dcacheArb . io . requestor ( 1 ) <> core . io . dmem
dcache . io . cpu <> dcacheArb . io . mem
2012-03-25 00:56:59 +01:00
2013-09-13 07:34:38 +02:00
ptw . io . requestor ( 0 ) <> icache . io . cpu . ptw
ptw . io . requestor ( 1 ) <> dcache . io . cpu . ptw
2013-09-15 07:34:53 +02:00
core . io . host <> io . host
core . io . imem <> icache . io . cpu
core . io . ptw <> ptw . io . dpath
2013-09-13 07:34:38 +02:00
val memArb = Module ( new UncachedTileLinkIOArbiterThatAppendsArbiterId ( memPorts ) )
memArb . io . in ( dcachePortId ) <> dcache . io . mem
memArb . io . in ( icachePortId ) <> icache . io . mem
2013-11-06 02:12:09 +01:00
if ( ! conf . rocc . isEmpty ) {
val rocc = Module ( ( conf . rocc . get ) ( conf ) )
2014-01-17 01:01:41 +01:00
val dcIF = Module ( new SimpleHellaCacheIF )
dcIF . io . requestor <> rocc . io . mem
2013-11-06 02:12:09 +01:00
core . io . rocc <> rocc . io
2014-01-17 01:01:41 +01:00
dcacheArb . io . requestor ( 2 ) <> dcIF . io . cache
2013-11-06 02:12:09 +01:00
memArb . io . in ( roccPortId ) <> rocc . io . imem
ptw . io . requestor ( 2 ) <> rocc . io . iptw
ptw . io . requestor ( 3 ) <> rocc . io . dptw
ptw . io . requestor ( 4 ) <> rocc . io . pptw
}
2013-09-13 07:34:38 +02:00
io . tilelink . acquire <> memArb . io . out . acquire
memArb . io . out . grant <> io . tilelink . grant
io . tilelink . grant_ack <> memArb . io . out . grant_ack
2013-01-22 02:18:23 +01:00
dcache . io . mem . probe <> io . tilelink . probe
2014-03-29 18:59:07 +01:00
io . tilelink . release . valid : = dcache . io . mem . release . valid
dcache . io . mem . release . ready : = io . tilelink . release . ready
io . tilelink . release . bits : = dcache . io . mem . release . bits
io . tilelink . release . bits . payload . client_xact_id : = Cat ( dcache . io . mem . release . bits . payload . client_xact_id , UInt ( dcachePortId , log2Up ( memPorts ) ) ) // Mimic client id extension done by UncachedTileLinkIOArbiter for Acquires from either client)
2012-03-25 00:56:59 +01:00
}