提交 41ec96a9 编写于 作者: Z Zihao Yu

noop,fu,MDU: make mulLatency configurable

上级 b80e92d8
......@@ -34,6 +34,7 @@ object MDUInstr extends HasDecodeConst {
class MDU extends Module with HasMDUOpType {
val io = IO(new FunctionUnitIO)
val mulLatency = 4
val (valid, src1, src2, func) = (io.in.valid, io.in.bits.src1, io.in.bits.src2, io.in.bits.func)
def access(valid: Bool, src1: UInt, src2: UInt, func: UInt): UInt = {
......@@ -45,7 +46,7 @@ class MDU extends Module with HasMDUOpType {
}
val mulRes = (src1.asSInt * src2.asSInt).asUInt
val mulPipeOut = Pipe(io.in.fire(), mulRes, 4)
val mulPipeOut = Pipe(io.in.fire(), mulRes, mulLatency)
io.out.bits := LookupTree(func, 0.U, List(
MduMul -> mulPipeOut.bits(31, 0),
MduMulh -> mulPipeOut.bits(63, 32)
......@@ -59,6 +60,6 @@ class MDU extends Module with HasMDUOpType {
when (io.in.valid && !busy) { busy := true.B }
when (mulPipeOut.valid) { busy := false.B }
io.in.ready := !busy
io.in.ready := (if (mulLatency == 0) true.B else !busy)
io.out.valid := mulPipeOut.valid
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册