1 ;; Faraday FA526 Pipeline Description
2 ;; Copyright (C) 2010-2013 Free Software Foundation, Inc.
3 ;; Written by I-Jui Sung, based on ARM926EJ-S Pipeline Description.
5 ;; This file is part of GCC.
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
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
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 ;; <http://www.gnu.org/licenses/>. */
21 ;; These descriptions are based on the information contained in the
22 ;; FA526 Core Design Note, Copyright (c) 2010 Faraday Technology Corp.
24 ;; Modeled pipeline characteristics:
25 ;; LD -> any use: latency = 3 (2 cycle penalty).
26 ;; ALU -> any use: latency = 2 (1 cycle penalty).
28 ;; This automaton provides a pipeline description for the Faraday
31 ;; The model given here assumes that the condition for all conditional
32 ;; instructions is "true", i.e., that all of the instructions are
35 (define_automaton "fa526")
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41 ;; There is a single pipeline
43 ;; The ALU pipeline has fetch, decode, execute, memory, and
44 ;; write stages. We only need to model the execute, memory and write
49 (define_cpu_unit "fa526_core" "fa526")
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55 ;; ALU instructions require two cycles to execute, and use the ALU
56 ;; pipeline in each of the three stages. The results are available
57 ;; after the execute stage stage has finished.
59 ;; If the destination register is the PC, the pipelines are stalled
60 ;; for several cycles. That case is not modeled here.
63 (define_insn_reservation "526_alu_op" 1
64 (and (eq_attr "tune" "fa526")
65 (eq_attr "type" "arlo_imm,arlo_reg,shift,shift_reg"))
68 (define_insn_reservation "526_alu_shift_op" 2
69 (and (eq_attr "tune" "fa526")
70 (eq_attr "type" "extend,arlo_shift,arlo_shift_reg"))
73 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74 ;; Multiplication Instructions
75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77 (define_insn_reservation "526_mult1" 2
78 (and (eq_attr "tune" "fa526")
79 (eq_attr "type" "smlalxy,smulxy,smlaxy,smlalxy"))
82 (define_insn_reservation "526_mult2" 5
83 (and (eq_attr "tune" "fa526")
84 (eq_attr "type" "mul,mla,muls,mlas,umull,umlal,smull,smlal,umulls,\
85 umlals,smulls,smlals,smlawx"))
88 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
89 ;; Load/Store Instructions
90 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
92 ;; The models for load/store instructions do not accurately describe
93 ;; the difference between operations with a base register writeback
94 ;; (such as "ldm!"). These models assume that all memory references
97 (define_insn_reservation "526_load1_op" 3
98 (and (eq_attr "tune" "fa526")
99 (eq_attr "type" "load1,load_byte"))
102 (define_insn_reservation "526_load2_op" 4
103 (and (eq_attr "tune" "fa526")
104 (eq_attr "type" "load2"))
107 (define_insn_reservation "526_load3_op" 5
108 (and (eq_attr "tune" "fa526")
109 (eq_attr "type" "load3"))
112 (define_insn_reservation "526_load4_op" 6
113 (and (eq_attr "tune" "fa526")
114 (eq_attr "type" "load4"))
117 (define_insn_reservation "526_store1_op" 0
118 (and (eq_attr "tune" "fa526")
119 (eq_attr "type" "store1"))
122 (define_insn_reservation "526_store2_op" 1
123 (and (eq_attr "tune" "fa526")
124 (eq_attr "type" "store2"))
127 (define_insn_reservation "526_store3_op" 2
128 (and (eq_attr "tune" "fa526")
129 (eq_attr "type" "store3"))
132 (define_insn_reservation "526_store4_op" 3
133 (and (eq_attr "tune" "fa526")
134 (eq_attr "type" "store4"))
137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
138 ;; Branch and Call Instructions
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
141 ;; Branch instructions are difficult to model accurately. The FA526
142 ;; core can predict most branches. If the branch is predicted
143 ;; correctly, and predicted early enough, the branch can be completely
144 ;; eliminated from the instruction stream. Some branches can
145 ;; therefore appear to require zero cycle to execute. We assume that
146 ;; all branches are predicted correctly, and that the latency is
147 ;; therefore the minimum value.
149 (define_insn_reservation "526_branch_op" 0
150 (and (eq_attr "tune" "fa526")
151 (eq_attr "type" "branch"))
154 ;; The latency for a call is actually the latency when the result is available.
155 ;; i.e. R0 ready for int return value. For most cases, the return value is set
156 ;; by a mov instruction, which has 1 cycle latency.
157 (define_insn_reservation "526_call_op" 1
158 (and (eq_attr "tune" "fa526")
159 (eq_attr "type" "call"))