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