Frontend.scala 1.4 KB
Newer Older
1
package xiangshan.frontend
G
GouLingrui 已提交
2
import utils.XSInfo
3 4 5 6
import chisel3._
import chisel3.util._
import utils.PipelineConnect
import xiangshan._
7
import xiangshan.cache._
G
GouLingrui 已提交
8

9 10 11

class Frontend extends XSModule {
  val io = IO(new Bundle() {
J
jinyue110 已提交
12 13 14
    val icacheReq = DecoupledIO(new ICacheReq)
    val icacheResp = Flipped(DecoupledIO(new ICacheResp))
    val icacheFlush = Output(UInt(2.W))
Z
zhanglinjuan 已提交
15 16
    val icacheToTlb = Flipped(new BlockTlbRequestIO)
    val ptw = new TlbPtwIO
17
    val backend = new FrontendToBackendIO
Y
Yinan Xu 已提交
18
    val sfence = Input(new SfenceBundle)
Y
Yinan Xu 已提交
19
    val tlbCsr = Input(new TlbCsrBundle)
20 21
  })

22
  val ifu = Module(new IFU)
23
  val ibuffer =  Module(new Ibuffer)
24

25
  val needFlush = io.backend.redirect.valid
26

27
  //backend
28 29 30
  ifu.io.redirect <> io.backend.redirect
  ifu.io.inOrderBrInfo <> io.backend.inOrderBrInfo
  ifu.io.outOfOrderBrInfo <> io.backend.outOfOrderBrInfo
J
jinyue110 已提交
31 32 33 34
  //icache
  io.icacheReq <> ifu.io.icacheReq
  io.icacheFlush <> ifu.io.icacheFlush
  ifu.io.icacheResp <> io.icacheResp
Z
zhanglinjuan 已提交
35 36 37
  //itlb to ptw
  io.ptw <> TLB(
    in = Seq(io.icacheToTlb),
Y
Yinan Xu 已提交
38
    sfence = io.sfence,
Y
Yinan Xu 已提交
39
    csr = io.tlbCsr,
Z
zhanglinjuan 已提交
40 41 42 43
    width = 1,
    isDtlb = false,
    shouldBlock = true
  )
44
  //ibuffer
45
  ibuffer.io.in <> ifu.io.fetchPacket
46
  ibuffer.io.flush := needFlush
47 48

  io.backend.cfVec <> ibuffer.io.out
L
LinJiawei 已提交
49

G
GouLingrui 已提交
50 51 52 53 54
  // for(out <- ibuffer.io.out){
  //   XSInfo(out.fire(),
  //     p"inst:${Hexadecimal(out.bits.instr)} pc:${Hexadecimal(out.bits.pc)}\n"
  //   )
  // }
L
LinJiawei 已提交
55

56

57
}