URL
https://opencores.org/ocsvn/scarts/scarts/trunk
Subversion Repositories scarts
[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cpu/] [scarts.cpu] - Rev 13
Go to most recent revision | Compare with Previous | Blame | View Log
; SCARTS generic architecture description. -*- Scheme -*-
; Copyright 2000, 2001 Free Software Foundation, Inc.
; Contributed by Martin Walter <mwalter@opencores.org>
;
; This file is part of the GNU Binutils.
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
;-------------------------------
; Instruction Field Definitions
;-------------------------------
; Opcode fields
(dnf f-opc-4 "4-bit opcode field" () 15 4)
(dnf f-opc-5 "5-bit opcode field" () 15 5)
(dnf f-opc-6 "6-bit opcode field" () 15 6)
(dnf f-opc-7 "7-bit opcode field" () 15 7)
(dnf f-opc-8 "8-bit opcode field" () 15 8)
(dnf f-opc-12 "12-bit opcode field" () 15 12)
(dnf f-opc-16 "16-bit opcode field" () 15 16)
; Register fields
(dnf f-reg-x "Register field (rX)" () 3 4)
(dnf f-reg-y "Register field (rY)" () 7 4)
; Immediate fields
(df f-uimm-4 "4-bit unsigned immediate field" () 7 4 UINT #f #f)
(df f-simm-5 "5-bit signed immediate field" () 8 5 INT #f #f)
(df f-uimm-5 "5-bit unsigned immediate field" () 8 5 UINT #f #f)
(df f-simm-6 "6-bit signed immediate field" () 9 6 INT #f #f)
(df f-simm-7 "7-bit signed immediate field" () 10 7 INT #f #f)
(df f-simm-8 "8-bit signed immediate field" () 11 8 INT #f #f)
(df f-uimm-8 "8-bit unsigned immediate field" () 11 8 UINT #f #f)
(df f-simm-10 "10-bit signed immediate field" (SIGN-OPT PCREL-ADDR) 9 10 INT #f #f)
;----------------------
; Hardware Definitions
;----------------------
; Program counter
(dsh h-pc "program counter" (PC) (pc))
; Special-purpose registers
(dnh h-simm-8 "8-bit signed immediate register" () (immediate (INT 8)) () () ())
(dnh h-uimm-8 "8-bit unsigned immediate register" () (immediate (UINT 8)) () () ())
(dnh h-simm-10 "10-bit signed immediate register" () (immediate (INT 10)) () () ())
;----------------------
; Instruction Operands
;----------------------
; Immediate operands
(dnop uimm4 "4-bit unsigned immediate operand" () h-uint f-uimm-4)
(dnop simm5 "5-bit signed immediate operand" () h-sint f-simm-5)
(dnop uimm5 "5-bit unsigned immediate operand" () h-uint f-uimm-5)
(dnop simm6 "6-bit signed immediate operand" () h-sint f-simm-6)
(dnop simm7 "7-bit signed immediate operand" () h-sint f-simm-7)
(define-operand
(name simm8)
(comment "8-bit signed immediate operand")
(type h-simm-8)
(index f-simm-8)
(handlers (parse "simm8"))
)
(define-operand
(name uimm8)
(comment "8-bit unsigned immediate operand")
(type h-uimm-8)
(index f-uimm-8)
(handlers (parse "uimm8"))
)
(define-operand
(name saddr10-pcrel)
(comment "10-bit signed pc-relative address operand")
(type h-simm-10)
(index f-simm-10)
(handlers (parse "saddr10_pcrel"))
)
; Register operands
(dnop regX "register operand rX" () h-gpr f-reg-x)
(dnop regY "register operand rY" () h-gpr f-reg-y)
;--------------
; Instructions
;--------------
; OPC4-REG-SIMM8 instructions
(define-pmacro (m-opc4-reg-simm8-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$simm8")
(+ (.sym OPC4_ sym) simm8 regX)
(nop)
()
)
)
; OPC4-REG_UIMM8 instructions
(define-pmacro (m-opc4-reg-uimm8-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$uimm8")
(+ (.sym OPC4_ sym) uimm8 regX)
(nop)
()
)
)
; OPC5-REG-SIMM7 instructions
(define-pmacro (m-opc5-reg-simm7-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$simm7")
(+ (.sym OPC5_ sym) simm7 regX)
(nop)
()
)
)
; OPC6-REG-SIMM6 instructions
(define-pmacro (m-opc6-reg-simm6-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$simm6")
(+ (.sym OPC6_ sym) simm6 regX)
(nop)
()
)
)
; OPC6-SADDR10-PCREL instructions
(define-pmacro (m-opc6-saddr10-pcrel-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " ${saddr10-pcrel}")
(+ (.sym OPC6_ sym) saddr10-pcrel)
(nop)
()
)
)
; OPC7-REG-SIMM5 instructions
(define-pmacro (m-opc7-reg-simm5-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$simm5")
(+ (.sym OPC7_ sym) simm5 regX)
(nop)
()
)
)
; OPC7-REG-UIMM5 instructions
(define-pmacro (m-opc7-reg-uimm5-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$uimm5")
(+ (.sym OPC7_ sym) uimm5 regX)
(nop)
()
)
)
; OPC8-REG-UIMM4 instructions
(define-pmacro (m-opc8-reg-uimm4-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$uimm4")
(+ (.sym OPC8_ sym) uimm4 regX)
(nop)
()
)
)
; OPC8-REG-REG instructions
(define-pmacro (m-opc8-reg-reg-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX,$regY")
(+ (.sym OPC8_ sym) regY regX)
(nop)
()
)
)
; OPC12-REG instructions
(define-pmacro (m-opc12-reg-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic " $regX")
(+ (.sym OPC12_ sym) regX)
(nop)
()
)
)
; OPC16 instructions
(define-pmacro (m-opc16-insn mnemonic sym comment attributes)
(dni mnemonic comment
attributes
(.str mnemonic "")
(+ (.sym OPC16_ sym))
(nop)
()
)
)
Go to most recent revision | Compare with Previous | Blame | View Log