Skip to content

Commit

Permalink
add point to point connection network
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqiz01 committed Jul 10, 2018
1 parent 36a033f commit 1a5e521
Show file tree
Hide file tree
Showing 46 changed files with 82 additions and 10 deletions.
8 changes: 0 additions & 8 deletions src/codegen/dot/NetworkDotCodegen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class NetworkDotCodegen[B<:PinType:ClassTag](val fileName:String)(implicit compi

import spademeta._

//lazy val dynamic = isDynamic(compiler.top)

def openDot = SpadeConfig.openDot

override def finPass = {
Expand All @@ -33,8 +31,6 @@ class NetworkDotCodegen[B<:PinType:ClassTag](val fileName:String)(implicit compi
attr.label(label)
}

//def shape(attr:DotAttr, n:Any) = attr.shape(box)

val scale = 5

def pos(attr:DotAttr, n:Any) = {
Expand Down Expand Up @@ -77,10 +73,6 @@ class NetworkDotCodegen[B<:PinType:ClassTag](val fileName:String)(implicit compi
override def emitNode(n:N) = {
n match {
case n:Top => super.visitNode(n)
//case n:ArgFringe if !dynamic =>
//emitNode(s"${n}_top",setAttrs((n, "top")))
//emitNode(s"${n}_bottom",setAttrs((n, "bottom")))
//nodes += n
case n:Routable => emitSingleNode(n)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/SpadeConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object SpadeConfig extends prism.GlobalConfig {
/* ------------------ Architecture parameters ---------------- */
register[Int]("word", default=32, info="Word width")
register[Int]("vec", default=16, info="Vector width of SIMD lanes and vector network")
register[String]("net", default="static", info="Network type [dynamic, static, asic]")
register[String]("net", default="static", info="Network type [dynamic, static, asic, p2p]")
register[String]("topo", default="mesh", info="Network topology [mesh, torus, cmesh]")
register[Int]("row", default=2, info="number of rows in network")
register[Int]("col", default=2, info="number of columns in network")
Expand Down
7 changes: 7 additions & 0 deletions src/node/SpadeNodeUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ trait SpadeNodeUtil {
case n => false
}

def isPointToPoint(n:Any):Boolean = n match {
case n:SpadeDesign => isPointToPoint(n.top)
case n:PointToPointTop => true
case n:PointToPointTopParam => true
case n => false
}

def cuOf(n:SpadeNode) = n.collectUp[CU]().headOption

def routableOf(n:SpadeNode) = n.collectUp[Routable]().headOption
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions src/node/top/PointToPointTop.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package spade
package node
import param._

case class PointToPointTop(
override val param:PointToPointTopParam
)(implicit design:SpadeDesign) extends GridTop {
import param._
import design.spademeta._

@transient val cuArray = List.tabulate(numCols, numRows) { case (i,j) =>
if (i == numCols/2-1 && j == numRows-1) {
bundleGroup(fringePattern.argFringeParam, coord=Some(i+fringeNumCols,j))
} else {
bundleGroup(
centrolPattern.cuAt(i,j),
coord=Some(i+fringeNumCols, j)
)
}
}

@transient val dagArray = fringePattern.dagParam.map { dagParam =>
List.tabulate(2, numRows) { case (i, j) =>
bundleGroup(
dagParam,
coord=Some(if (i==0) (1, j) else (numTotalCols-2, j))
)
}
}

@transient val mcArray = List.tabulate(2, numRows) { case (i, j) =>
bundleGroup(
fringePattern.mcParam,
coord=Some(if (i==0) (0,j) else (numTotalCols-1,j))
)
}

val networks = Nil

createSubmodules

override def minInputs[B<:PinType:ClassTag](param:Parameter) = 1000

override def maxInputs[B<:PinType:ClassTag](param:Parameter) = 1000

override def minOutputs[B<:PinType:ClassTag](param:Parameter) = 1000

override def maxOutputs[B<:PinType:ClassTag](param:Parameter) = 1000
}

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/node/Top.scala → src/node/top/Top.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait Top extends Module {
}

def createSubmodules = {
paramMap.head._2.keys.foreach(checkParam)
paramMap.headOption.foreach { _._2.keys.foreach(checkParam) }
bundleGroups.foreach { case b@BundleGroup(param, coord) =>
val m = Module(Factory.create(param, b.bundles))
coord.foreach { coord => indexOf(m) = coord }
Expand Down
1 change: 1 addition & 0 deletions src/param/DefaultParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ trait DefaultParams {
case ("torus" , "dynamic") => DynamicGridTopParam()
case ("cmesh" , "dynamic") => DynamicCMeshTopParam()
case (_ , "asic") => AsicTopParam()
case (_ , "p2p") => PointToPointTopParam()
case _ => StaticGridTopParam()
}
}
Expand Down
1 change: 1 addition & 0 deletions src/param/Factory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ object Factory extends Logging {
case param:StaticCMeshTopParam => StaticCMeshTop(param)
case param:DynamicCMeshTopParam => DynamicCMeshTop(param)
case param:AsicTopParam => AsicTop(param)
case param:PointToPointTopParam => PointToPointTop(param)
}
def create(param:Parameter, nios:List[Bundle[_<:PinType]])(implicit design:SpadeDesign):Routable = param match {
case param:PCUParam => PCU(param, nios)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions src/param/top/PointToPointTopParam.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package spade
package param

import SpadeConfig._
case class PointToPointTopParam(
numRows:Int=option[Int]("row"),
numCols:Int=option[Int]("col"),
centrolPattern:GridCentrolPattern=defaultCentrolPattern,
fringePattern:GridFringePattern=defaultFringePattern
) extends GridTopParam {
val busWithReady = true
val fringeNumCols = fringePattern match {
case _:MCOnly => 1
case _:MC_DramAG => 2
}
// Oneside
val numTotalRows = numRows
val numTotalCols = numCols+fringeNumCols*2
val networkParams = Nil
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1a5e521

Please sign in to comment.