mep-sample-ucidsp.cpu 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ; Toshiba MeP Media Engine architecture description. -*- Scheme -*-
  2. ; Copyright 2011 Free Software Foundation, Inc.
  3. ;
  4. ; Contributed by Red Hat Inc;
  5. ;
  6. ; This file is part of the GNU Binutils.
  7. ;
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 3 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  21. ; MA 02110-1301, USA.
  22. ; This file provides sample definitions for the UCI and DSP
  23. ; instructions. It is incorporated into the overall description by
  24. ; including it from a top-level file that includes all of the required
  25. ; option files.
  26. ; UCI option.
  27. (define-pmacro mep-ext1-isa () (ISA ext_core1))
  28. ; uci instructions for ELFextension test
  29. ; uci.elfext.1 $simm16
  30. ; 1111_IIII_0000_0010 0001_iiii_iiii_iiii
  31. ; simm16 = I[4:7]||i[20:31]
  32. ; uci.elfext.2 $uimm16
  33. ; 1111_IIII_0000_0010 0010_iiii_iiii_iiii
  34. ; uimm16 = I[4:7]||i[20:31]
  35. ; define simm16
  36. (df f-uci_elfext_1-hi "uci_elfext_1 simm16 hi 4s7" (mep-ext1-isa) 4 4 INT #f #f)
  37. (df f-uci_elfext_1-lo "uci_elfext_1 simm16 lo 20s31" (mep-ext1-isa) 20 12 UINT #f #f)
  38. (define-multi-ifield
  39. (name f-uci_elfext_1)
  40. (comment "16-bits uci_elfext_ signed constant")
  41. (attrs mep-ext1-isa)
  42. (mode INT)
  43. (subfields f-uci_elfext_1-hi f-uci_elfext_1-lo)
  44. (insert (sequence ()
  45. (set (ifield f-uci_elfext_1-hi) (srl (ifield f-uci_elfext_1) 12))
  46. (set (ifield f-uci_elfext_1-lo) (and (ifield f-uci_elfext_1) #xfff))))
  47. (extract (set (ifield f-uci_elfext_1)
  48. (or (sll (ifield f-uci_elfext_1-hi) 12)
  49. (ifield f-uci_elfext_1-lo))))
  50. )
  51. (dpop uci_elfext_1simm16 "signed imm (16 bits)" (mep-ext1-isa) h-sint f-uci_elfext_1 "signed16")
  52. ; define uimm16
  53. (df f-uci_elfext_2-hi "uci_elfext_2 uimm16 hi 4u7" (mep-ext1-isa) 4 4 UINT #f #f)
  54. (df f-uci_elfext_2-lo "uci_elfext_2 uimm16 lo 20u31" (mep-ext1-isa) 20 12 UINT #f #f)
  55. (define-multi-ifield
  56. (name f-uci_elfext_2)
  57. (comment "16-bits uci_elfext_ unsigned constant")
  58. (attrs mep-ext1-isa)
  59. (mode UINT)
  60. (subfields f-uci_elfext_2-hi f-uci_elfext_2-lo)
  61. (insert (sequence ()
  62. (set (ifield f-uci_elfext_2-hi) (srl (ifield f-uci_elfext_2) 12))
  63. (set (ifield f-uci_elfext_2-lo) (and (ifield f-uci_elfext_2) #xfff))))
  64. (extract (set (ifield f-uci_elfext_2)
  65. (or (sll (ifield f-uci_elfext_2-hi) 12)
  66. (ifield f-uci_elfext_2-lo))))
  67. )
  68. (dpop uci_elfext_2uimm16 "unsigned imm (16 bits)" (mep-ext1-isa) h-uint f-uci_elfext_2 "unsigned16")
  69. ; define sub-opcode
  70. (df f-uci_elfext-sub "sub-opcode for uci_elfext instructions" (mep-ext1-isa) 16 4 UINT #f #f)
  71. ; define instruction
  72. (dni uci.elfext.1 "uci_elfext instruction 1" (OPTIONAL_UCI_INSN VOLATILE mep-ext1-isa)
  73. "uci.elfext.1 $uci_elfext_1simm16"
  74. (+ MAJ_15 (f-rm 0) (f-sub4 2) (f-uci_elfext-sub 1) uci_elfext_1simm16)
  75. (c-call "check_option_uci" pc)
  76. ()
  77. )
  78. ; define instruction
  79. (dni uci.elfext.2 "uci_elfext instruction 1" (OPTIONAL_UCI_INSN VOLATILE mep-ext1-isa)
  80. "uci.elfext.2 $uci_elfext_2uimm16"
  81. (+ MAJ_15 (f-rm 0) (f-sub4 2) (f-uci_elfext-sub 2) uci_elfext_2uimm16)
  82. (c-call "check_option_uci" pc)
  83. ()
  84. )
  85. ;; some general samples
  86. ; UCI option.
  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. ; DSP option.
  95. (dni dsp "dsp instruction" (OPTIONAL_DSP_INSN mep-ext1-isa)
  96. "dsp $rn,$rm,$code16"
  97. (+ MAJ_15 rn rm (f-sub4 0) code16)
  98. (sequence ()
  99. (c-call "check_option_dsp" pc)
  100. (set pc (c-call USI "dsp_exception" pc)))
  101. ())