[英]Class is abstract; cannot be instantiated error on chisel
我刚刚开始使用chisel3,但我想反转数字。 这是测试平台的代码:
class LengthTest(c: Length) extends PeekPokeTester(c) {
poke(c.io.x, 12)
expect(c.io.z, 21)
}
abstract class LengthTester extends ChiselFlatSpec {
behavior of "Length"
backends foreach { backend =>
it should s"demonstrate usage of functions that generate code in $backend" in {
Driver(() => new Length, backend)((c) => new LengthTest(c)) should be (true)
}
}
}
这是主要代码
abstract class Length extends Module {
val io = IO(new Bundle {
val x = Input(UInt(16.W))
val z = Output(UInt(16.W))
})
def Reverse(a: UInt) : UInt
io.z := Reverse(io.x)
}
这引发了一个错误,指出无法实例化类。 请帮忙!!
您需要删除您的abstract
关键字并删除def Reverse(a: UInt) : UInt)
或为其提供一些实现
似乎Reverse是凿子utils中定义的对象 -所以您只需要导入它,然后就可以io.z:= Reverse(io.x)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.