1
0

Add cover property API that can be refined through Config PropertyLibrary (#998)

This commit is contained in:
Jacob Chang 2017-09-19 19:26:54 -07:00 committed by GitHub
parent 57e8fe0a6b
commit b4fc5104d4
2 changed files with 59 additions and 1 deletions

View File

@ -48,7 +48,7 @@ case class TLToAXI4Node(beatBytes: Int, stripBits: Int = 0) extends MixedAdapter
minLatency = p.minLatency)
})
class TLToAXI4(beatBytes: Int, combinational: Boolean = true, adapterName: Option[String] = None, stripBits: Int = 0)(implicit p: Parameters) extends LazyModule
class TLToAXI4(val beatBytes: Int, val combinational: Boolean = true, val adapterName: Option[String] = None, val stripBits: Int = 0)(implicit p: Parameters) extends LazyModule
{
val node = TLToAXI4Node(beatBytes, stripBits)

View File

@ -0,0 +1,58 @@
// See LICENSE.SiFive for license details.
package freechips.rocketchip.util.property
import Chisel._
import chisel3.internal.sourceinfo.{SourceInfo, SourceLine}
import freechips.rocketchip.config.{Field, Parameters}
case object PropertyLibrary extends Field[BasePropertyLibrary](new DefaultPropertyLibrary)
sealed abstract class PropertyType(name: String) {
override def toString: String = name
}
object PropertyType {
object Assert extends PropertyType("Assert")
object Assume extends PropertyType("Assume")
object Cover extends PropertyType("Cover")
}
trait BasePropertyParameters {
val pType: PropertyType
val cond: Bool
val label: String
val message: String
}
case class CoverPropertyParameters(
cond: Bool,
label: String = "",
message: String = "") extends BasePropertyParameters {
val pType = PropertyType.Cover
}
abstract class BasePropertyLibrary {
def generateProperty(prop_param: BasePropertyParameters)(implicit sourceInfo: SourceInfo)
}
class DefaultPropertyLibrary extends BasePropertyLibrary {
def generateProperty(prop_param: BasePropertyParameters)(implicit sourceInfo: SourceInfo) {
// default is to do nothing
Unit
}
}
object cover {
def apply(cond: Bool)(implicit sourceInfo: SourceInfo, p: Parameters): Unit = {
p(PropertyLibrary).generateProperty(CoverPropertyParameters(cond))
}
def apply(cond: Bool, label: String)(implicit sourceInfo: SourceInfo, p: Parameters): Unit = {
p(PropertyLibrary).generateProperty(CoverPropertyParameters(cond, label))
}
def apply(cond: Bool, label: String, message: String)(implicit sourceInfo: SourceInfo, p: Parameters): Unit = {
p(PropertyLibrary).generateProperty(CoverPropertyParameters(cond, label, message))
}
}