Fft changes (#17)

* 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

* 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

* clk phases should be less than divby amount

* make clkconstraint error more descriptive

* don't make custom*bundle final

* nevermind. bundles need to be final.

* turns out making the bundle non-final was ok...

* removed infertypes from clksrctransform. seems like it doesn't work @ low firrtl?
This commit is contained in:
Angie Wang
2017-04-02 03:49:49 -07:00
committed by GitHub
parent f4a8715fa4
commit 5574354f55
4 changed files with 12 additions and 7 deletions

View File

@@ -72,6 +72,9 @@ class SEClkDivider(divBy: Int, phases: Seq[Int], analogFile: String = "", syncRe
extends Module with IsClkModule { extends Module with IsClkModule {
require(phases.distinct.length == phases.length, "Phases should be distinct!") require(phases.distinct.length == phases.length, "Phases should be distinct!")
phases foreach { p =>
require(p < divBy, "Phases must be < divBy")
}
val io = IO(new SEClkDividerIO(phases)) val io = IO(new SEClkDividerIO(phases))

View File

@@ -18,7 +18,8 @@ class ClkSrcTransform extends Transform with SimpleRun {
case Some((clkModAnnos, clkPortAnnos)) => case Some((clkModAnnos, clkPortAnnos)) =>
val targetDir = barstools.tapeout.transforms.GetTargetDir(state) val targetDir = barstools.tapeout.transforms.GetTargetDir(state)
val passSeq = Seq( val passSeq = Seq(
InferTypes, // TODO: Enable when it's legal?
// InferTypes,
new CreateClkConstraints(clkModAnnos, clkPortAnnos, targetDir) new CreateClkConstraints(clkModAnnos, clkPortAnnos, targetDir)
) )
state.copy(circuit = runPasses(state.circuit, passSeq)) state.copy(circuit = runPasses(state.circuit, passSeq))

View File

@@ -117,7 +117,7 @@ class CreateClkConstraints(
// sources of sinks are generated clks or top level clk inputs // sources of sinks are generated clks or top level clk inputs
if (clkSrcsFlip.contains(sourceAbsPath)) clkSrcsFlip(sourceAbsPath) if (clkSrcsFlip.contains(sourceAbsPath)) clkSrcsFlip(sourceAbsPath)
else if (topClksFlip.contains(sourceAbsPath)) topClksFlip(sourceAbsPath) else if (topClksFlip.contains(sourceAbsPath)) topClksFlip(sourceAbsPath)
else throw new Exception(s"Absolute path of clk source for $sinkId not found!") else throw new Exception(s"Absolute path $sourceAbsPath of clk source for $sinkId not found!")
} }
sinkId -> sourceId sinkId -> sourceId
} }
@@ -131,7 +131,8 @@ class CreateClkConstraints(
clkPortAnnos.find(x => clkPortAnnos.find(x =>
// TODO: Not sufficiently general for output clks? Might have forgotten to label a clk module... // TODO: Not sufficiently general for output clks? Might have forgotten to label a clk module...
LowerName(x.target.name) == n && x.target.module.name == mod.name).getOrElse( LowerName(x.target.name) == n && x.target.module.name == mod.name).getOrElse(
throw new Exception("All top module input clks/clk module output clocks must be sinks/sources!")) throw new Exception(
s"All top module input clks/clk module output clocks must be sinks/sources! $n not annotated!"))
case _ => case _ =>
} }
} }

View File

@@ -3,18 +3,18 @@ package barstools.tapeout.transforms
import chisel3._ import chisel3._
import scala.collection.immutable.ListMap import scala.collection.immutable.ListMap
final class CustomBundle[T <: Data](elts: (String, T)*) extends Record { 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): T = elements(elt) def apply(elt: String): T = elements(elt)
def apply(elt: Int): T = elements(elt.toString) 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[T <: Data](elts: (Int, T)*) extends Record { 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 }: _*)
// TODO: Make an equivalent to the below work publicly // TODO: Make an equivalent to the below work publicly (or only on subclasses?)
private def indexedElements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*) def indexedElements = ListMap(elts map { case (field, elt) => field -> elt.chiselCloneType }: _*)
def apply(elt: Int): T = elements(elt.toString) 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]
} }