При объявлении ввода-вывода нового модуля я получил следующую ошибку:
[error] (run-main-e) chisel3.core.Binding$RebindingException: Attempted reassignment of binding to chisel3.core.UInt@29a
[error] chisel3.core.Binding$RebindingException: Attempted reassignment of binding to chisel3.core.UInt@29a
[error] at chisel3.core.Data.binding_$eq(Data.scala:250)
[error] at chisel3.core.Element.bind(Bits.scala:22)
[error] at chisel3.core.Aggregate$$anonfun$bind$1.apply(Aggregate.scala:23)
[error] at chisel3.core.Aggregate$$anonfun$bind$1.apply(Aggregate.scala:22)
[error] at scala.collection.Iterator$class.foreach(Iterator.scala:891)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
[error] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error] at chisel3.core.Aggregate.bind(Aggregate.scala:22)
[error] at chisel3.core.Aggregate$$anonfun$bind$1.apply(Aggregate.scala:23)
[error] at chisel3.core.Aggregate$$anonfun$bind$1.apply(Aggregate.scala:22)
[error] at scala.collection.Iterator$class.foreach(Iterator.scala:891)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
[error] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error] at chisel3.core.Aggregate.bind(Aggregate.scala:22)
[error] at chisel3.core.Aggregate$$anonfun$bind$1.apply(Aggregate.scala:23)
[error] at chisel3.core.Aggregate$$anonfun$bind$1.apply(Aggregate.scala:22)
[error] at scala.collection.Iterator$class.foreach(Iterator.scala:891)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
[error] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error] at chisel3.core.Aggregate.bind(Aggregate.scala:22)
[error] at chisel3.core.BaseModule._bindIoInPlace(Module.scala:249)
[error] at chisel3.core.BaseModule.IO(Module.scala:282)
[error] at RayIntersect.LeafIntersect.<init>(PrimIntersect.scala:71)
[error] at RayIntersect.MyTopLevelVerilog$$anonfun$1.apply(RayIntersectTest.scala:11)
[error] at RayIntersect.MyTopLevelVerilog$$anonfun$1.apply(RayIntersectTest.scala:11)
[error] at chisel3.core.Module$.do_apply(Module.scala:49)
[error] at chisel3.Driver$$anonfun$elaborate$1.apply(Driver.scala:93)
[error] at chisel3.Driver$$anonfun$elaborate$1.apply(Driver.scala:93)
[error] at chisel3.internal.Builder$$anonfun$build$1.apply(Builder.scala:297)
[error] at chisel3.internal.Builder$$anonfun$build$1.apply(Builder.scala:295)
[error] at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[error] at chisel3.internal.Builder$.build(Builder.scala:295)
[error] at chisel3.Driver$.elaborate(Driver.scala:93)
[error] at chisel3.Driver$.execute(Driver.scala:140)
[error] at chisel3.Driver$.execute(Driver.scala:202)
[error] at RayIntersect.MyTopLevelVerilog$.delayedEndpoint$RayIntersect$MyTopLevelVerilog$1(RayIntersectTest.scala:11)
[error] at RayIntersect.MyTopLevelVerilog$delayedInit$body.apply(RayIntersectTest.scala:5)
[error] at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
[error] at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error] at scala.App$$anonfun$main$1.apply(App.scala:76)
[error] at scala.App$$anonfun$main$1.apply(App.scala:76)
[error] at scala.collection.immutable.List.foreach(List.scala:392)
[error] at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
[error] at scala.App$class.main(App.scala:76)
[error] at RayIntersect.MyTopLevelVerilog$.main(RayIntersectTest.scala:5)
[error] at RayIntersect.MyTopLevelVerilog.main(RayIntersectTest.scala)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:498)
[error] at sbt.Run.invokeMain(Run.scala:93)
[error] at sbt.Run.run0(Run.scala:87)
[error] at sbt.Run.execute$1(Run.scala:65)
[error] at sbt.Run.$anonfun$run$4(Run.scala:77)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
[error] at sbt.TrapExit$App.run(TrapExit.scala:252)
[error] at java.lang.Thread.run(Thread.java:745)
Где строка, на которую ссылается ошибка (строка 71 RayIntersect.LeafIntersect), выглядит следующим образом:
val io = IO(new Bundle {
Вот остальная часть объявления io, если это помогает:
val io = IO(new Bundle {
val rayNodeStackIn = Flipped(DecoupledIO(new RayBVHNodeStackIdx(id_width, index_width)))
val shadow = Input(Bool())
val rayNodeOut = DecoupledIO(new RayBVHNode(id_width, index_width))
val dataOut = DecoupledIO(new Bundle {
val foundInt = Bool()
val f = UInt(index_width.W)
val its = new Intersection()
})
//Memory system interface
val addrOut = DecoupledIO(new Bundle {
val id = UInt(id_width.W)
val trIdx = UInt(prim_id_width.W)
}
val dataIn = Flipped(DecoupledIO(new Bundle {
val id = UInt(id_width.W)
val data = UInt((new Triangle()).getWidth)
}))
})
Вот код для используемых Пакетов:
class Triangle() extends Bundle {
val p0 = Vec(3, UInt(32.W))
val p1 = Vec(3, UInt(32.W))
val p2 = Vec(3, UInt(32.W))
val idx = UInt(32.W)
val meshAddr = UInt(32.W)
}
class BVHNode() extends Bundle {
val data = UInt(64.W)
val bbox = new Bundle {
val min = Vec(3, UInt(32.W))
val max = Vec(3, UInt(32.W))
}
def rightChild: UInt = (data << 32)
def leafStart : UInt = (data << 32)
def leafSize : UInt = (data << 1) & 0xFFFFFFFE.U
def start : UInt = leafStart
def end : UInt = leafStart + leafSize
def isLeaf : Bool = data(0)
override def cloneType = (new BVHNode()).asInstanceOf[this.type]
}
class Ray(sid_width : Int) extends Bundle {
val origin = Vec(3, UInt(32.W))
val dir = Vec(3, UInt(32.W))
val dRcp = Vec(3, UInt(32.W)) //Componentwise reciprocals of the ray direction
val minT = UInt(32.W)
val maxT = UInt(32.W)
val id = UInt(32.W)
override def cloneType = (new Ray(sid_width)).asInstanceOf[this.type]
}
class RayBVHNodeStackIdx(id_width: Int, index_width: Int) extends Bundle {
val ray = new Ray(id_width)
val node = new BVHNode()
val nodeIdx = UInt(index_width.W)
val stackIdx = UInt(index_width.W)
override def cloneType = (new RayBVHNodeStackIdx(id_width, index_width)).asInstanceOf[this.type]
}
class RayBVHNode(id_width: Int, index_width : Int) extends Bundle {
val ray = new Ray(id_width)
val node = new BVHNode()
val nodeIdx = UInt(index_width.W)
override def cloneType = (new RayBVHNode(id_width, index_width)).asInstanceOf[this.type]
}
class Intersection() extends Bundle {
val t = UInt(32.W) //Unoccluded distance along the ray
val u = UInt(32.W) //UV coordinate, if any
val v = UInt(32.W) //Other UV coordinate
val mesh = UInt(32.W) //pointer to the intersected mesh
}
Из того, что я прочитал, эта ошибка обычно происходит при попытке использовать чистый тип Chisel в качестве аппаратного обеспечения, однако я действительно не понимаю, почему ошибка возникает из объявления io ...
Кто-нибудь еще когда-либо сталкивался с этой проблемой в своей реализации и, если да, знаете ли вы случайно, как это исправить?