| 1 |
;; Scheduling description for Sifive p600 series. |
| 2 |
|
| 3 |
;; Sifive p600 series is a quad-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_p600_iex,sifive_p600_fex,sifive_p600_mem,sifive_p600_div") |
| 29 |
|
| 30 |
;; The Sifive p600 has 7 pipelines: |
| 31 |
;; A-pipe Load, Store |
| 32 |
;; B1-pipe ALU, Branch |
| 33 |
;; B2-pipe ALU, Branch |
| 34 |
;; M-pipe ALU, MUL, DIV and I2F(integer to float instruction) |
| 35 |
;; C-pipe ALU, Conditional move and system for coprocessor accesses |
| 36 |
;; F-pipe FPU, MUL, F2I(float to integer instruction) |
| 37 |
;; FM-pipe FPU, MUL, DIV |
| 38 |
|
| 39 |
(define_cpu_unit "sifive_p600_A" "sifive_p600_mem") |
| 40 |
(define_cpu_unit "sifive_p600_B1" "sifive_p600_iex") |
| 41 |
(define_cpu_unit "sifive_p600_B2" "sifive_p600_iex") |
| 42 |
(define_cpu_unit "sifive_p600_M" "sifive_p600_iex") |
| 43 |
(define_cpu_unit "sifive_p600_C" "sifive_p600_iex") |
| 44 |
(define_cpu_unit "sifive_p600_F" "sifive_p600_fex") |
| 45 |
(define_cpu_unit "sifive_p600_FM" "sifive_p600_fex") |
| 46 |
|
| 47 |
;; Load and store unit. |
| 48 |
(define_cpu_unit "sifive_p600_ld" "sifive_p600_mem") |
| 49 |
(define_cpu_unit "sifive_p600_st" "sifive_p600_mem") |
| 50 |
|
| 51 |
;; Branch unit. |
| 52 |
(define_cpu_unit "sifive_p600_bru" "sifive_p600_iex") |
| 53 |
|
| 54 |
;; Integer and multiply unit. |
| 55 |
(define_cpu_unit "sifive_p600_ialu" "sifive_p600_iex") |
| 56 |
(define_cpu_unit "sifive_p600_imul" "sifive_p600_iex") |
| 57 |
(define_cpu_unit "sifive_p600_system" "sifive_p600_iex") |
| 58 |
|
| 59 |
;; Divide unit. |
| 60 |
(define_cpu_unit "sifive_p600_idiv" "sifive_p600_div") |
| 61 |
(define_cpu_unit "sifive_p600_fdiv" "sifive_p600_div") |
| 62 |
|
| 63 |
;; Float and multiply unit. |
| 64 |
(define_cpu_unit "sifive_p600_fmul" "sifive_p600_fex") |
| 65 |
(define_cpu_unit "sifive_p600_fpu" "sifive_p600_fex") |
| 66 |
|
| 67 |
;; ALU instruction can use pipeline C, B1, B2 and M. |
| 68 |
(define_reservation "int_pipe" "(sifive_p600_C|sifive_p600_B1|sifive_p600_B2|sifive_p600_M)") |
| 69 |
;; FPU instruction can use pipeline F and FM. |
| 70 |
(define_reservation "float_pipe" "(sifive_p600_F|sifive_p600_FM)") |
| 71 |
;; Branch instruction can use pipeline B1 and B2. |
| 72 |
(define_reservation "branch_pipe" "(sifive_p600_B1|sifive_p600_B2)") |
| 73 |
|
| 74 |
(define_insn_reservation "sifive_p600_load" 3 |
| 75 |
(and (eq_attr "tune" "sifive_p600") |
| 76 |
(eq_attr "type" "load")) |
| 77 |
"sifive_p600_A,sifive_p600_ld*2") |
| 78 |
|
| 79 |
(define_insn_reservation "sifive_p600_fpload" 4 |
| 80 |
(and (eq_attr "tune" "sifive_p600") |
| 81 |
(eq_attr "type" "fpload")) |
| 82 |
"sifive_p600_A,sifive_p600_ld*3") |
| 83 |
|
| 84 |
(define_insn_reservation "sifive_p600_store" 1 |
| 85 |
(and (eq_attr "tune" "sifive_p600") |
| 86 |
(eq_attr "type" "store")) |
| 87 |
"sifive_p600_A+sifive_p600_st") |
| 88 |
|
| 89 |
(define_insn_reservation "sifive_p600_fpstore" 1 |
| 90 |
(and (eq_attr "tune" "sifive_p600") |
| 91 |
(eq_attr "type" "fpstore")) |
| 92 |
"sifive_p600_A+sifive_p600_st") |
| 93 |
|
| 94 |
(define_insn_reservation "sifive_p600_branch" 1 |
| 95 |
(and (eq_attr "tune" "sifive_p600") |
| 96 |
(eq_attr "type" "branch,jump,call,jalr,ret,trap")) |
| 97 |
"branch_pipe+sifive_p600_bru") |
| 98 |
|
| 99 |
(define_insn_reservation "sifive_p600_sfb_alu" 1 |
| 100 |
(and (eq_attr "tune" "sifive_p600") |
| 101 |
(eq_attr "type" "sfb_alu")) |
| 102 |
"sifive_p600_C+sifive_p600_bru+sifive_p600_ialu") |
| 103 |
|
| 104 |
(define_insn_reservation "sifive_p600_atomic" 3 |
| 105 |
(and (eq_attr "tune" "sifive_p600") |
| 106 |
(eq_attr "type" "atomic")) |
| 107 |
"sifive_p600_C,sifive_p600_system*2") |
| 108 |
|
| 109 |
(define_insn_reservation "sifive_p600_mul" 3 |
| 110 |
(and (eq_attr "tune" "sifive_p600") |
| 111 |
(eq_attr "type" "imul")) |
| 112 |
"sifive_p600_M,sifive_p600_imul*2") |
| 113 |
|
| 114 |
(define_insn_reservation "sifive_p600_div" 16 |
| 115 |
(and (eq_attr "tune" "sifive_p600") |
| 116 |
(eq_attr "type" "idiv")) |
| 117 |
"sifive_p600_M, sifive_p600_idiv*4") |
| 118 |
|
| 119 |
(define_insn_reservation "sifive_p600_alu" 1 |
| 120 |
(and (eq_attr "tune" "sifive_p600") |
| 121 |
(eq_attr "type" "unknown,arith,logical,shift,slt,multi,bitmanip,\ |
| 122 |
clz,ctz,rotate,min,max,minu,maxu,condmove,mvpair,zicond")) |
| 123 |
"int_pipe+sifive_p600_ialu") |
| 124 |
|
| 125 |
(define_insn_reservation "sifive_p600_cpop" 3 |
| 126 |
(and (eq_attr "tune" "sifive_p600") |
| 127 |
(eq_attr "type" "cpop")) |
| 128 |
"int_pipe,sifive_p600_ialu*2") |
| 129 |
|
| 130 |
(define_insn_reservation "sifive_p600_clmul" 3 |
| 131 |
(and (eq_attr "tune" "sifive_p600") |
| 132 |
(eq_attr "type" "clmul")) |
| 133 |
"int_pipe,sifive_p600_ialu*2") |
| 134 |
|
| 135 |
(define_insn_reservation "sifive_p600_load_immediate" 1 |
| 136 |
(and (eq_attr "tune" "sifive_p600") |
| 137 |
(eq_attr "type" "nop,const,auipc,move")) |
| 138 |
"int_pipe") |
| 139 |
|
| 140 |
(define_insn_reservation "sifive_p600_fma" 4 |
| 141 |
(and (eq_attr "tune" "sifive_p600") |
| 142 |
(eq_attr "type" "fadd,fmul,fmadd")) |
| 143 |
"float_pipe,sifive_p600_fmul*3") |
| 144 |
|
| 145 |
(define_insn_reservation "sifive_p600_i2f" 2 |
| 146 |
(and (eq_attr "tune" "sifive_p600") |
| 147 |
(eq_attr "type" "mtc,fcvt_i2f")) |
| 148 |
"sifive_p600_M,sifive_p600_ialu") |
| 149 |
|
| 150 |
(define_insn_reservation "sifive_p600_f2i" 2 |
| 151 |
(and (eq_attr "tune" "sifive_p600") |
| 152 |
(eq_attr "type" "mfc,fcmp,fcvt_f2i")) |
| 153 |
"sifive_p600_F,sifive_p600_fpu") |
| 154 |
|
| 155 |
(define_insn_reservation "sifive_p600_fmove" 2 |
| 156 |
(and (eq_attr "tune" "sifive_p600") |
| 157 |
(eq_attr "type" "fmove,fcvt")) |
| 158 |
"float_pipe,sifive_p600_fpu") |
| 159 |
|
| 160 |
(define_insn_reservation "sifive_p600_fdiv_s" 11 |
| 161 |
(and (eq_attr "tune" "sifive_p600") |
| 162 |
(eq_attr "type" "fdiv,fsqrt") |
| 163 |
(eq_attr "mode" "SF")) |
| 164 |
"sifive_p600_FM, sifive_p600_fdiv*5") |
| 165 |
|
| 166 |
(define_insn_reservation "sifive_p600_fdiv_d" 19 |
| 167 |
(and (eq_attr "tune" "sifive_p600") |
| 168 |
(eq_attr "type" "fdiv,fsqrt") |
| 169 |
(eq_attr "mode" "DF")) |
| 170 |
"sifive_p600_FM, sifive_p600_fdiv*5") |
| 171 |
|
| 172 |
(define_bypass 1 "sifive_p600_load,sifive_p600_alu,sifive_p600_mul,sifive_p600_sfb_alu" |
| 173 |
"sifive_p600_alu,sifive_p600_branch") |
| 174 |
|
| 175 |
(define_bypass 1 "sifive_p600_load,sifive_p600_alu,sifive_p600_mul, |
| 176 |
sifive_p600_f2i,sifive_p600_fmove,sifive_p600_sfb_alu" |
| 177 |
"sifive_p600_store" "riscv_store_data_bypass_p") |
| 178 |
|
| 179 |
(define_bypass 1 "sifive_p600_i2f" |
| 180 |
"sifive_p600_fma,sifive_p600_f2i,sifive_p600_fmove,sifive_p600_fdiv_s,sifive_p600_fdiv_d") |
| 181 |
|
| 182 |
(define_bypass 1 "sifive_p600_f2i" |
| 183 |
"sifive_p600_branch,sifive_p600_sfb_alu,sifive_p600_mul, |
| 184 |
sifive_p600_div,sifive_p600_alu,sifive_p600_cpop") |