2021-06-04 09:06:35 +08:00
|
|
|
/***************************************************************************************
|
|
|
|
* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
|
|
|
|
*
|
|
|
|
* XiangShan is licensed under Mulan PSL v2.
|
|
|
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
|
|
* You may obtain a copy of Mulan PSL v2 at:
|
|
|
|
* http://license.coscl.org.cn/MulanPSL2
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
|
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
|
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* See the Mulan PSL v2 for more details.
|
|
|
|
***************************************************************************************/
|
|
|
|
|
2020-11-24 17:09:22 +08:00
|
|
|
|
2020-06-21 11:20:06 +08:00
|
|
|
package xiangshan.backend.exu
|
|
|
|
|
2021-04-19 21:19:20 +08:00
|
|
|
import chipsalliance.rocketchip.config.Parameters
|
2020-06-21 11:20:06 +08:00
|
|
|
import chisel3._
|
|
|
|
import chisel3.util._
|
2020-07-14 19:38:20 +08:00
|
|
|
import utils._
|
2021-04-19 21:19:20 +08:00
|
|
|
import xiangshan._
|
2020-11-16 12:54:50 +08:00
|
|
|
import xiangshan.backend.fu.Alu
|
2020-06-21 11:20:06 +08:00
|
|
|
|
2021-04-19 21:19:20 +08:00
|
|
|
class AluExeUnit(implicit p: Parameters) extends Exu(AluExeUnitCfg)
|
2020-11-08 09:25:42 +08:00
|
|
|
{
|
|
|
|
val alu = supportedFunctionUnits.collectFirst{
|
|
|
|
case a: Alu => a
|
|
|
|
}.get
|
|
|
|
|
2021-02-22 13:01:50 +08:00
|
|
|
io.out.bits.redirectValid := alu.redirectOutValid
|
|
|
|
io.out.bits.redirect := alu.redirectOut
|
2020-11-16 15:26:34 +08:00
|
|
|
|
2020-11-24 17:09:22 +08:00
|
|
|
XSDebug(io.fromInt.valid || io.redirect.valid,
|
2021-02-22 13:01:50 +08:00
|
|
|
p"fromInt(${io.fromInt.valid} ${io.fromInt.ready}) toInt(${io.out.valid} ${io.out.ready})" +
|
2020-12-21 19:42:34 +08:00
|
|
|
p"Redirect:(${io.redirect.valid}) roqIdx:${io.redirect.bits.roqIdx}\n",
|
2020-11-16 15:26:34 +08:00
|
|
|
)
|
2020-11-24 17:09:22 +08:00
|
|
|
XSDebug(io.fromInt.valid,
|
2021-05-09 09:05:53 +08:00
|
|
|
p"src1:${Hexadecimal(io.fromInt.bits.src(0))} src2:${Hexadecimal(io.fromInt.bits.src(1))} " +
|
|
|
|
p"src3:${Hexadecimal(io.fromInt.bits.src(2))} func:${Binary(io.fromInt.bits.uop.ctrl.fuOpType)} " +
|
2020-11-24 17:09:22 +08:00
|
|
|
p"pc:${Hexadecimal(io.fromInt.bits.uop.cf.pc)} roqIdx:${io.fromInt.bits.uop.roqIdx}\n"
|
2020-11-16 15:26:34 +08:00
|
|
|
)
|
2021-02-22 13:01:50 +08:00
|
|
|
XSDebug(io.out.valid,
|
|
|
|
p"res:${Hexadecimal(io.out.bits.data)}\n"
|
2020-11-16 15:26:34 +08:00
|
|
|
)
|
2021-04-19 21:19:20 +08:00
|
|
|
}
|