1 |
709 |
jeremybenn |
;; Faraday FA626TE Pipeline Description
|
2 |
|
|
;; Copyright (C) 2010 Free Software Foundation, Inc.
|
3 |
|
|
;; Written by Mingfeng Wu, based on ARM926EJ-S Pipeline Description.
|
4 |
|
|
;;
|
5 |
|
|
;; This file is part of GCC.
|
6 |
|
|
;;
|
7 |
|
|
;; GCC is free software; you can redistribute it and/or modify it under
|
8 |
|
|
;; the terms of the GNU General Public License as published by the Free
|
9 |
|
|
;; Software Foundation; either version 3, or (at your option) any later
|
10 |
|
|
;; version.
|
11 |
|
|
;;
|
12 |
|
|
;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
13 |
|
|
;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14 |
|
|
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15 |
|
|
;; for more details.
|
16 |
|
|
;;
|
17 |
|
|
;; You should have received a copy of the GNU General Public License
|
18 |
|
|
;; along with GCC; see the file COPYING3. If not see
|
19 |
|
|
;; . */
|
20 |
|
|
|
21 |
|
|
;; These descriptions are based on the information contained in the
|
22 |
|
|
;; FMP626 Core Design Note, Copyright (c) 2010 Faraday Technology Corp.
|
23 |
|
|
|
24 |
|
|
;; Pipeline architecture
|
25 |
|
|
;; S E M W(Q1) Q2
|
26 |
|
|
;; ___________________________________________
|
27 |
|
|
;; shifter alu
|
28 |
|
|
;; mul1 mul2 mul3
|
29 |
|
|
;; ld/st1 ld/st2 ld/st3 ld/st4 ld/st5
|
30 |
|
|
|
31 |
|
|
;; This automaton provides a pipeline description for the Faraday
|
32 |
|
|
;; FMP626 core.
|
33 |
|
|
;;
|
34 |
|
|
;; The model given here assumes that the condition for all conditional
|
35 |
|
|
;; instructions is "true", i.e., that all of the instructions are
|
36 |
|
|
;; actually executed.
|
37 |
|
|
|
38 |
|
|
(define_automaton "fmp626")
|
39 |
|
|
|
40 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
41 |
|
|
;; Pipelines
|
42 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
43 |
|
|
|
44 |
|
|
;; There is a single pipeline
|
45 |
|
|
;;
|
46 |
|
|
;; The ALU pipeline has fetch, decode, execute, memory, and
|
47 |
|
|
;; write stages. We only need to model the execute, memory and write
|
48 |
|
|
;; stages.
|
49 |
|
|
|
50 |
|
|
(define_cpu_unit "fmp626_core" "fmp626")
|
51 |
|
|
|
52 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
53 |
|
|
;; ALU Instructions
|
54 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
55 |
|
|
|
56 |
|
|
;; ALU instructions require two cycles to execute, and use the ALU
|
57 |
|
|
;; pipeline in each of the three stages. The results are available
|
58 |
|
|
;; after the execute stage stage has finished.
|
59 |
|
|
;;
|
60 |
|
|
;; If the destination register is the PC, the pipelines are stalled
|
61 |
|
|
;; for several cycles. That case is not modeled here.
|
62 |
|
|
|
63 |
|
|
;; ALU operations
|
64 |
|
|
(define_insn_reservation "mp626_alu_op" 1
|
65 |
|
|
(and (eq_attr "tune" "fmp626")
|
66 |
|
|
(eq_attr "type" "alu"))
|
67 |
|
|
"fmp626_core")
|
68 |
|
|
|
69 |
|
|
(define_insn_reservation "mp626_alu_shift_op" 2
|
70 |
|
|
(and (eq_attr "tune" "fmp626")
|
71 |
|
|
(eq_attr "type" "alu_shift,alu_shift_reg"))
|
72 |
|
|
"fmp626_core")
|
73 |
|
|
|
74 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
75 |
|
|
;; Multiplication Instructions
|
76 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
77 |
|
|
|
78 |
|
|
(define_insn_reservation "mp626_mult1" 2
|
79 |
|
|
(and (eq_attr "tune" "fmp626")
|
80 |
|
|
(eq_attr "insn" "smulwy,smlawy,smulxy,smlaxy"))
|
81 |
|
|
"fmp626_core")
|
82 |
|
|
|
83 |
|
|
(define_insn_reservation "mp626_mult2" 2
|
84 |
|
|
(and (eq_attr "tune" "fmp626")
|
85 |
|
|
(eq_attr "insn" "mul,mla"))
|
86 |
|
|
"fmp626_core")
|
87 |
|
|
|
88 |
|
|
(define_insn_reservation "mp626_mult3" 3
|
89 |
|
|
(and (eq_attr "tune" "fmp626")
|
90 |
|
|
(eq_attr "insn" "muls,mlas,smull,smlal,umull,umlal,smlalxy,smlawx"))
|
91 |
|
|
"fmp626_core*2")
|
92 |
|
|
|
93 |
|
|
(define_insn_reservation "mp626_mult4" 4
|
94 |
|
|
(and (eq_attr "tune" "fmp626")
|
95 |
|
|
(eq_attr "insn" "smulls,smlals,umulls,umlals"))
|
96 |
|
|
"fmp626_core*3")
|
97 |
|
|
|
98 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
99 |
|
|
;; Load/Store Instructions
|
100 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
101 |
|
|
|
102 |
|
|
;; The models for load/store instructions do not accurately describe
|
103 |
|
|
;; the difference between operations with a base register writeback
|
104 |
|
|
;; (such as "ldm!"). These models assume that all memory references
|
105 |
|
|
;; hit in dcache.
|
106 |
|
|
|
107 |
|
|
(define_insn_reservation "mp626_load1_op" 5
|
108 |
|
|
(and (eq_attr "tune" "fmp626")
|
109 |
|
|
(eq_attr "type" "load1,load_byte"))
|
110 |
|
|
"fmp626_core")
|
111 |
|
|
|
112 |
|
|
(define_insn_reservation "mp626_load2_op" 6
|
113 |
|
|
(and (eq_attr "tune" "fmp626")
|
114 |
|
|
(eq_attr "type" "load2,load3"))
|
115 |
|
|
"fmp626_core*2")
|
116 |
|
|
|
117 |
|
|
(define_insn_reservation "mp626_load3_op" 7
|
118 |
|
|
(and (eq_attr "tune" "fmp626")
|
119 |
|
|
(eq_attr "type" "load4"))
|
120 |
|
|
"fmp626_core*3")
|
121 |
|
|
|
122 |
|
|
(define_insn_reservation "mp626_store1_op" 0
|
123 |
|
|
(and (eq_attr "tune" "fmp626")
|
124 |
|
|
(eq_attr "type" "store1"))
|
125 |
|
|
"fmp626_core")
|
126 |
|
|
|
127 |
|
|
(define_insn_reservation "mp626_store2_op" 1
|
128 |
|
|
(and (eq_attr "tune" "fmp626")
|
129 |
|
|
(eq_attr "type" "store2,store3"))
|
130 |
|
|
"fmp626_core*2")
|
131 |
|
|
|
132 |
|
|
(define_insn_reservation "mp626_store3_op" 2
|
133 |
|
|
(and (eq_attr "tune" "fmp626")
|
134 |
|
|
(eq_attr "type" "store4"))
|
135 |
|
|
"fmp626_core*3")
|
136 |
|
|
|
137 |
|
|
(define_bypass 1 "mp626_load1_op,mp626_load2_op,mp626_load3_op"
|
138 |
|
|
"mp626_store1_op,mp626_store2_op,mp626_store3_op"
|
139 |
|
|
"arm_no_early_store_addr_dep")
|
140 |
|
|
(define_bypass 1 "mp626_alu_op,mp626_alu_shift_op,mp626_mult1,mp626_mult2,\
|
141 |
|
|
mp626_mult3,mp626_mult4" "mp626_store1_op"
|
142 |
|
|
"arm_no_early_store_addr_dep")
|
143 |
|
|
(define_bypass 1 "mp626_alu_shift_op" "mp626_alu_op")
|
144 |
|
|
(define_bypass 1 "mp626_alu_shift_op" "mp626_alu_shift_op"
|
145 |
|
|
"arm_no_early_alu_shift_dep")
|
146 |
|
|
(define_bypass 1 "mp626_mult1,mp626_mult2" "mp626_alu_shift_op"
|
147 |
|
|
"arm_no_early_alu_shift_dep")
|
148 |
|
|
(define_bypass 2 "mp626_mult3" "mp626_alu_shift_op"
|
149 |
|
|
"arm_no_early_alu_shift_dep")
|
150 |
|
|
(define_bypass 3 "mp626_mult4" "mp626_alu_shift_op"
|
151 |
|
|
"arm_no_early_alu_shift_dep")
|
152 |
|
|
(define_bypass 1 "mp626_mult1,mp626_mult2" "mp626_alu_op")
|
153 |
|
|
(define_bypass 2 "mp626_mult3" "mp626_alu_op")
|
154 |
|
|
(define_bypass 3 "mp626_mult4" "mp626_alu_op")
|
155 |
|
|
(define_bypass 4 "mp626_load1_op" "mp626_alu_op")
|
156 |
|
|
(define_bypass 5 "mp626_load2_op" "mp626_alu_op")
|
157 |
|
|
(define_bypass 6 "mp626_load3_op" "mp626_alu_op")
|
158 |
|
|
|
159 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
160 |
|
|
;; Branch and Call Instructions
|
161 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
162 |
|
|
|
163 |
|
|
;; Branch instructions are difficult to model accurately. The FMP626
|
164 |
|
|
;; core can predict most branches. If the branch is predicted
|
165 |
|
|
;; correctly, and predicted early enough, the branch can be completely
|
166 |
|
|
;; eliminated from the instruction stream. Some branches can
|
167 |
|
|
;; therefore appear to require zero cycle to execute. We assume that
|
168 |
|
|
;; all branches are predicted correctly, and that the latency is
|
169 |
|
|
;; therefore the minimum value.
|
170 |
|
|
|
171 |
|
|
(define_insn_reservation "mp626_branch_op" 0
|
172 |
|
|
(and (eq_attr "tune" "fmp626")
|
173 |
|
|
(eq_attr "type" "branch"))
|
174 |
|
|
"fmp626_core")
|
175 |
|
|
|
176 |
|
|
;; The latency for a call is actually the latency when the result is available.
|
177 |
|
|
;; i.e. R0 ready for int return value.
|
178 |
|
|
(define_insn_reservation "mp626_call_op" 1
|
179 |
|
|
(and (eq_attr "tune" "fmp626")
|
180 |
|
|
(eq_attr "type" "call"))
|
181 |
|
|
"fmp626_core")
|
182 |
|
|
|