xref: /XiangShan/src/main/scala/xiangshan/package.scala (revision 708ceed4afe43fb0ea3a52407e46b2794c573634)
1/***************************************************************************************
2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
3* Copyright (c) 2020-2021 Peng Cheng Laboratory
4*
5* XiangShan is licensed under Mulan PSL v2.
6* You can use this software according to the terms and conditions of the Mulan PSL v2.
7* You may obtain a copy of Mulan PSL v2 at:
8*          http://license.coscl.org.cn/MulanPSL2
9*
10* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13*
14* See the Mulan PSL v2 for more details.
15***************************************************************************************/
16
17import chisel3._
18import chisel3.util._
19
20import chipsalliance.rocketchip.config.Parameters
21import freechips.rocketchip.tile.XLen
22import xiangshan.backend.fu._
23import xiangshan.backend.fu.fpu._
24import xiangshan.backend.exu._
25import xiangshan.backend.Std
26
27package object xiangshan {
28  object SrcType {
29    def reg = "b00".U
30    def pc  = "b01".U
31    def imm = "b01".U
32    def fp  = "b10".U
33
34    def DC = imm // Don't Care
35
36    def isReg(srcType: UInt) = srcType===reg
37    def isPc(srcType: UInt) = srcType===pc
38    def isImm(srcType: UInt) = srcType===imm
39    def isFp(srcType: UInt) = srcType===fp
40    def isPcOrImm(srcType: UInt) = srcType(0)
41    def isRegOrFp(srcType: UInt) = !srcType(1)
42    def regIsFp(srcType: UInt) = srcType(1)
43
44    def apply() = UInt(2.W)
45  }
46
47  object SrcState {
48    def busy    = "b0".U
49    def rdy     = "b1".U
50    // def specRdy = "b10".U // speculative ready, for future use
51    def apply() = UInt(1.W)
52  }
53
54  object FuType {
55    def jmp          = "b0000".U
56    def i2f          = "b0001".U
57    def csr          = "b0010".U
58    def alu          = "b0110".U
59    def mul          = "b0100".U
60    def div          = "b0101".U
61    def fence        = "b0011".U
62    def bmu          = "b0111".U
63
64    def fmac         = "b1000".U
65    def fmisc        = "b1011".U
66    def fDivSqrt     = "b1010".U
67
68    def ldu          = "b1100".U
69    def stu          = "b1101".U
70    def mou          = "b1111".U // for amo, lr, sc, fence
71
72    def num = 14
73
74    def apply() = UInt(log2Up(num).W)
75
76    def isIntExu(fuType: UInt) = !fuType(3)
77    def isJumpExu(fuType: UInt) = fuType === jmp
78    def isFpExu(fuType: UInt) = fuType(3, 2) === "b10".U
79    def isMemExu(fuType: UInt) = fuType(3, 2) === "b11".U
80    def isLoadStore(fuType: UInt) = isMemExu(fuType) && !fuType(1)
81    def isStoreExu(fuType: UInt) = isMemExu(fuType) && fuType(0)
82    def isAMO(fuType: UInt) = fuType(1)
83
84    def jmpCanAccept(fuType: UInt) = !fuType(2)
85    def mduCanAccept(fuType: UInt) = fuType(2) && !fuType(1) || fuType(2) && fuType(1) && fuType(0)
86    def aluCanAccept(fuType: UInt) = fuType(2) && fuType(1) && !fuType(0)
87
88    def fmacCanAccept(fuType: UInt) = !fuType(1)
89    def fmiscCanAccept(fuType: UInt) = fuType(1)
90
91    def loadCanAccept(fuType: UInt) = !fuType(0)
92    def storeCanAccept(fuType: UInt) = fuType(0)
93
94    def storeIsAMO(fuType: UInt) = fuType(1)
95
96    val functionNameMap = Map(
97      jmp.litValue() -> "jmp",
98      i2f.litValue() -> "int_to_float",
99      csr.litValue() -> "csr",
100      alu.litValue() -> "alu",
101      mul.litValue() -> "mul",
102      div.litValue() -> "div",
103      fence.litValue() -> "fence",
104      bmu.litValue() -> "bmu",
105      fmac.litValue() -> "fmac",
106      fmisc.litValue() -> "fmisc",
107      fDivSqrt.litValue() -> "fdiv/fsqrt",
108      ldu.litValue() -> "load",
109      stu.litValue() -> "store",
110      mou.litValue() -> "mou"
111    )
112  }
113
114  object FuOpType {
115    def apply() = UInt(7.W)
116  }
117
118  object CommitType {
119    def NORMAL = "b00".U  // int/fp
120    def BRANCH = "b01".U  // branch
121    def LOAD   = "b10".U  // load
122    def STORE  = "b11".U  // store
123
124    def apply() = UInt(2.W)
125    def isLoadStore(commitType: UInt) = commitType(1)
126    def lsInstIsStore(commitType: UInt) = commitType(0)
127    def isStore(commitType: UInt) = isLoadStore(commitType) && lsInstIsStore(commitType)
128    def isBranch(commitType: UInt) = commitType(0) && !commitType(1)
129  }
130
131  object RedirectLevel {
132    def flushAfter = "b0".U
133    def flush      = "b1".U
134
135    def apply() = UInt(1.W)
136    // def isUnconditional(level: UInt) = level(1)
137    def flushItself(level: UInt) = level(0)
138    // def isException(level: UInt) = level(1) && level(0)
139  }
140
141  object ExceptionVec {
142    def apply() = Vec(16, Bool())
143  }
144
145  object PMAMode {
146    def R = "b1".U << 0 //readable
147    def W = "b1".U << 1 //writeable
148    def X = "b1".U << 2 //executable
149    def I = "b1".U << 3 //cacheable: icache
150    def D = "b1".U << 4 //cacheable: dcache
151    def S = "b1".U << 5 //enable speculative access
152    def A = "b1".U << 6 //enable atomic operation, A imply R & W
153    def C = "b1".U << 7 //if it is cacheable is configable
154    def Reserved = "b0".U
155
156    def apply() = UInt(7.W)
157
158    def read(mode: UInt) = mode(0)
159    def write(mode: UInt) = mode(1)
160    def execute(mode: UInt) = mode(2)
161    def icache(mode: UInt) = mode(3)
162    def dcache(mode: UInt) = mode(4)
163    def speculate(mode: UInt) = mode(5)
164    def atomic(mode: UInt) = mode(6)
165    def configable_cache(mode: UInt) = mode(7)
166
167    def strToMode(s: String) = {
168      var result = 0.U(8.W)
169      if (s.toUpperCase.indexOf("R") >= 0) result = result + R
170      if (s.toUpperCase.indexOf("W") >= 0) result = result + W
171      if (s.toUpperCase.indexOf("X") >= 0) result = result + X
172      if (s.toUpperCase.indexOf("I") >= 0) result = result + I
173      if (s.toUpperCase.indexOf("D") >= 0) result = result + D
174      if (s.toUpperCase.indexOf("S") >= 0) result = result + S
175      if (s.toUpperCase.indexOf("A") >= 0) result = result + A
176      if (s.toUpperCase.indexOf("C") >= 0) result = result + C
177      result
178    }
179  }
180
181
182  object CSROpType {
183    def jmp  = "b000".U
184    def wrt  = "b001".U
185    def set  = "b010".U
186    def clr  = "b011".U
187    def wrti = "b101".U
188    def seti = "b110".U
189    def clri = "b111".U
190  }
191
192  // jump
193  object JumpOpType {
194    def jal  = "b00".U
195    def jalr = "b01".U
196    def auipc = "b10".U
197//    def call = "b11_011".U
198//    def ret  = "b11_100".U
199    def jumpOpisJalr(op: UInt) = op(0)
200    def jumpOpisAuipc(op: UInt) = op(1)
201  }
202
203  object FenceOpType {
204    def fence  = "b10000".U
205    def sfence = "b10001".U
206    def fencei = "b10010".U
207  }
208
209  object ALUOpType {
210    // shift optype
211    def slliuw     = "b000_0000".U // slliuw: ZEXT(src1[31:0]) << shamt
212    def sll        = "b000_0001".U // sll:     src1 << src2
213
214    def bclr       = "b000_0010".U // bclr:    src1 & ~(1 << src2[5:0])
215    def bset       = "b000_0011".U // bset:    src1 | (1 << src2[5:0])
216    def binv       = "b000_0100".U // binv:    src1 ^ ~(1 << src2[5:0])
217
218    def srl        = "b000_0101".U // srl:     src1 >> src2
219    def bext       = "b000_0110".U // bext:    (src1 >> src2)[0]
220    def sra        = "b000_0111".U // sra:     src1 >> src2 (arithmetic)
221
222    def rol        = "b000_1000".U // rol:     (src1 << src2) | (src1 >> (xlen - src2))
223    def ror        = "b000_1001".U // ror:     (src1 >> src2) | (src1 << (xlen - src2))
224
225    // RV64 32bit optype
226    def addw       = "b001_0000".U // addw:      SEXT((src1 + src2)[31:0])
227    def oddaddw    = "b001_0001".U // oddaddw:   SEXT((src1[0] + src2)[31:0])
228    def subw       = "b001_0010".U // subw:      SEXT((src1 - src2)[31:0])
229
230    def addwbit    = "b001_0100".U // addwbit:   (src1 + src2)[0]
231    def addwbyte   = "b001_0101".U // addwbyte:  (src1 + src2)[7:0]
232    def addwzexth  = "b001_0110".U // addwzexth: ZEXT((src1  + src2)[15:0])
233    def addwsexth  = "b001_0111".U // addwsexth: SEXT((src1  + src2)[15:0])
234
235    def sllw       = "b001_1000".U // sllw:     SEXT((src1 << src2)[31:0])
236    def srlw       = "b001_1001".U // srlw:     SEXT((src1[31:0] >> src2)[31:0])
237    def sraw       = "b001_1010".U // sraw:     SEXT((src1[31:0] >> src2)[31:0])
238    def rolw       = "b001_1100".U
239    def rorw       = "b001_1101".U
240
241    // ADD-op
242    def adduw      = "b010_0000".U // adduw:  src1[31:0]  + src2
243    def add        = "b010_0001".U // add:     src1        + src2
244    def oddadd     = "b010_0010".U // oddadd:  src1[0]     + src2
245
246    def sr29add    = "b010_0100".U // sr29add: src1[63:29] + src2
247    def sr30add    = "b010_0101".U // sr30add: src1[63:30] + src2
248    def sr31add    = "b010_0110".U // sr31add: src1[63:31] + src2
249    def sr32add    = "b010_0111".U // sr32add: src1[63:32] + src2
250
251    def sh1adduw   = "b010_1000".U // sh1adduw: {src1[31:0], 1'b0} + src2
252    def sh1add     = "b010_1001".U // sh1add: {src1[62:0], 1'b0} + src2
253    def sh2adduw   = "b010_1010".U // sh2add_uw: {src1[31:0], 2'b0} + src2
254    def sh2add     = "b010_1011".U // sh2add: {src1[61:0], 2'b0} + src2
255    def sh3adduw   = "b010_1100".U // sh3add_uw: {src1[31:0], 3'b0} + src2
256    def sh3add     = "b010_1101".U // sh3add: {src1[60:0], 3'b0} + src2
257    def sh4add     = "b010_1111".U // sh4add: {src1[59:0], 4'b0} + src2
258
259    // SUB-op: src1 - src2
260    def sub        = "b011_0000".U
261    def sltu       = "b011_0001".U
262    def slt        = "b011_0010".U
263    def maxu       = "b011_0100".U
264    def minu       = "b011_0101".U
265    def max        = "b011_0110".U
266    def min        = "b011_0111".U
267
268    // branch
269    def beq        = "b111_0000".U
270    def bne        = "b111_0010".U
271    def blt        = "b111_1000".U
272    def bge        = "b111_1010".U
273    def bltu       = "b111_1100".U
274    def bgeu       = "b111_1110".U
275
276    // misc optype
277    def and        = "b100_0000".U
278    def andn       = "b100_0001".U
279    def or         = "b100_0010".U
280    def orn        = "b100_0011".U
281    def xor        = "b100_0100".U
282    def xnor       = "b100_0101".U
283    def orcb       = "b100_0110".U
284
285    def sextb      = "b100_1000".U
286    def packh      = "b100_1001".U
287    def sexth      = "b100_1010".U
288    def packw      = "b100_1011".U
289
290    def revb       = "b101_0000".U
291    def rev8       = "b101_0001".U
292    def pack       = "b101_0010".U
293    def orh48      = "b101_0011".U
294
295    def szewl1     = "b101_1000".U
296    def szewl2     = "b101_1001".U
297    def szewl3     = "b101_1010".U
298    def byte2      = "b101_1011".U
299
300    def andlsb     = "b110_0000".U
301    def andzexth   = "b110_0001".U
302    def orlsb      = "b110_0010".U
303    def orzexth    = "b110_0011".U
304    def xorlsb     = "b110_0100".U
305    def xorzexth   = "b110_0101".U
306    def orcblsb    = "b110_0110".U
307    def orcbzexth  = "b110_0111".U
308
309    def isAddw(func: UInt) = func(6, 4) === "b001".U && !func(3) && !func(1)
310    def isSimpleLogic(func: UInt) = func(6, 4) === "b100".U && !func(0)
311    def logicToLsb(func: UInt) = Cat("b110".U(3.W), func(3, 1), 0.U(1.W))
312    def logicToZexth(func: UInt) = Cat("b110".U(3.W), func(3, 1), 1.U(1.W))
313    def isBranch(func: UInt) = func(6, 4) === "b111".U
314    def getBranchType(func: UInt) = func(3, 2)
315    def isBranchInvert(func: UInt) = func(1)
316
317    def apply() = UInt(7.W)
318  }
319
320  object MDUOpType {
321    // mul
322    // bit encoding: | type (2bit) | isWord(1bit) | opcode(2bit) |
323    def mul    = "b00000".U
324    def mulh   = "b00001".U
325    def mulhsu = "b00010".U
326    def mulhu  = "b00011".U
327    def mulw   = "b00100".U
328
329    def mulw7  = "b01100".U
330
331    // div
332    // bit encoding: | type (2bit) | isWord(1bit) | isSign(1bit) | opcode(1bit) |
333    def div    = "b10000".U
334    def divu   = "b10010".U
335    def rem    = "b10001".U
336    def remu   = "b10011".U
337
338    def divw   = "b10100".U
339    def divuw  = "b10110".U
340    def remw   = "b10101".U
341    def remuw  = "b10111".U
342
343    def isMul(op: UInt) = !op(4)
344    def isDiv(op: UInt) = op(4)
345
346    def isDivSign(op: UInt) = isDiv(op) && !op(1)
347    def isW(op: UInt) = op(2)
348    def isH(op: UInt) = (isDiv(op) && op(0)) || (isMul(op) && op(1, 0) =/= 0.U)
349    def getMulOp(op: UInt) = op(1, 0)
350  }
351
352  object LSUOpType {
353    // normal load/store
354    // bit(1, 0) are size
355    def lb   = "b000000".U
356    def lh   = "b000001".U
357    def lw   = "b000010".U
358    def ld   = "b000011".U
359    def lbu  = "b000100".U
360    def lhu  = "b000101".U
361    def lwu  = "b000110".U
362    def sb   = "b001000".U
363    def sh   = "b001001".U
364    def sw   = "b001010".U
365    def sd   = "b001011".U
366
367    def isLoad(op: UInt): Bool = !op(3)
368    def isStore(op: UInt): Bool = op(3)
369
370    // atomics
371    // bit(1, 0) are size
372    // since atomics use a different fu type
373    // so we can safely reuse other load/store's encodings
374    def lr_w      = "b000010".U
375    def sc_w      = "b000110".U
376    def amoswap_w = "b001010".U
377    def amoadd_w  = "b001110".U
378    def amoxor_w  = "b010010".U
379    def amoand_w  = "b010110".U
380    def amoor_w   = "b011010".U
381    def amomin_w  = "b011110".U
382    def amomax_w  = "b100010".U
383    def amominu_w = "b100110".U
384    def amomaxu_w = "b101010".U
385
386    def lr_d      = "b000011".U
387    def sc_d      = "b000111".U
388    def amoswap_d = "b001011".U
389    def amoadd_d  = "b001111".U
390    def amoxor_d  = "b010011".U
391    def amoand_d  = "b010111".U
392    def amoor_d   = "b011011".U
393    def amomin_d  = "b011111".U
394    def amomax_d  = "b100011".U
395    def amominu_d = "b100111".U
396    def amomaxu_d = "b101011".U
397  }
398
399  object BMUOpType {
400
401    def clmul       = "b00000".U
402    def clmulh      = "b00010".U
403    def clmulr      = "b00100".U
404
405    def clz         = "b01000".U
406    def clzw        = "b01001".U
407    def ctz         = "b01010".U
408    def ctzw        = "b01011".U
409    def cpop        = "b01100".U
410    def cpopw       = "b01101".U
411
412    // TODO: move to alu
413    def xpermn      = "b10000".U
414    def xpermb      = "b10001".U
415  }
416
417  object BTBtype {
418    def B = "b00".U  // branch
419    def J = "b01".U  // jump
420    def I = "b10".U  // indirect
421    def R = "b11".U  // return
422
423    def apply() = UInt(2.W)
424  }
425
426  object SelImm {
427    def IMM_X  = "b0111".U
428    def IMM_S  = "b0000".U
429    def IMM_SB = "b0001".U
430    def IMM_U  = "b0010".U
431    def IMM_UJ = "b0011".U
432    def IMM_I  = "b0100".U
433    def IMM_Z  = "b0101".U
434    def INVALID_INSTR = "b0110".U
435    def IMM_B6 = "b1000".U
436
437    def apply() = UInt(4.W)
438  }
439
440  def dividerGen(p: Parameters) = new SRT16Divider(p(XLen))(p)
441  def multiplierGen(p: Parameters) = new ArrayMultiplier(p(XLen) + 1)(p)
442  def aluGen(p: Parameters) = new Alu()(p)
443  def bmuGen(p: Parameters) = new Bmu()(p)
444  def jmpGen(p: Parameters) = new Jump()(p)
445  def fenceGen(p: Parameters) = new Fence()(p)
446  def csrGen(p: Parameters) = new CSR()(p)
447  def i2fGen(p: Parameters) = new IntToFP()(p)
448  def fmacGen(p: Parameters) = new FMA()(p)
449  def f2iGen(p: Parameters) = new FPToInt()(p)
450  def f2fGen(p: Parameters) = new FPToFP()(p)
451  def fdivSqrtGen(p: Parameters) = new FDivSqrt()(p)
452  def stdGen(p: Parameters) = new Std()(p)
453
454  def f2iSel(uop: MicroOp): Bool = {
455    uop.ctrl.rfWen
456  }
457
458  def i2fSel(uop: MicroOp): Bool = {
459    uop.ctrl.fpu.fromInt
460  }
461
462  def f2fSel(uop: MicroOp): Bool = {
463    val ctrl = uop.ctrl.fpu
464    ctrl.fpWen && !ctrl.div && !ctrl.sqrt
465  }
466
467  def fdivSqrtSel(uop: MicroOp): Bool = {
468    val ctrl = uop.ctrl.fpu
469    ctrl.div || ctrl.sqrt
470  }
471
472  val aluCfg = FuConfig(
473    name = "alu",
474    fuGen = aluGen,
475    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.alu,
476    fuType = FuType.alu,
477    numIntSrc = 2,
478    numFpSrc = 0,
479    writeIntRf = true,
480    writeFpRf = false,
481    hasRedirect = true,
482  )
483
484  val jmpCfg = FuConfig(
485    name = "jmp",
486    fuGen = jmpGen,
487    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.jmp,
488    fuType = FuType.jmp,
489    numIntSrc = 1,
490    numFpSrc = 0,
491    writeIntRf = true,
492    writeFpRf = false,
493    hasRedirect = true,
494  )
495
496  val fenceCfg = FuConfig(
497    name = "fence",
498    fuGen = fenceGen,
499    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.fence,
500    FuType.fence, 1, 0, writeIntRf = false, writeFpRf = false, hasRedirect = false,
501    latency = UncertainLatency(), // TODO: need rewrite latency structure, not just this value,
502    hasExceptionOut = true
503  )
504
505  val csrCfg = FuConfig(
506    name = "csr",
507    fuGen = csrGen,
508    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.csr,
509    fuType = FuType.csr,
510    numIntSrc = 1,
511    numFpSrc = 0,
512    writeIntRf = true,
513    writeFpRf = false,
514    hasRedirect = false,
515    hasExceptionOut = true
516  )
517
518  val i2fCfg = FuConfig(
519    name = "i2f",
520    fuGen = i2fGen,
521    fuSel = i2fSel,
522    FuType.i2f,
523    numIntSrc = 1,
524    numFpSrc = 0,
525    writeIntRf = false,
526    writeFpRf = true,
527    hasRedirect = false,
528    latency = CertainLatency(2),
529    fastUopOut = true, fastImplemented = true
530  )
531
532  val divCfg = FuConfig(
533    name = "div",
534    fuGen = dividerGen,
535    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.div,
536    FuType.div,
537    2,
538    0,
539    writeIntRf = true,
540    writeFpRf = false,
541    hasRedirect = false,
542    latency = UncertainLatency(),
543    fastUopOut = true,
544    fastImplemented = false
545  )
546
547  val mulCfg = FuConfig(
548    name = "mul",
549    fuGen = multiplierGen,
550    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.mul,
551    FuType.mul,
552    2,
553    0,
554    writeIntRf = true,
555    writeFpRf = false,
556    hasRedirect = false,
557    latency = CertainLatency(2),
558    fastUopOut = true,
559    fastImplemented = true
560  )
561
562  val bmuCfg = FuConfig(
563    name = "bmu",
564    fuGen = bmuGen,
565    fuSel = (uop: MicroOp) => uop.ctrl.fuType === FuType.bmu,
566    fuType = FuType.bmu,
567    numIntSrc = 2,
568    numFpSrc = 0,
569    writeIntRf = true,
570    writeFpRf = false,
571    hasRedirect = false,
572    latency = CertainLatency(1),
573    fastUopOut = true,
574    fastImplemented = true
575 )
576
577  val fmacCfg = FuConfig(
578    name = "fmac",
579    fuGen = fmacGen,
580    fuSel = _ => true.B,
581    FuType.fmac, 0, 3, writeIntRf = false, writeFpRf = true, hasRedirect = false,
582    latency = UncertainLatency(), fastUopOut = true, fastImplemented = true
583  )
584
585  val f2iCfg = FuConfig(
586    name = "f2i",
587    fuGen = f2iGen,
588    fuSel = f2iSel,
589    FuType.fmisc, 0, 1, writeIntRf = true, writeFpRf = false, hasRedirect = false, CertainLatency(2),
590    fastUopOut = true, fastImplemented = true
591  )
592
593  val f2fCfg = FuConfig(
594    name = "f2f",
595    fuGen = f2fGen,
596    fuSel = f2fSel,
597    FuType.fmisc, 0, 1, writeIntRf = false, writeFpRf = true, hasRedirect = false, CertainLatency(2),
598    fastUopOut = true, fastImplemented = true
599  )
600
601  val fdivSqrtCfg = FuConfig(
602    name = "fdivSqrt",
603    fuGen = fdivSqrtGen,
604    fuSel = fdivSqrtSel,
605    FuType.fDivSqrt, 0, 2, writeIntRf = false, writeFpRf = true, hasRedirect = false, UncertainLatency(),
606    fastUopOut = true, fastImplemented = false, hasInputBuffer = true
607  )
608
609  val lduCfg = FuConfig(
610    "ldu",
611    null, // DontCare
612    null,
613    FuType.ldu, 1, 0, writeIntRf = true, writeFpRf = true, hasRedirect = false,
614    latency = UncertainLatency(), hasExceptionOut = true
615  )
616
617  val staCfg = FuConfig(
618    "sta",
619    null,
620    null,
621    FuType.stu, 1, 0, writeIntRf = false, writeFpRf = false, hasRedirect = false,
622    latency = UncertainLatency(), hasExceptionOut = true
623  )
624
625  val stdCfg = FuConfig(
626    "std",
627    fuGen = stdGen, fuSel = _ => true.B, FuType.stu, 1, 1,
628    writeIntRf = false, writeFpRf = false, hasRedirect = false, latency = CertainLatency(1)
629  )
630
631  val mouCfg = FuConfig(
632    "mou",
633    null,
634    null,
635    FuType.mou, 1, 0, writeIntRf = false, writeFpRf = false, hasRedirect = false,
636    latency = UncertainLatency(), hasExceptionOut = true
637  )
638
639  val JumpExeUnitCfg = ExuConfig("JmpExeUnit", "Int", Seq(jmpCfg, i2fCfg), 2, Int.MaxValue)
640  val AluExeUnitCfg = ExuConfig("AluExeUnit", "Int", Seq(aluCfg), 0, Int.MaxValue)
641  val JumpCSRExeUnitCfg = ExuConfig("JmpCSRExeUnit", "Int", Seq(jmpCfg, csrCfg, fenceCfg, i2fCfg), 2, Int.MaxValue)
642  val MulDivExeUnitCfg = ExuConfig("MulDivExeUnit", "Int", Seq(mulCfg, divCfg, bmuCfg), 1, Int.MaxValue)
643  val FmacExeUnitCfg = ExuConfig("FmacExeUnit", "Fp", Seq(fmacCfg), Int.MaxValue, 0)
644  val FmiscExeUnitCfg = ExuConfig(
645    "FmiscExeUnit",
646    "Fp",
647    Seq(f2iCfg, f2fCfg, fdivSqrtCfg),
648    Int.MaxValue, 1
649  )
650  val LdExeUnitCfg = ExuConfig("LoadExu", "Mem", Seq(lduCfg), wbIntPriority = 0, wbFpPriority = 0)
651  val StaExeUnitCfg = ExuConfig("StaExu", "Mem", Seq(staCfg, mouCfg), wbIntPriority = Int.MaxValue, wbFpPriority = Int.MaxValue)
652  val StdExeUnitCfg = ExuConfig("StdExu", "Mem", Seq(stdCfg), wbIntPriority = Int.MaxValue, wbFpPriority = Int.MaxValue)
653}
654