binutils-gdb/cpu/or1k.cpu
Stafford Horne 6ce26ac7c3 cpu/or1k: Add support for orfp64a32 spec
This patch adds support for OpenRISC 64-bit FPU operations on 32-bit cores by
using register pairs.  The functionality has been added to OpenRISC architecture
specification version 1.3 as per architecture proposal 14[0].

For supporting assembly of both 64-bit and 32-bit precision instructions we have
defined CGEN_VALIDATE_INSN_SUPPORTED.  This allows cgen to use 64-bit bit
architecture assembly parsing on 64-bit toolchains and 32-bit architecture
assembly parsing on 32-bit toolchains.  Without this the assembler has issues
parsing register pairs.

This patch also contains a few fixes to the symantics for existing OpenRISC
single and double precision FPU operations.

[0] https://openrisc.io/proposals/orfpx64a32

cpu/ChangeLog:

yyyy-mm-dd  Andrey Bacherov  <avbacherov@opencores.org>
	    Stafford Horne  <shorne@gmail.com>

	* or1k.cpu (ORFPX64A32-MACHS): New pmacro.
	(ORFPX-MACHS): Removed pmacro.
	* or1k.opc (or1k_cgen_insn_supported): New function.
	(CGEN_VALIDATE_INSN_SUPPORTED): Define macro.
	(parse_regpair, print_regpair): New functions.
	* or1kcommon.cpu (h-spr, spr-shift, spr-address, h-gpr): Reorder
	and add comments.
	(h-fdr): Update comment to indicate or64.
	(reg-pair-reg-lo, reg-pair-reg-hi): New pmacros for register pairs.
	(h-fd32r): New hardware for 64-bit fpu registers.
	(h-i64r): New hardware for 64-bit int registers.
	* or1korbis.cpu (f-resv-8-1): New field.
	* or1korfpx.cpu (rDSF, rASF, rBSF): Update attribute to ORFPX32-MACHS.
	(rDDF, rADF, rBDF): Update operand comment to indicate or64.
	(f-rdoff-10-1, f-raoff-9-1, f-rboff-8-1): New fields.
	(h-roff1): New hardware.
	(double-field-and-ops mnemonic): New pmacro to generate operations
	rDD32F, rAD32F, rBD32F, rDDI and rADI.
	(float-regreg-insn): Update single precision generator to MACH
	ORFPX32-MACHS.  Add generator for or32 64-bit instructions.
	(float-setflag-insn): Update single precision generator to MACH
	ORFPX32-MACHS.  Fix double instructions from single to double
	precision.  Add generator for or32 64-bit instructions.
	(float-cust-insn cust-num): Update single precision generator to MACH
	ORFPX32-MACHS.  Add generator for or32 64-bit instructions.
	(lf-rem-s, lf-itof-s, lf-ftoi-s, lf-madd-s): Update MACH to
	ORFPX32-MACHS.
	(lf-rem-d): Fix operation from mod to rem.
	(lf-rem-d32, lf-itof-d32, lf-ftoi-d32, lf-madd-d32): New instruction.
	(lf-itof-d): Fix operands from single to double.
	(lf-ftoi-d): Update operand mode from DI to WI.
2019-06-13 06:16:18 +09:00

133 lines
3.6 KiB
Scheme

; OpenRISC 1000 architecture. -*- Scheme -*-
; Copyright 2000-2019 Free Software Foundation, Inc.
; Contributed for OR32 by Johan Rydberg, jrydberg@opencores.org
; Modified by Julius Baxter, juliusbaxter@gmail.com
; Modified by Peter Gavin, pgavin@gmail.com
; Modified by Andrey Bacherov, avbacherov@opencores.org
;
; 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 3 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, see <http://www.gnu.org/licenses/>
(include "simplify.inc")
; The OpenRISC family is a set of RISC microprocessor architectures with an
; emphasis on scalability and is targetted at embedded use.
; The CPU RTL development is a collaborative open source effort.
; http://opencores.org/or1k
; http://openrisc.net
(define-arch
(name or1k)
(comment "OpenRISC 1000")
(default-alignment aligned)
(insn-lsb0? #t)
(machs or32 or32nd or64 or64nd)
(isas openrisc)
)
; Instruction set parameters.
(define-isa
; Name of the ISA.
(name openrisc)
; Base insturction length. The insns are always 32 bits wide.
(base-insn-bitsize 32)
)
(define-pmacro OR32-MACHS or32,or32nd)
(define-pmacro OR64-MACHS or64,or64nd)
(define-pmacro ORBIS-MACHS or32,or32nd,or64,or64nd)
(define-pmacro ORFPX32-MACHS or32,or32nd,or64,or64nd)
(define-pmacro ORFPX64-MACHS or64,or64nd)
(define-pmacro ORFPX64A32-MACHS or32,or32nd) ; float64 for 32-bit machs
(define-attr
(for model)
(type boolean)
(name NO-DELAY-SLOT)
(comment "does not have delay slots")
)
(if (keep-mach? (or32 or32nd))
(begin
(define-cpu
(name or1k32bf)
(comment "OpenRISC 1000 32-bit CPU family")
(insn-endian big)
(data-endian big)
(word-bitsize 32)
(file-transform "")
)
(define-mach
(name or32)
(comment "Generic OpenRISC 1000 32-bit CPU")
(cpu or1k32bf)
(bfd-name "or1k")
)
(define-mach
(name or32nd)
(comment "Generic OpenRISC 1000 32-bit CPU")
(cpu or1k32bf)
(bfd-name "or1knd")
)
; OpenRISC 1200 - 32-bit or1k CPU implementation
(define-model
(name or1200) (comment "OpenRISC 1200 model")
(attrs)
(mach or32)
(unit u-exec "Execution Unit" () 1 1 () () () ())
)
; OpenRISC 1200 - 32-bit or1k CPU implementation
(define-model
(name or1200nd) (comment "OpenRISC 1200 model")
(attrs NO-DELAY-SLOT)
(mach or32nd)
(unit u-exec "Execution Unit" () 1 1 () () () ())
)
)
)
(if (keep-mach? (or64 or64nd))
(begin
(define-cpu
(name or1k64bf)
(comment "OpenRISC 1000 64-bit CPU family")
(insn-endian big)
(data-endian big)
(word-bitsize 64)
(file-transform "64")
)
(define-mach
(name or64)
(comment "Generic OpenRISC 1000 64-bit CPU")
(cpu or1k64bf)
(bfd-name "or1k64")
)
(define-mach
(name or64nd)
(comment "Generic OpenRISC 1000 ND 64-bit CPU")
(cpu or1k64bf)
(bfd-name "or1k64nd")
)
)
)
(include "or1kcommon.cpu")
(include "or1korbis.cpu")
(include "or1korfpx.cpu")