1package xiangshan.backend.datapath 2 3import chisel3._ 4 5class DataSource extends Bundle { 6 val value = UInt(2.W) 7 8 def readReg: Bool = value === DataSource.reg 9 10 def readBypass: Bool = value(1) 11 12 def readForward: Bool = value(0) 13} 14 15object DataSource { 16 def apply() = new DataSource 17 18 // no need to read any data 19 def none: UInt = "b00".U 20 21 def reg: UInt = "b00".U 22 23 def forward: UInt = "b01".U 24 25 def bypass: UInt = "b10".U 26 27} 28 29