1/*************************************************************************************** 2 * Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3 * Copyright (c) 2020-2021 Peng Cheng Laboratory 4 * 5 * XiangShan is licensed under Mulan PSL v2. 6 * You can use this software according to the terms and conditions of the Mu lan PSL v2. 7 * You may obtain a copy of Mulan PSL v2 at: 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * 14 * See the Mulan PSL v2 for more details. 15 ***************************************************************************************/ 16 17package utils 18 19import chisel3._ 20import chisel3.util._ 21 22object TriggerCmp { 23 def apply(actual: UInt, tdata: UInt, matchType: UInt, enable: Bool) = { 24 val equal = actual === tdata 25 val greater = actual >= tdata 26 val less = actual <= tdata 27 val res = MuxLookup(matchType, false.B, 28 Array(0.U -> equal, 29 2.U -> greater, 30 3.U -> less)) 31 res && enable 32 } 33} 34 35object ChainCheck { 36 def TimingCheck(prevTiming: Bool, thisTiming: Bool, chain: Bool) = !((prevTiming ^ thisTiming) && chain) 37 def HitCheck(prevHit: Bool, chain: Bool) = prevHit || !chain 38} 39