| 1 |
;; Scheduling description for Sifive p400. |
| 2 |
|
| 3 |
;; Sifive p400 series is a triple-issue, superscalar, out-of-order processor. |
| 4 |
|
| 5 |
;; CPU execution units: |
| 6 |
;; ialu Integer Units: all arithmetic and logic. |
| 7 |
;; |
| 8 |
;; bru Branch Resolution Unit: all branches. |
| 9 |
;; |
| 10 |
;; st Memory Write Unit: all writes to memory. |
| 11 |
;; |
| 12 |
;; ld Memory Read Unit: all reads from memory. |
| 13 |
;; |
| 14 |
;; imul Integer Multiply Unit |
| 15 |
;; |
| 16 |
;; idiv Integer Divide Unit |
| 17 |
;; |
| 18 |
;; system System Unit: all coprocessor accesses. |
| 19 |
;; |
| 20 |
;; fpu Floating Point Unit |
| 21 |
;; |
| 22 |
;; fmul Floating Point Multiply Unit |
| 23 |
;; |
| 24 |
;; fdiv Floating Point Divide Unit |
| 25 |
|
| 26 |
;; Four automata are defined to reduce number of states |
| 27 |
;; which a single large automaton will have. |
| 28 |
(define_automaton "sifive_p400_iex,sifive_p400_fex,sifive_p400_mem,sifive_p400_div") |
| 29 |
|
| 30 |
;; The Sifive p400 has six pipelines: |
| 31 |
;; A-pipe Load, Store |
| 32 |
;; B-pipe ALU, Branch |
| 33 |
;; M-pipe ALU, MUL, DIV and I2F(integer to float instruction) |
| 34 |
;; C-pipe ALU, Conditional move and system for coprocessor accesses |
| 35 |
;; F-pipe FPU, MUL, F2I(float to integer instruction) |
| 36 |
;; FM-pipe FPU, MUL, DIV |
| 37 |
|
| 38 |
(define_cpu_unit "sifive_p400_A" "sifive_p400_mem") |
| 39 |
(define_cpu_unit "sifive_p400_B" "sifive_p400_iex") |
| 40 |
(define_cpu_unit "sifive_p400_M" "sifive_p400_iex") |
| 41 |
(define_cpu_unit "sifive_p400_C" "sifive_p400_iex") |
| 42 |
(define_cpu_unit "sifive_p400_F" "sifive_p400_fex") |
| 43 |
(define_cpu_unit "sifive_p400_FM" "sifive_p400_fex") |
| 44 |
|
| 45 |
;; Load and store unit. |
| 46 |
(define_cpu_unit "sifive_p400_ld" "sifive_p400_mem") |
| 47 |
(define_cpu_unit "sifive_p400_st" "sifive_p400_mem") |
| 48 |
|
| 49 |
;; Branch unit. |
| 50 |
(define_cpu_unit "sifive_p400_bru" "sifive_p400_iex") |
| 51 |
|
| 52 |
;; Integer and multiply unit. |
| 53 |
(define_cpu_unit "sifive_p400_ialu" "sifive_p400_iex") |
| 54 |
(define_cpu_unit "sifive_p400_imul" "sifive_p400_iex") |
| 55 |
(define_cpu_unit "sifive_p400_system" "sifive_p400_iex") |
| 56 |
|
| 57 |
;; Divide unit. |
| 58 |
(define_cpu_unit "sifive_p400_idiv" "sifive_p400_div") |
| 59 |
(define_cpu_unit "sifive_p400_fdiv" "sifive_p400_div") |
| 60 |
|
| 61 |
;; Float and multiply unit. |
| 62 |
(define_cpu_unit "sifive_p400_fmul" "sifive_p400_fex") |
| 63 |
(define_cpu_unit "sifive_p400_fpu" "sifive_p400_fex") |
| 64 |
|
| 65 |
;; ALU instruction can use pipeline C, B and M. |
| 66 |
(define_reservation "p400_int_pipe" "(sifive_p400_C|sifive_p400_B|sifive_p400_M)") |
| 67 |
;; FPU instruction can use pipeline F and FM. |
| 68 |
(define_reservation "p400_float_pipe" "(sifive_p400_F|sifive_p400_FM)") |
| 69 |
|
| 70 |
(define_insn_reservation "sifive_p400_load" 3 |
| 71 |
(and (eq_attr "tune" "sifive_p400") |
| 72 |
(eq_attr "type" "load")) |
| 73 |
"sifive_p400_A,sifive_p400_ld*2") |
| 74 |
|
| 75 |
(define_insn_reservation "sifive_p400_fpload" 4 |
| 76 |
(and (eq_attr "tune" "sifive_p400") |
| 77 |
(eq_attr "type" "fpload")) |
| 78 |
"sifive_p400_A,sifive_p400_ld*3") |
| 79 |
|
| 80 |
(define_insn_reservation "sifive_p400_store" 1 |
| 81 |
(and (eq_attr "tune" "sifive_p400") |
| 82 |
(eq_attr "type" "store")) |
| 83 |
"sifive_p400_A+sifive_p400_st") |
| 84 |
|
| 85 |
(define_insn_reservation "sifive_p400_fpstore" 1 |
| 86 |
(and (eq_attr "tune" "sifive_p400") |
| 87 |
(eq_attr "type" "fpstore")) |
| 88 |
"sifive_p400_A+sifive_p400_st") |
| 89 |
|
| 90 |
(define_insn_reservation "sifive_p400_branch" 1 |
| 91 |
(and (eq_attr "tune" "sifive_p400") |
| 92 |
(eq_attr "type" "branch,jump,call,jalr,ret,trap")) |
| 93 |
"sifive_p400_B+sifive_p400_bru") |
| 94 |
|
| 95 |
(define_insn_reservation "sifive_p400_sfb_alu" 1 |
| 96 |
(and (eq_attr "tune" "sifive_p400") |
| 97 |
(eq_attr "type" "sfb_alu")) |
| 98 |
"sifive_p400_C+sifive_p400_bru+sifive_p400_ialu") |
| 99 |
|
| 100 |
(define_insn_reservation "sifive_p400_atomic" 3 |
| 101 |
(and (eq_attr "tune" "sifive_p400") |
| 102 |
(eq_attr "type" "atomic")) |
| 103 |
"sifive_p400_C,sifive_p400_system*2") |
| 104 |
|
| 105 |
(define_insn_reservation "sifive_p400_mul" 3 |
| 106 |
(and (eq_attr "tune" "sifive_p400") |
| 107 |
(eq_attr "type" "imul")) |
| 108 |
"sifive_p400_M,sifive_p400_imul*2") |
| 109 |
|
| 110 |
(define_insn_reservation "sifive_p400_div" 31 |
| 111 |
(and (eq_attr "tune" "sifive_p400") |
| 112 |
(eq_attr "type" "idiv")) |
| 113 |
"sifive_p400_M, sifive_p400_idiv*5") |
| 114 |
|
| 115 |
(define_insn_reservation "sifive_p400_alu" 1 |
| 116 |
(and (eq_attr "tune" "sifive_p400") |
| 117 |
(eq_attr "type" "unknown,arith,logical,shift,slt,multi,bitmanip,\ |
| 118 |
clz,ctz,rotate,min,max,minu,maxu,condmove,mvpair,zicond")) |
| 119 |
"p400_int_pipe+sifive_p400_ialu") |
| 120 |
|
| 121 |
(define_insn_reservation "sifive_p400_cpop" 3 |
| 122 |
(and (eq_attr "tune" "sifive_p400") |
| 123 |
(eq_attr "type" "cpop")) |
| 124 |
"p400_int_pipe,sifive_p400_ialu*2") |
| 125 |
|
| 126 |
(define_insn_reservation "sifive_p400_clmul" 3 |
| 127 |
(and (eq_attr "tune" "sifive_p400") |
| 128 |
(eq_attr "type" "clmul")) |
| 129 |
"p400_int_pipe,sifive_p400_ialu*2") |
| 130 |
|
| 131 |
(define_insn_reservation "sifive_p400_load_immediate" 1 |
| 132 |
(and (eq_attr "tune" "sifive_p400") |
| 133 |
(eq_attr "type" "nop,const,auipc,move")) |
| 134 |
"p400_int_pipe") |
| 135 |
|
| 136 |
(define_insn_reservation "sifive_p400_fma" 4 |
| 137 |
(and (eq_attr "tune" "sifive_p400") |
| 138 |
(eq_attr "type" "fadd,fmul,fmadd")) |
| 139 |
"p400_float_pipe,sifive_p400_fmul*3") |
| 140 |
|
| 141 |
(define_insn_reservation "sifive_p400_i2f" 2 |
| 142 |
(and (eq_attr "tune" "sifive_p400") |
| 143 |
(eq_attr "type" "mtc,fcvt_i2f")) |
| 144 |
"sifive_p400_M,sifive_p400_ialu") |
| 145 |
|
| 146 |
(define_insn_reservation "sifive_p400_f2i" 2 |
| 147 |
(and (eq_attr "tune" "sifive_p400") |
| 148 |
(eq_attr "type" "mfc,fcmp,fcvt_f2i")) |
| 149 |
"sifive_p400_F,sifive_p400_fpu") |
| 150 |
|
| 151 |
(define_insn_reservation "sifive_p400_fmove" 2 |
| 152 |
(and (eq_attr "tune" "sifive_p400") |
| 153 |
(eq_attr "type" "fmove,fcvt")) |
| 154 |
"p400_float_pipe,sifive_p400_fpu") |
| 155 |
|
| 156 |
(define_insn_reservation "sifive_p400_fdiv_s" 18 |
| 157 |
(and (eq_attr "tune" "sifive_p400") |
| 158 |
(eq_attr "type" "fdiv,fsqrt") |
| 159 |
(eq_attr "mode" "SF")) |
| 160 |
"sifive_p400_FM, sifive_p400_fdiv*5") |
| 161 |
|
| 162 |
(define_insn_reservation "sifive_p400_fdiv_d" 31 |
| 163 |
(and (eq_attr "tune" "sifive_p400") |
| 164 |
(eq_attr "type" "fdiv,fsqrt") |
| 165 |
(eq_attr "mode" "DF")) |
| 166 |
"sifive_p400_FM, sifive_p400_fdiv*5") |
| 167 |
|
| 168 |
(define_bypass 1 "sifive_p400_load,sifive_p400_alu,sifive_p400_mul,sifive_p400_sfb_alu" |
| 169 |
"sifive_p400_alu,sifive_p400_branch") |
| 170 |
|
| 171 |
(define_bypass 1 "sifive_p400_load,sifive_p400_alu,sifive_p400_mul, |
| 172 |
sifive_p400_f2i,sifive_p400_fmove,sifive_p400_sfb_alu" |
| 173 |
"sifive_p400_store" "riscv_store_data_bypass_p") |
| 174 |
|
| 175 |
(define_bypass 1 "sifive_p400_i2f" |
| 176 |
"sifive_p400_fma,sifive_p400_f2i,sifive_p400_fmove,sifive_p400_fdiv_s,sifive_p400_fdiv_d") |
| 177 |
|
| 178 |
(define_bypass 1 "sifive_p400_f2i" |
| 179 |
"sifive_p400_branch,sifive_p400_sfb_alu,sifive_p400_mul, |
| 180 |
sifive_p400_div,sifive_p400_alu,sifive_p400_cpop") |