【发布时间】:2021-09-22 08:32:05
【问题描述】:
我正在研究riscv-Boom的设计。它是用chisel设计的。当我阅读它的源代码时,我总是无法理解这些电路中的信号何时会得到。正常程序是一一执行的。但是像 chisel 这样的硬件语言却不是。
https://github.com/riscv-boom/riscv-boom/blob/master/src/main/scala/exu/issue-units/issue-slot.scala 比如上面的链接就是Boom中Issue-slot的源码。
103: val next_uop = Mux(io.in_uop.valid, io.in_uop.bits, slot_uop)
113: state := io.in_uop.bits.iw_state
126: next_state := state
127: next_uopc := slot_uop.uopc
128: next_lrs1_rtype := slot_uop.lrs1_rtype
129: next_lrs2_rtype := slot_uop.lrs2_rtype
155 slot_uop := io.in_uop.bits
208: for loop
这是上面链接中 IssueSlot 类中的一些代码。对于凿子硬件语言,这些:= 应该表示它们是通过电线连接在一起的。那么这些信号会同时变化吗?比如io.in_uop.valid为真时,上面的代码是不是同时赋值?
- 例如,当前 uop 为 fmul,in_uop= 为 fadd。当io.in_uop.valid时,上面的代码会同时执行。但是有一个问题。
origin
uop = fmux
when io.in_uop.valid
103: val next_uop = io.in_uop.bits (fadd uop)
113: state := io.in_uop.bits.iw_state (fadd state)
126: next_state := state (fmux state)
127: next_uopc := slot_uop.uopc (fmux uopc)
128: next_lrs1_rtype := slot_uop.lrs1_rtype (fmux lrs1_rtype )
129: next_lrs2_rtype := slot_uop.lrs2_rtype (fmux lrs2_rtype )
155 slot_uop := io.in_uop.bits (faddlrs2_rtype )
208: for loop
当io.in_uop.valid为真时,此时的发送槽会输入fadd信息。同时,原来的fmul信息仍会输出到下一个相关信号。这应该是不合理的。问题出在哪里?
- 对于第207行的for循环,我还是觉得很难理解。 for 循环会一次性执行吗?比如我用for循环遍历队列,for循环什么时候结束?
如果有人愿意回答我,我将非常感激!
【问题讨论】: