chisel - Chisel 3.4.2 syncmem 和一个黑盒子。不使用 --repl-seq-mem 选项替换内存
问题描述
我使用 --repl-seq-mem 选项运行 MemtestInst 代码。它有一个黑盒子和一个 SyncReadMem。没有内存替换发生,配置文件为空。如果我评论 MyBBox 线或使用较旧的凿子,更换工作。有效的凿子:
val defaultVersions = Map(
"chisel3" -> "3.2.5",
"chisel-iotesters" -> "1.3.5"
)
这个失败了(到目前为止最新的一个):
val defaultVersions = Map(
"chisel3" -> "3.4.2",
"chisel-iotesters" -> "1.5.2"
)
斯卡拉代码:
package explore
import chisel3._
import chisel3.util._
class MemoryInst extends Module {
val bitsDatNb = 64
val bitsAddrNb = 9
val io = IO(new Bundle {
val wAddr = Input(UInt(bitsAddrNb.W))
val wData = Input(UInt(bitsDatNb.W))
val wEn = Input(Bool())
val rAddr = Input(UInt(bitsAddrNb.W))
val rEn = Input(Bool())
val rData = Output(UInt(bitsDatNb.W))
})
val myBbox = Module( new MyBBox())
val memFile = SyncReadMem(1<<bitsAddrNb, UInt(bitsDatNb.W))
when(io.wEn) {
memFile.write(io.wAddr, io.wData)
}
io.rData := memFile.read(io.rAddr, io.rEn)
}
class MyBBox() extends BlackBox(
Map(
"LEN_BITS" -> 8,
"ADDR_BITS" -> 10,
"DATA_BITS" -> 64)) with HasBlackBoxResource {
val io = IO(new Bundle {
val clock = Input(Clock())
val reset = Input(Bool())
})
setResource("/verilog/someverilog.v")
}
object MemtestInst extends App {
chisel3.Driver.execute(args, () => new MemoryInst)
}
我错过了什么吗?
提前致谢!
解决方案
我对 Chisel 3.4.0 版有同样的问题
我可以确认您拥有的类似代码适用于没有黑盒的内存映射,而不适用于它。我建议添加以下内容
import chisel3.stage.{ChiselStage, ChiselGeneratorAnnotation}
和改变
object MemtestInst extends App {
chisel3.Driver.execute(args, () => new MemoryInst)
}
至
object MemtestInst extends App {
val annos = Seq(ChiselGeneratorAnnotation(() =>
new MemoryInst()
))
(new ChiselStage).execute(args, annos)
}
我认为chisel3.Driver.execute
是 3.4 及更高版本。
推荐阅读
- android - 动态链接 - Firebase - 400 错误
- c++ - 类模板的所有实例的 C++ 簿记
- sql - PL SQL - 根据集合中的 ID 从表中删除行
- html - Django:文件未下载,但在浏览器中打开
- java - 默认情况下,Json 反序列化将 UTC 引导到本地时间
- sql - 在Oracle中的同一张表中查找以秒为单位的时间差
- ios - iOS客户端的谷歌云端点框架2.0问题
- javascript - 简单的函数返回我在 JavaScript 中没想到的数字
- reactjs - 如何返回动态类型取决于函数中的参数类型
- java - 在 LinearLayout 中定位元素