1 |
6 |
jlechner |
; Toshiba MeP Media Engine architecture description. -*- Scheme -*-
|
2 |
|
|
; Copyright (C) 2001, 2002 Red Hat, Inc.
|
3 |
|
|
; This file is part of CGEN.
|
4 |
|
|
; See file COPYING.CGEN for details.
|
5 |
|
|
|
6 |
|
|
; This file provides sample definitions for the UCI and DSP
|
7 |
|
|
; instructions. It is incorporated into the overall description by
|
8 |
|
|
; including it from a top-level file that includes all of the required
|
9 |
|
|
; option files.
|
10 |
|
|
|
11 |
|
|
; UCI option.
|
12 |
|
|
|
13 |
|
|
(define-pmacro mep-ext1-isa () (ISA ext_core1))
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
; uci instructions for ELFextension test
|
17 |
|
|
|
18 |
|
|
; uci.elfext.1 $simm16
|
19 |
|
|
; 1111_IIII_0000_0010 0001_iiii_iiii_iiii
|
20 |
|
|
; simm16 = I[4:7]||i[20:31]
|
21 |
|
|
|
22 |
|
|
; uci.elfext.2 $uimm16
|
23 |
|
|
; 1111_IIII_0000_0010 0010_iiii_iiii_iiii
|
24 |
|
|
; uimm16 = I[4:7]||i[20:31]
|
25 |
|
|
|
26 |
|
|
; define simm16
|
27 |
|
|
(df f-uci_elfext_1-hi "uci_elfext_1 simm16 hi 4s7" (mep-ext1-isa) 4 4 INT #f #f)
|
28 |
|
|
(df f-uci_elfext_1-lo "uci_elfext_1 simm16 lo 20s31" (mep-ext1-isa) 20 12 UINT #f #f)
|
29 |
|
|
(define-multi-ifield
|
30 |
|
|
(name f-uci_elfext_1)
|
31 |
|
|
(comment "16-bits uci_elfext_ signed constant")
|
32 |
|
|
(attrs mep-ext1-isa)
|
33 |
|
|
(mode INT)
|
34 |
|
|
(subfields f-uci_elfext_1-hi f-uci_elfext_1-lo)
|
35 |
|
|
(insert (sequence ()
|
36 |
|
|
(set (ifield f-uci_elfext_1-hi) (srl (ifield f-uci_elfext_1) 12))
|
37 |
|
|
(set (ifield f-uci_elfext_1-lo) (and (ifield f-uci_elfext_1) #xfff))))
|
38 |
|
|
(extract (set (ifield f-uci_elfext_1)
|
39 |
|
|
(or (sll (ifield f-uci_elfext_1-hi) 12)
|
40 |
|
|
(ifield f-uci_elfext_1-lo))))
|
41 |
|
|
)
|
42 |
|
|
(dpop uci_elfext_1simm16 "signed imm (16 bits)" (mep-ext1-isa) h-sint f-uci_elfext_1 "signed16")
|
43 |
|
|
|
44 |
|
|
; define uimm16
|
45 |
|
|
(df f-uci_elfext_2-hi "uci_elfext_2 uimm16 hi 4u7" (mep-ext1-isa) 4 4 UINT #f #f)
|
46 |
|
|
(df f-uci_elfext_2-lo "uci_elfext_2 uimm16 lo 20u31" (mep-ext1-isa) 20 12 UINT #f #f)
|
47 |
|
|
(define-multi-ifield
|
48 |
|
|
(name f-uci_elfext_2)
|
49 |
|
|
(comment "16-bits uci_elfext_ unsigned constant")
|
50 |
|
|
(attrs mep-ext1-isa)
|
51 |
|
|
(mode UINT)
|
52 |
|
|
(subfields f-uci_elfext_2-hi f-uci_elfext_2-lo)
|
53 |
|
|
(insert (sequence ()
|
54 |
|
|
(set (ifield f-uci_elfext_2-hi) (srl (ifield f-uci_elfext_2) 12))
|
55 |
|
|
(set (ifield f-uci_elfext_2-lo) (and (ifield f-uci_elfext_2) #xfff))))
|
56 |
|
|
(extract (set (ifield f-uci_elfext_2)
|
57 |
|
|
(or (sll (ifield f-uci_elfext_2-hi) 12)
|
58 |
|
|
(ifield f-uci_elfext_2-lo))))
|
59 |
|
|
)
|
60 |
|
|
(dpop uci_elfext_2uimm16 "unsigned imm (16 bits)" (mep-ext1-isa) h-uint f-uci_elfext_2 "unsigned16")
|
61 |
|
|
|
62 |
|
|
; define sub-opcode
|
63 |
|
|
(df f-uci_elfext-sub "sub-opcode for uci_elfext instructions" (mep-ext1-isa) 16 4 UINT #f #f)
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
; define instruction
|
67 |
|
|
(dni uci.elfext.1 "uci_elfext instruction 1" (OPTIONAL_UCI_INSN VOLATILE mep-ext1-isa)
|
68 |
|
|
"uci.elfext.1 $uci_elfext_1simm16"
|
69 |
|
|
(+ MAJ_15 (f-rm 0) (f-sub4 2) (f-uci_elfext-sub 1) uci_elfext_1simm16)
|
70 |
|
|
(c-call "check_option_uci" pc)
|
71 |
|
|
()
|
72 |
|
|
)
|
73 |
|
|
|
74 |
|
|
; define instruction
|
75 |
|
|
(dni uci.elfext.2 "uci_elfext instruction 1" (OPTIONAL_UCI_INSN VOLATILE mep-ext1-isa)
|
76 |
|
|
"uci.elfext.2 $uci_elfext_2uimm16"
|
77 |
|
|
(+ MAJ_15 (f-rm 0) (f-sub4 2) (f-uci_elfext-sub 2) uci_elfext_2uimm16)
|
78 |
|
|
(c-call "check_option_uci" pc)
|
79 |
|
|
()
|
80 |
|
|
)
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
;; some general samples
|
85 |
|
|
; UCI option.
|
86 |
|
|
|
87 |
|
|
(dni uci "user defined instruction" (OPTIONAL_UCI_INSN mep-ext1-isa)
|
88 |
|
|
"uci $rn,$rm,$code16"
|
89 |
|
|
(+ MAJ_15 rn rm (f-sub4 2) code16)
|
90 |
|
|
(sequence ()
|
91 |
|
|
(c-call "check_option_uci" pc)
|
92 |
|
|
(unimp "uci"))
|
93 |
|
|
())
|
94 |
|
|
|
95 |
|
|
; DSP option.
|
96 |
|
|
|
97 |
|
|
(dni dsp "dsp instruction" (OPTIONAL_DSP_INSN mep-ext1-isa)
|
98 |
|
|
"dsp $rn,$rm,$code16"
|
99 |
|
|
(+ MAJ_15 rn rm (f-sub4 0) code16)
|
100 |
|
|
(sequence ()
|
101 |
|
|
(c-call "check_option_dsp" pc)
|
102 |
|
|
(set pc (c-call USI "dsp_exception" pc)))
|
103 |
|
|
())
|