xref: /XiangShan/src/main/scala/xiangshan/backend/datapath/DataSource.scala (revision f8e432b75e5fca897dad07542122d003391ea5c8)
1c0be7f33SXuan Hupackage xiangshan.backend.datapath
2c0be7f33SXuan Hu
3c0be7f33SXuan Huimport chisel3._
4c0be7f33SXuan Hu
5c0be7f33SXuan Huclass DataSource extends Bundle {
64fa640e4Ssinsanction  val value = UInt(4.W)
7c0be7f33SXuan Hu
84fa640e4Ssinsanction  def readReg: Bool = value(3)
9c0be7f33SXuan Hu
10712a039eSxiaofeibao-xjtu  def readRegOH: Bool = value === DataSource.reg
11712a039eSxiaofeibao-xjtu
12*f8e432b7Sxiaofeibao  def readV0: Bool = value === DataSource.v0
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
204fa640e4Ssinsanction  def readBypass2: Bool = value === DataSource.bypass2
214fa640e4Ssinsanction
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
294fa640e4Ssinsanction  def reg: UInt = "b1000".U
30c0be7f33SXuan Hu
31*f8e432b7Sxiaofeibao  def v0: UInt = "b1001".U
32c4fc226aSxiaofeibao-xjtu
330dbae67aSxiaofeibao-xjtu  // read int preg addr is 0
344fa640e4Ssinsanction  def zero: UInt = "b0000".U
35c0be7f33SXuan Hu
364fa640e4Ssinsanction  def forward: UInt = "b0001".U
37c0be7f33SXuan Hu
384fa640e4Ssinsanction  def bypass: UInt = "b0010".U
390dbae67aSxiaofeibao-xjtu
404fa640e4Ssinsanction  def bypass2: UInt = "b0011".U
414fa640e4Ssinsanction
424fa640e4Ssinsanction  def imm: UInt = "b0100".U
43c0be7f33SXuan Hu
44c0be7f33SXuan Hu}
45c0be7f33SXuan Hu
46