xref: /XiangShan/src/main/scala/xiangshan/backend/decode/DecodeUnit.scala (revision be25371a812c88c258225bf5eed7e7c5500f7a27)
1package xiangshan.backend.decode
2
3import chisel3._
4import chisel3.util._
5
6import xiangshan._
7import utils._
8import xiangshan.backend._
9
10// TODO Add lookup table here
11/**
12 * Abstract trait giving defaults and other relevant values to different Decode constants/
13 */
14abstract trait DecodeConstants {
15  def decodeDefault: List[BitPat] =
16    // TODO set default value for ctrl signal
17    List(???)
18  val table: Array[(BitPat, List[BitPat])]
19}
20
21/**
22 * Decoded control signals
23 * See xiangshan/package.scala
24 */
25
26/**
27 * Decode constants for RV64
28 */
29object X64Decode extends DecodeConstants {
30  val table: Array[(BitPat, List[BitPat])] = Array()
31}
32
33/**
34 * Overall Decode constants
35 */
36object XDecode extends DecodeConstants {
37  val table: Array[(BitPat, List[BitPat])] = Array()
38}
39
40/**
41 * FP Decode constants
42 */
43object FDecode extends DecodeConstants{
44  val table: Array[(BitPat, List[BitPat])] = Array()
45}
46
47/**
48 * FP Divide SquareRoot Constants
49 */
50object FDivSqrtDecode extends DecodeConstants {
51  val table: Array[(BitPat, List[BitPat])] = Array()
52}
53
54
55
56// TODO Add BitPat of Instructions somewhere else
57
58/**
59 * IO bundle for the Decode unit
60 */
61class DecodeUnitIO extends XSBundle {
62  val enq = new Bundle { val ctrl_flow = Input(new CtrlFlow) }
63  val deq = new Bundle { val cf_ctrl = Output(new CfCtrl) }
64}
65
66/**
67 * Decode unit that takes in a single CtrlFlow and generates a CfCtrl.
68 */
69class DecodeUnit extends XSModule {
70  val io = IO(new DecodeUnitIO)
71
72  val ctrl_flow = Wire(new CtrlFlow)
73  ctrl_flow := io.enq.ctrl_flow
74
75  var decode_table = ??? // TODO build table
76
77  val inst = ctrl_flow.instr
78
79  val cs = ??? // TODO add ctrl signals
80
81
82
83  //-------------------------------------------------------------
84  // Debug Info
85
86  // TODO add more debug info
87}
88