scala - Chisel 中的 <> 运算符是什么?

标签 scala chisel

Chisel 教程使用了似乎是 <> 的东西。运算符,这对我来说完全陌生。它有什么作用?

另外,它是从哪里来的?这个操作符在其他 Scala 库甚至其他语言中是否有约定俗成的含义?

这是一个示例用法,来自 Chisel Generator 训练营练习,第 3.2 节:

class MyQueue extends Module {
    // Example circuit using a Queue
    val io = IO(new Bundle {
        val in = Flipped(Decoupled(UInt(8.W)))
        val out = Decoupled(UInt(8.W))
    })
    val queue = Queue(io.in, 2)  // 2-element queue
    io.out <> queue
}

最佳答案

<>用于批量连接两个模块之间的所有同名端口。所以在上面的例子中,

io.out <> queue

是一种更简洁的写法

io.out.valid := queue.valid
io.out.bits := queue.bits
queue.ready := io.out.ready

因为它们都被 Decoupled 包裹接口(interface),它定义了ready , validbits端口(请注意 ready 连接以相反的方向流动:批量连​​接正确处理此问题)。

我找到了 the answer在更彻底地阅读 Chisel wiki 之后。

关于scala - Chisel 中的 <> 运算符是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52123791/

相关文章:

scala - 从LabelledGeneric实例中提取标签值

Scala 高级类型用法

chisel - 简单的凿子双端口内存读取端口问题

chisel - Chisel 模块中的条件端口

scala - 如何理解这行凿子代码

scala - 如何使用选项运行 Scala 工作表?

scala - 为什么 receive 被称为方法?

scala - 为多项目 build.sbt 中的一个项目运行自定义 sbt 插件任务

reset - 异步 negedge 重置的可能解决方法?

scala - Chisel IO 接口(interface)构造函数中克隆方法的使用