xref: /XiangShan/src/main/scala/xiangshan/backend/decode/isa/predecode/predecode.scala (revision c6d439803a044ea209139672b25e35fe8d7f4aa0)
1/***************************************************************************************
2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
3*
4* XiangShan is licensed under Mulan PSL v2.
5* You can use this software according to the terms and conditions of the Mulan PSL v2.
6* You may obtain a copy of Mulan PSL v2 at:
7*          http://license.coscl.org.cn/MulanPSL2
8*
9* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
10* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
11* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
12*
13* See the Mulan PSL v2 for more details.
14***************************************************************************************/
15
16package xiangshan.backend.decode.isa.predecode
17
18import chisel3.util._
19import xiangshan.frontend.BrType
20
21object PreDecodeInst {
22  // def C_JAL     = BitPat("b????????????????_?01_?_??_???_??_???_01") // RV32C
23  def C_J       = BitPat("b????????????????_101_?_??_???_??_???_01")
24  def C_JALR    = BitPat("b????????????????_100_?_??_???_00_000_10")  //c.jalr & c.jr
25  def C_BRANCH  = BitPat("b????????????????_11?_?_??_???_??_???_01")
26  def JAL       = BitPat("b????????????????_???_?????_1101111")
27  def JALR      = BitPat("b????????????????_000_?????_1100111")
28  def BRANCH    = BitPat("b????????????????_???_?????_1100011")
29
30
31  val brTable = Array(
32    // C_JAL     -> List(BrType.jal),
33    C_J       -> List(BrType.jal),
34    C_JALR    -> List(BrType.jalr),
35    C_BRANCH  -> List(BrType.branch),
36    JAL       -> List(BrType.jal),
37    JALR      -> List(BrType.jalr),
38    BRANCH    -> List(BrType.branch)
39  )
40}
41