xref: /XiangShan/src/main/scala/xiangshan/backend/decode/isa/predecode/predecode.scala (revision 708ceed4afe43fb0ea3a52407e46b2794c573634)
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 Mulan 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 xiangshan.backend.decode.isa.predecode
18
19import chisel3.util._
20import xiangshan.frontend.BrType
21
22object PreDecodeInst {
23  // def C_JAL     = BitPat("b????????????????_?01_?_??_???_??_???_01") // RV32C
24  def C_J       = BitPat("b????????????????_101_?_??_???_??_???_01")
25  def C_JALR    = BitPat("b????????????????_100_?_??_???_00_000_10")  //c.jalr & c.jr
26  def C_BRANCH  = BitPat("b????????????????_11?_?_??_???_??_???_01")
27  def JAL       = BitPat("b????????????????_???_?????_1101111")
28  def JALR      = BitPat("b????????????????_000_?????_1100111")
29  def BRANCH    = BitPat("b????????????????_???_?????_1100011")
30  def NOP       = BitPat("b???????????????0_100_01010_0000001")   //li	a0,0
31
32
33  val brTable = Array(
34    // C_JAL     -> List(BrType.jal),
35    C_J       -> List(BrType.jal),
36    C_JALR    -> List(BrType.jalr),
37    C_BRANCH  -> List(BrType.branch),
38    JAL       -> List(BrType.jal),
39    JALR      -> List(BrType.jalr),
40    BRANCH    -> List(BrType.branch)
41  )
42}
43