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 readZero: Bool = value === DataSource.zero 11 12 def readForward: Bool = value === DataSource.forward 13 14 def readBypass: Bool = value === DataSource.bypass 15 16 def readImm: Bool = value === DataSource.imm 17 18} 19 20object DataSource { 21 def apply() = new DataSource 22 23 def reg: UInt = "b100".U 24 25 // read int preg addr is 0 26 def zero: UInt = "b000".U 27 28 def forward: UInt = "b001".U 29 30 def bypass: UInt = "b010".U 31 32 def imm: UInt = "b011".U 33 34} 35 36