Fft changes (#15)
* modified CustomBundle to also apply on Int * programmatic bundle should take T <: Data instead of Data * turns out indexedElements doesn't synthesize * had to change a bunch of files to get clk/pads compiling again with recent firrtl mods
This commit is contained in:
@@ -21,7 +21,7 @@ class ClkSrcTransform extends Transform with SimpleRun {
|
|||||||
InferTypes,
|
InferTypes,
|
||||||
new CreateClkConstraints(clkModAnnos, clkPortAnnos, targetDir)
|
new CreateClkConstraints(clkModAnnos, clkPortAnnos, targetDir)
|
||||||
)
|
)
|
||||||
state.copy(state = runPasses(state.circuit, passSeq), outputForm = outputForm)
|
state.copy(circuit = runPasses(state.circuit, passSeq))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class CreateClkConstraints(
|
|||||||
}).toSet
|
}).toSet
|
||||||
|
|
||||||
val inlineTransform = new InlineInstances
|
val inlineTransform = new InlineInstances
|
||||||
val inlinedCircuit = inlineTransform.run(onlyClockCircuit, modulesToInline, Set()).circuit
|
val inlinedCircuit = inlineTransform.run(onlyClockCircuit, modulesToInline, Set(), None).circuit
|
||||||
|
|
||||||
val topModule = inlinedCircuit.modules.find(_.name == top).getOrElse(throwInternalError)
|
val topModule = inlinedCircuit.modules.find(_.name == top).getOrElse(throwInternalError)
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class AddIOPadsTransform extends Transform with SimpleRun {
|
|||||||
val collectedAnnos = HasPadAnnotation(getMyAnnotations(state))
|
val collectedAnnos = HasPadAnnotation(getMyAnnotations(state))
|
||||||
collectedAnnos match {
|
collectedAnnos match {
|
||||||
// Transform not used
|
// Transform not used
|
||||||
case None => CircuitState(state.circuit, LowForm)
|
case None => state
|
||||||
case Some(x) =>
|
case Some(x) =>
|
||||||
val techLoc = (new TechnologyLocation).get(state)
|
val techLoc = (new TechnologyLocation).get(state)
|
||||||
// Get foundry pad templates from yaml
|
// Get foundry pad templates from yaml
|
||||||
@@ -45,11 +45,10 @@ class AddIOPadsTransform extends Transform with SimpleRun {
|
|||||||
)
|
)
|
||||||
// Expects BlackBox helper to be run after to inline pad Verilog!
|
// Expects BlackBox helper to be run after to inline pad Verilog!
|
||||||
val prevAnnos = state.annotations.getOrElse(AnnotationMap(Seq.empty)).annotations
|
val prevAnnos = state.annotations.getOrElse(AnnotationMap(Seq.empty)).annotations
|
||||||
val cs = CircuitState(
|
val cs = state.copy(
|
||||||
runPasses(circuitWithBBs, passSeq),
|
circuit = runPasses(circuitWithBBs, passSeq),
|
||||||
LowForm,
|
annotations = Some(AnnotationMap(prevAnnos ++ bbAnnotations)))
|
||||||
Some(AnnotationMap(prevAnnos ++ bbAnnotations))
|
|
||||||
)
|
|
||||||
// TODO: *.f file is overwritten on subsequent executions, but it doesn't seem to be used anywhere?
|
// TODO: *.f file is overwritten on subsequent executions, but it doesn't seem to be used anywhere?
|
||||||
(new firrtl.transforms.BlackBoxSourceHelper).execute(cs)
|
(new firrtl.transforms.BlackBoxSourceHelper).execute(cs)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,24 @@ package barstools.tapeout.transforms
|
|||||||
import chisel3._
|
import chisel3._
|
||||||
import scala.collection.immutable.ListMap
|
import scala.collection.immutable.ListMap
|
||||||
|
|
||||||
final class CustomBundle(elts: (String, Data)*) extends Record {
|
final class CustomBundle[T <: Data](elts: (String, T)*) extends Record {
|
||||||
val elements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*)
|
val elements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*)
|
||||||
def apply(elt: String): Data = elements(elt)
|
def apply(elt: String): T = elements(elt)
|
||||||
|
def apply(elt: Int): T = elements(elt.toString)
|
||||||
override def cloneType = (new CustomBundle(elements.toList: _*)).asInstanceOf[this.type]
|
override def cloneType = (new CustomBundle(elements.toList: _*)).asInstanceOf[this.type]
|
||||||
}
|
}
|
||||||
|
|
||||||
final class CustomIndexedBundle(elts: (Int, Data)*) extends Record {
|
final class CustomIndexedBundle[T <: Data](elts: (Int, T)*) extends Record {
|
||||||
// Must be String, Data
|
// Must be String, Data
|
||||||
val elements = ListMap(elts map { case (field, elt) => field.toString -> elt.chiselCloneType }: _*)
|
val elements = ListMap(elts map { case (field, elt) => field.toString -> elt.chiselCloneType }: _*)
|
||||||
def indexedElements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*)
|
// TODO: Make an equivalent to the below work publicly
|
||||||
def apply(elt: Int): Data = elements(elt.toString)
|
private def indexedElements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*)
|
||||||
|
def apply(elt: Int): T = elements(elt.toString)
|
||||||
override def cloneType = (new CustomIndexedBundle(indexedElements.toList: _*)).asInstanceOf[this.type]
|
override def cloneType = (new CustomIndexedBundle(indexedElements.toList: _*)).asInstanceOf[this.type]
|
||||||
}
|
}
|
||||||
|
|
||||||
object CustomIndexedBundle {
|
object CustomIndexedBundle {
|
||||||
def apply(gen: Data, idxs: Seq[Int]) = new CustomIndexedBundle(idxs.map(_ -> gen): _*)
|
def apply[T <: Data](gen: T, idxs: Seq[Int]) = new CustomIndexedBundle(idxs.map(_ -> gen): _*)
|
||||||
// Allows Vecs of elements of different types/widths
|
// Allows Vecs of elements of different types/widths
|
||||||
def apply(gen: Seq[Data]) = new CustomIndexedBundle(gen.zipWithIndex.map{ case (elt, field) => field -> elt }: _*)
|
def apply[T <: Data](gen: Seq[T]) = new CustomIndexedBundle(gen.zipWithIndex.map{ case (elt, field) => field -> elt }: _*)
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
package barstools.tapeout.transforms
|
package barstools.tapeout.transforms
|
||||||
|
|
||||||
import chisel3._
|
import chisel3._
|
||||||
import chisel3.util.RegInit
|
|
||||||
import firrtl._
|
import firrtl._
|
||||||
import org.scalatest.{FreeSpec, Matchers}
|
import org.scalatest.{FreeSpec, Matchers}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user