chisel - 不绑定(bind)到 chisel 内存中的可综合节点异常

标签 chisel

我在凿子代码中遇到以下异常。

[info] - should correctly write and read data *** FAILED ***
[info]   chisel3.core.Binding$BindingException: 'this' (chisel3.core.UInt@d7): Not bound to synthesizable node, currently only Type description
[info]   at chisel3.core.Binding$.checkSynthesizable(Binding.scala:184)
[info]   at chisel3.core.Data.connect(Data.scala:139)
[info]   at chisel3.core.Data.$colon$eq(Data.scala:204)
[info]   at Common.OnChipMemory$$anonfun$1.apply(memory.scala:88)
[info]   at Common.OnChipMemory$$anonfun$1.apply(memory.scala:60)
[info]   at scala.collection.immutable.Range.foreach(Range.scala:166)
[info]   at Common.OnChipMemory.<init>(memory.scala:60)
[info]   at Common.memoryTester$$anonfun$3$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(memoryTest.scala:32)
[info]   at Common.memoryTester$$anonfun$3$$anonfun$apply$1$$anonfun$apply$mcV$sp$1.apply(memoryTest.scala:32)
[info]   at chisel3.core.Module$.do_apply(Module.scala:35)

从这个堆栈跟踪和一些试验和错误测试中,我可以发现该行,

read_data := chipMem(data_idx) //line 88

导致了这个问题。下面发布了紧接在此之前的代码。

val lsb_idx = log2Up(4) // index of lsb in address

val chipMem = Mem(Vec(4, UInt(width = 8)), num_lines)   // memory

val data_idx = req_addr >> UInt(lsb_idx)    //req_addr is a UInt

val read_data = Bits()

此后我一直没能找到问题的原因。我尝试将 read_data 更改为 UInt 的 Vec 并使用 read() 从内存中读取。

最佳答案

问题出在 read_data 的声明上。 Bits() 只是构造一个类型,而不是一个实际的硬件值。您需要将 read_data 设置为实际的 Wire 而不仅仅是 Bits 类型。另请注意,read_data 的类型需要与 Mem 的类型相同,因此您应该按如下方式声明 read_data:

val read_data = Wire(Vec(4, UInt(8.W)) 

关于chisel - 不绑定(bind)到 chisel 内存中的可综合节点异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41909768/

相关文章:

scala - Chisel3 : How to get verilog, 同时使用 cpp 和 vcd 文件

hdl - 如何用iotesters计算凿子的时间?

chisel - 在 Chisel3 中公开仅模拟行为

scala - 凿子 "Enum(UInt(), 5)"失败

simulation - 模拟用 Chisel 编写的 CPU 设计

scala - 如何将 chisel 中的测试平台与 C++ 库集成?

scala - 当我想要构建功能模块创建时如何处理 Vec 输入

scala - 使用 UInt 在 Seq 中获取项目

chisel - 如何使用 ChiselStage 将模块拆分为单独的文件?

chisel - 测试使用硬件构造的 Chisel 对象函数