出现意外错误:“在声明模块的io时尝试重新分配绑定到chisel3.core.UInt@29a” >>

问题描述 投票:1回答:1

声明新模块的io时出现以下错误:

[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)

错误中被引用的行(RayIntersect.LeafIntersect的第71行是以下位置:

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
}

据我所读,通常在尝试使用裸凿类型作为硬件时会发生此错误,但是我真的不明白为什么错误来自io声明...

有没有其他人在实现过程中遇到此问题,如果是,您是否有机会知道如何解决此问题?

[当声明新模块的io时,出现以下错误:[错误](run-main-e)chisel3.core.Binding $ RebindingException:尝试将绑定重新分配给chisel3.core.UInt@29a [错误] chisel3。 ..

runtime-error raytracing hardware-acceleration chisel uint
1个回答
0
投票

我只需稍作修改就可以运行此代码。我在.W中添加了val data = UInt((new Triangle()).getWidth.W)

© www.soinside.com 2019 - 2024. All rights reserved.