xref: /XiangShan/src/main/scala/xiangshan/backend/datapath/DataSource.scala (revision c4fc226ad7a2197009ce1afff94b3636f87bb475)
1package xiangshan.backend.datapath
2
3import chisel3._
4
5class DataSource extends Bundle {
6  val value = UInt(3.W)
7
8  def readReg: Bool = value(2)
9
10  def readAnotherReg: Bool =  value === DataSource.anotherReg
11
12  def readZero: Bool = value === DataSource.zero
13
14  def readForward: Bool = value === DataSource.forward
15
16  def readBypass: Bool = value === DataSource.bypass
17
18  def readImm: Bool = value === DataSource.imm
19
20}
21
22object DataSource {
23  def apply() = new DataSource
24
25  def reg: UInt = "b100".U
26
27  def anotherReg: UInt = "b101".U
28
29  // read int preg addr is 0
30  def zero: UInt = "b000".U
31
32  def forward: UInt = "b001".U
33
34  def bypass: UInt = "b010".U
35
36  def imm: UInt = "b011".U
37
38}
39
40