具有多个时钟域的凿子测试器SteppedHWIOTester

时间:2017-10-31 10:57:43

标签: scala hardware chisel

尝试使用SteppedHWIOTester测试asyncFifo在凿子中写的那样

class AsyncFifo(width: Int, depth: Int, syncStages: Int) extends Module {
  val length = log2Ceil(depth)
  val io = IO(new Bundle {
    val clk_write = Input(Clock())
    val clk_read = Input(Clock())
    val rstn_write = Input(Bool())
    val rstn_read = Input(Bool())
    val deq = Decoupled(UInt(width.W))
    val enq = Flipped(Decoupled(UInt(width.W)))
  })
  val memory = Mem(depth, UInt(width.W))
  val reader: reader = withClock(io.clk_read)( Module(new reader(width, depth, syncStages)) )
  val writer: writer = withClock(io.clk_write)( Module(new writer(width, depth, syncStages)) )
  //some connections here...
}
class AsyncFifoHardWareTester extends SteppedHWIOTester {
  val device_under_test = Module(new AsyncFifo(32, 32, 2))
  val c = device_under_test
  enable_all_debug = true

  step(2)
  poke(c.io.enq.bits, 0x11L)
  poke(c.io.enq.valid, 0x1L)
  step(2)
  poke(c.io.enq.bits, 0x11L)
  poke(c.io.enq.valid, 0x0L)
  step(2)
  expect(c.io.deq.valid, 0x11L)
  expect(c.io.deq.bits, 0x0L)
}

Tester生成vcd,其中clk_write和clk_read由零驱动。 有没有办法在HW或PeekPoke测试人员中声明异步时钟和他们的比率?

1 个答案:

答案 0 :(得分:2)

不幸的是,目前的答案是否定的,凿子测试仪回购没有测试多个时钟的设施。凿子团队正在努力清理和改进凿子测试人员,请参阅:Chisel3 Issues: Testers Unification以查看一些激励性的讨论。同样正在进行的是重新编写的firrtl解释器,它将明确支持多个时钟,但这可能需要几个月的时间。

人们自己做到了这一点。您也可以在Chisel Users Group

上尝试此问题