package.scala 771 Bytes
Newer Older
1
2
package chisel.axiutils.axi4
import  chisel.axi._
3
import  chisel.axi.Axi4._
4
5
6
7
8
9
import  chisel.miscutils.generators._
import  org.scalacheck._

package object generators {
  val axi4CfgGen: Gen[Axi4.Configuration] = for {
    aw <- bitWidthGen(64)
10
    dw <- bitWidthGen(128)
11
12
13
  } yield Axi4.Configuration(addrWidth = AddrWidth(aw), dataWidth = DataWidth(dw))

  val fifoDepthGen: Gen[Limited[Int]] = genLimited(1, 16)
14
15
16
17
18
19
20
21

  def bitStringGen(width: BitWidth): Gen[String] =
    Gen.buildableOfN[String, Char](width, Gen.oneOf('0', '1'))

  def dataGen(width: BitWidth, minElems: Int = 1, maxElems: Int = 1024): Gen[Seq[BigInt]] = for {
    n <- genLimited(minElems, maxElems)
    d <- Gen.buildableOfN[Seq[BigInt], BigInt](n, bitStringGen(width) map (BigInt(_, 2)))
  } yield d
22
}