1c0be7f33SXuan Hupackage xiangshan.backend.datapath 2c0be7f33SXuan Hu 3c0be7f33SXuan Huimport chisel3._ 4c0be7f33SXuan Hu 5c0be7f33SXuan Huclass DataSource extends Bundle { 6*4fa640e4Ssinsanction val value = UInt(4.W) 7c0be7f33SXuan Hu 8*4fa640e4Ssinsanction def readReg: Bool = value(3) 9c0be7f33SXuan Hu 10712a039eSxiaofeibao-xjtu def readRegOH: Bool = value === DataSource.reg 11712a039eSxiaofeibao-xjtu 12c4fc226aSxiaofeibao-xjtu def readAnotherReg: Bool = value === DataSource.anotherReg 13c4fc226aSxiaofeibao-xjtu 140dbae67aSxiaofeibao-xjtu def readZero: Bool = value === DataSource.zero 15c0be7f33SXuan Hu 160dbae67aSxiaofeibao-xjtu def readForward: Bool = value === DataSource.forward 170dbae67aSxiaofeibao-xjtu 180dbae67aSxiaofeibao-xjtu def readBypass: Bool = value === DataSource.bypass 190dbae67aSxiaofeibao-xjtu 20*4fa640e4Ssinsanction def readBypass2: Bool = value === DataSource.bypass2 21*4fa640e4Ssinsanction 220dbae67aSxiaofeibao-xjtu def readImm: Bool = value === DataSource.imm 230dbae67aSxiaofeibao-xjtu 24c0be7f33SXuan Hu} 25c0be7f33SXuan Hu 26c0be7f33SXuan Huobject DataSource { 27c0be7f33SXuan Hu def apply() = new DataSource 28c0be7f33SXuan Hu 29*4fa640e4Ssinsanction def reg: UInt = "b1000".U 30c0be7f33SXuan Hu 31*4fa640e4Ssinsanction def anotherReg: UInt = "b1001".U 32c4fc226aSxiaofeibao-xjtu 330dbae67aSxiaofeibao-xjtu // read int preg addr is 0 34*4fa640e4Ssinsanction def zero: UInt = "b0000".U 35c0be7f33SXuan Hu 36*4fa640e4Ssinsanction def forward: UInt = "b0001".U 37c0be7f33SXuan Hu 38*4fa640e4Ssinsanction def bypass: UInt = "b0010".U 390dbae67aSxiaofeibao-xjtu 40*4fa640e4Ssinsanction def bypass2: UInt = "b0011".U 41*4fa640e4Ssinsanction 42*4fa640e4Ssinsanction def imm: UInt = "b0100".U 43c0be7f33SXuan Hu 44c0be7f33SXuan Hu} 45c0be7f33SXuan Hu 46