Bundle.scala 3.2 KB
Newer Older
Z
Zihao Yu 已提交
1
package noop
Z
Zihao Yu 已提交
2 3 4 5

import chisel3._
import chisel3.util._

Z
Zihao Yu 已提交
6
class CtrlSignalIO extends NOOPBundle {
Z
Zihao Yu 已提交
7 8
  val src1Type = Output(SrcType())
  val src2Type = Output(SrcType())
L
FPUv0.1  
LinJiawei 已提交
9
  val src3Type = Output(SrcType())
Z
Zihao Yu 已提交
10 11
  val fuType = Output(FuType())
  val fuOpType = Output(FuOpType())
Z
Zihao Yu 已提交
12 13 14
  val rfSrc1 = Output(UInt(5.W))
  val rfSrc2 = Output(UInt(5.W))
  val rfWen = Output(Bool())
L
FPUv0.1  
LinJiawei 已提交
15 16 17
  val fpWen = Output(Bool())
  val fpInputFunc = Output(UInt(1.W))
  val fpOutputFunc = Output(UInt(2.W))
Z
Zihao Yu 已提交
18
  val rfDest = Output(UInt(5.W))
Z
Zihao Yu 已提交
19
  val isNoopTrap = Output(Bool())
Z
Zihao Yu 已提交
20 21
  val isSrc1Forward = Output(Bool())
  val isSrc2Forward = Output(Bool())
Z
Zihao Yu 已提交
22 23
}

Z
Zihao Yu 已提交
24 25 26 27
class DataSrcIO extends NOOPBundle {
  val src1 = Output(UInt(XLEN.W))
  val src2 = Output(UInt(XLEN.W))
  val imm  = Output(UInt(XLEN.W))
Z
Zihao Yu 已提交
28 29
}

Z
Zihao Yu 已提交
30
class RedirectIO extends NOOPBundle {
31
  val target = Output(UInt(VAddrBits.W))
W
William Wang 已提交
32
  // val brIdx = Output(UInt(3.W)) // for RVC
Z
Zihao Yu 已提交
33 34 35
  val valid = Output(Bool())
}

36 37
// class IRIDCtrlFlowIO extends NOOPBundle {
//   val instr = Output(UInt(64.W))
38 39
//   val pc = Output(UInt(VAddrBits.W))
//   val pnpc = Output(UInt(VAddrBits.W))
40 41 42
//   val brIdx = Output(UInt(3.W))
//   val redirect = new RedirectIO
// }
43

Z
Zihao Yu 已提交
44
class CtrlFlowIO extends NOOPBundle {
W
William Wang 已提交
45
  val instr = Output(UInt(64.W))
46 47
  val pc = Output(UInt(VAddrBits.W))
  val pnpc = Output(UInt(VAddrBits.W))
Z
Zihao Yu 已提交
48
  val redirect = new RedirectIO
49
  val exceptionVec = Output(Vec(16, Bool()))
50
  val intrVec = Output(Vec(12, Bool()))
51
  val brIdx = Output(UInt(4.W))
52
  val crossPageIPFFix = Output(Bool())
Z
Zihao Yu 已提交
53 54
}

Z
Zihao Yu 已提交
55
class DecodeIO extends NOOPBundle {
Z
Zihao Yu 已提交
56 57 58
  val cf = new CtrlFlowIO
  val ctrl = new CtrlSignalIO
  val data = new DataSrcIO
Z
Zihao Yu 已提交
59 60
}

Z
Zihao Yu 已提交
61
class WriteBackIO extends NOOPBundle {
Z
Zihao Yu 已提交
62
  val rfWen = Output(Bool())
L
FPUv0.1  
LinJiawei 已提交
63
  val fpWen = Output(Bool())
Z
Zihao Yu 已提交
64
  val rfDest = Output(UInt(5.W))
Z
Zihao Yu 已提交
65
  val rfData = Output(UInt(XLEN.W))
Z
Zihao Yu 已提交
66
}
Z
Zihao Yu 已提交
67

Z
Zihao Yu 已提交
68
class CommitIO extends NOOPBundle {
Z
Zihao Yu 已提交
69
  val decode = new DecodeIO
Z
Zihao Yu 已提交
70
  val isMMIO = Output(Bool())
Z
Zihao Yu 已提交
71
  val intrNO = Output(UInt(XLEN.W))
Z
Zihao Yu 已提交
72
  val commits = Output(Vec(FuType.num, UInt(XLEN.W)))
Z
Zihao Yu 已提交
73 74
}

Z
Zihao Yu 已提交
75
class FunctionUnitIO extends NOOPBundle {
Z
Zihao Yu 已提交
76
  val in = Flipped(Decoupled(new Bundle {
Z
Zihao Yu 已提交
77 78
    val src1 = Output(UInt(XLEN.W))
    val src2 = Output(UInt(XLEN.W))
Z
Zihao Yu 已提交
79
    val func = Output(FuOpType())
Z
Zihao Yu 已提交
80
  }))
Z
Zihao Yu 已提交
81
  val out = Decoupled(Output(UInt(XLEN.W)))
Z
Zihao Yu 已提交
82
}
Z
Zihao Yu 已提交
83

Z
Zihao Yu 已提交
84
class ForwardIO extends NOOPBundle {
85
  val valid = Output(Bool())
Z
Zihao Yu 已提交
86
  val wb = new WriteBackIO
Z
Zihao Yu 已提交
87
  val fuType = Output(FuType())
Z
Zihao Yu 已提交
88
}
W
William Wang 已提交
89 90 91 92 93 94 95 96 97 98 99 100 101 102

class MMUIO extends NOOPBundle {
  // val ptev = Output(Bool())
  // val pteu = Output(Bool())
  // val ptex = Output(Bool())
  // val valid = Output(Bool())
  // val isStore = Output(Bool())

  val priviledgeMode = Input(UInt(2.W))
  val status_sum = Input(Bool())
  val status_mxr = Input(Bool())

  val loadPF = Output(Bool())
  val storePF = Output(Bool())
103
  val addr = Output(UInt(VAddrBits.W)) 
104 105
  
  def isPF() = loadPF || storePF
106 107
}

108 109 110 111 112
class MemMMUIO extends NOOPBundle {
  val imem = new MMUIO
  val dmem = new MMUIO
}

113
class TLBExuIO extends NOOPBundle {
Z
zhangzifei 已提交
114 115 116
  val satp = Output(UInt(XLEN.W))
  val sfence = new Bundle {
    val valid = Output(Bool())
117
    val asid  = Output(UInt(9.W))
Z
zhangzifei 已提交
118 119 120
    val vaddr = Output(UInt(XLEN.W))
  }

121
  def access(valid: Bool, src1: UInt, src2: UInt, func: UInt, satp: UInt) = {//func no use here for just sfence.vma only
Z
zhangzifei 已提交
122 123
    this.sfence.valid := valid
    this.sfence.vaddr := src1
124
    this.sfence.asid  := src2(8,0)
125
    this.satp := satp
Z
zhangzifei 已提交
126
  }
W
William Wang 已提交
127
}