Skip to content

Commit

Permalink
Fft changes (#15)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
shunshou authored Mar 15, 2017
1 parent 164bf21 commit f7056f3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ClkSrcTransform extends Transform with SimpleRun {
InferTypes,
new CreateClkConstraints(clkModAnnos, clkPortAnnos, targetDir)
)
state.copy(state = runPasses(state.circuit, passSeq), outputForm = outputForm)
state.copy(circuit = runPasses(state.circuit, passSeq))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class CreateClkConstraints(
}).toSet

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)

Expand Down
11 changes: 5 additions & 6 deletions tapeout/src/main/scala/transforms/pads/AddIOPadsTransform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AddIOPadsTransform extends Transform with SimpleRun {
val collectedAnnos = HasPadAnnotation(getMyAnnotations(state))
collectedAnnos match {
// Transform not used
case None => CircuitState(state.circuit, LowForm)
case None => state
case Some(x) =>
val techLoc = (new TechnologyLocation).get(state)
// Get foundry pad templates from yaml
Expand Down Expand Up @@ -45,11 +45,10 @@ class AddIOPadsTransform extends Transform with SimpleRun {
)
// Expects BlackBox helper to be run after to inline pad Verilog!
val prevAnnos = state.annotations.getOrElse(AnnotationMap(Seq.empty)).annotations
val cs = CircuitState(
runPasses(circuitWithBBs, passSeq),
LowForm,
Some(AnnotationMap(prevAnnos ++ bbAnnotations))
)
val cs = state.copy(
circuit = runPasses(circuitWithBBs, passSeq),
annotations = Some(AnnotationMap(prevAnnos ++ bbAnnotations)))

// TODO: *.f file is overwritten on subsequent executions, but it doesn't seem to be used anywhere?
(new firrtl.transforms.BlackBoxSourceHelper).execute(cs)
}
Expand Down
16 changes: 9 additions & 7 deletions tapeout/src/main/scala/transforms/utils/ProgrammaticBundle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ package barstools.tapeout.transforms
import chisel3._
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 }: _*)
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]
}

final class CustomIndexedBundle(elts: (Int, Data)*) extends Record {
final class CustomIndexedBundle[T <: Data](elts: (Int, T)*) extends Record {
// Must be String, Data
val elements = ListMap(elts map { case (field, elt) => field.toString -> elt.chiselCloneType }: _*)
def indexedElements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*)
def apply(elt: Int): Data = elements(elt.toString)
// TODO: Make an equivalent to the below work publicly
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]
}

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
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 }: _*)
}
1 change: 0 additions & 1 deletion tapeout/src/test/scala/transforms/ResetInverterSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package barstools.tapeout.transforms

import chisel3._
import chisel3.util.RegInit
import firrtl._
import org.scalatest.{FreeSpec, Matchers}

Expand Down

0 comments on commit f7056f3

Please sign in to comment.