From patchwork Tue Nov 12 17:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 842701 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp3690057wru; Tue, 12 Nov 2024 09:21:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVwApW69IkzMiWAQiO9esXdHkRYO4Wj+bSYHLp3dE1QWL2nYUs/4G2iVukp70CjZbVKiRagBw==@linaro.org X-Google-Smtp-Source: AGHT+IEVYgCkcSw1DpeixkzgmuATx1sExY+P1wJmGJpwFoFYwOlT28jhtLDyD2r/QPpBSWKIOAbE X-Received: by 2002:a05:622a:1347:b0:462:b7d4:42b2 with SMTP id d75a77b69052e-46309a1ef5fmr331016481cf.6.1731432117068; Tue, 12 Nov 2024 09:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731432117; cv=none; d=google.com; s=arc-20240605; b=bzgMLfFavCyksBy6YWW4Ef1PLwBbLCWijsy4svickXNRAsm/HQ21dtznU8wtLvWxrl N9SfJBua1WeS/JchPrNv2a4pJ+TRZBXgFnRMznJatiC6sy9VSkNwvw+JWI/aaYCJ/Fku z2CY5iV2WtfszsJDmjVp8y4ITGrE773Wup/NuOA1WJoJ4M9kXACwAonb5k7nP9WJUfjD y06OoKreT7UTGqHRVCAUA4ms80dMkMIETKVlm5C/BSRz4y06sEVDDQjDwXpXcI1YU+Yh mXo8faZJAh32hDEp/LVZ5VeflvBAkd0kHH0w4ftetZ9VRqCIKhn/KcnHmaMU4IuN/5CY ddMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3OZAjdiF+IZHqejHSQfF1+0YI+1SBj9mTB6uv3MpehI=; fh=utI592JuSTG+vxSF7LxZGEwCMbTXSGT9thJyBsJRzQ8=; b=Rm/p4GyqLCGHElmkYx5n6SzhS75Q3YLBisaYJSKzgGfdtmTj799i5ey4RyaVUR9HpS KQhceOJ55z1WR7aic8cp3HhUevw8VN++1Jwql6yKIStGRPIuc9peUgYDVMsGS+c0eicL Tairw0q+j16sm+x2nLnLeb7DN4vLg3sSCpBtABahg504eKeupoSfQ424ewgKa/q0mv6n py+6oymD/kajsB1obB9xnmc1foScZcuSkccUtXmWWVTQerZkeByIaCVpEP0AzNIHdice VYHKGbtAfFYch0CUQRhlHMyugYGPJisU6tn7zHCFIxD/ZdTd9176ImGaWpCId375FdoY J+UQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KdGjJjxm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46312526ef6si111839701cf.621.2024.11.12.09.21.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Nov 2024 09:21:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KdGjJjxm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAuZH-0003Gj-Uo; Tue, 12 Nov 2024 12:20:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAuZF-0003GM-Ce for qemu-devel@nongnu.org; Tue, 12 Nov 2024 12:20:41 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAuZD-0003iJ-O5 for qemu-devel@nongnu.org; Tue, 12 Nov 2024 12:20:41 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso52733535e9.0 for ; Tue, 12 Nov 2024 09:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731432037; x=1732036837; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3OZAjdiF+IZHqejHSQfF1+0YI+1SBj9mTB6uv3MpehI=; b=KdGjJjxmjOMdsUqSqbrEYVIJh5dsTRs5vyh+xzubv66q4aP6pIZ8zqYuAAHUSl8d8g rF32jNObZVRbY5eWHfdz/k9jQtxMidRnHbALPBRdWoZUcSP+Iv4AcIvKWqaKsqLS8vwW fPzd8v7RHO6WjwS0yxsby7N6i5IRCifXA+YWPY9tzAbCKK4Ocl9Me9hJY5MX+KQNXd15 THeAkYN8NNAJjWSmRDA3/RiZehgQV9WqBSZ3AT4mNvUo7mQK8bt9gHYIVzwohrvCPUp3 SzY+FE/KOXItPp2Ljwb7Q1yoChPZfj5+jXoIbJOHMngtJRvCLvcnIznUU4APp5GZG7n0 npjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731432037; x=1732036837; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3OZAjdiF+IZHqejHSQfF1+0YI+1SBj9mTB6uv3MpehI=; b=N3Oms3+5j0UfAMUA0LBHSMB8Px+9VhCgNxb5v7NRxeFIW0Sh+ZawTD4ncazGLoMZbn j6fn6ZbMzWGNGyw1Vz/3DAURuHuqNdugXRUYHyshi2vZXyddYOMOoeUC2iOve8+FPZep 8gu3yakTPZeQQjCGVzlk+YtAdh7B+WCC5tB55jN43g4GVTvSuAqO4AXup7XWd/ECXWsJ yXNi1uHNSZjkc/QfE2rbpQ/jXKdxwMYnLnZ86uPoLeTv8pQnWEsqqrysJoZmLYavswn0 AyUE5krpXIHVdcolxqeRkd2v+b1upo4S80Thdna1pgnZGChUa3fOEkSoZdpMse31ru9r NPjg== X-Gm-Message-State: AOJu0Yz4J4kyfdytsaki6gujxX13Qq/J+mwS695vnXAcyEGk9GYnPzJV OSKNl40fMzzqkBAhtVUzVmV3/9zGAs9/Wsy5vta5qdidTIdvpOEEPh/0LMeMo/ezMIA7oix0UGD F X-Received: by 2002:a05:600c:1d0e:b0:42d:a024:d6bb with SMTP id 5b1f17b1804b1-432b7517ac2mr134836165e9.20.1731432036668; Tue, 12 Nov 2024 09:20:36 -0800 (PST) Received: from localhost.localdomain (cnf78-h01-176-184-27-250.dsl.sta.abo.bbox.fr. [176.184.27.250]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432b05c0d33sm220339195e9.27.2024.11.12.09.20.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Nov 2024 09:20:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aleksandar Rikalo , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Jiaxun Yang , Aurelien Jarno , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 2/6] target/mips: Introduce decode tree bindings for nanoMIPS ISA Date: Tue, 12 Nov 2024 18:20:18 +0100 Message-ID: <20241112172022.88348-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112172022.88348-1-philmd@linaro.org> References: <20241112172022.88348-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Introduce the nanoMIPS decodetree configs for the 16-bit and 32-bit instructions. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Aleksandar Rikalo Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/mips/tcg/translate.h | 2 ++ target/mips/tcg/nanomips16.decode | 8 ++++++++ target/mips/tcg/nanomips32.decode | 8 ++++++++ target/mips/tcg/nanomips_translate.c | 14 ++++++++++++++ target/mips/tcg/nanomips_translate.c.inc | 7 +++++++ target/mips/tcg/meson.build | 3 +++ 6 files changed, 42 insertions(+) create mode 100644 target/mips/tcg/nanomips16.decode create mode 100644 target/mips/tcg/nanomips32.decode create mode 100644 target/mips/tcg/nanomips_translate.c diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h index 816453f2be..a91c003f96 100644 --- a/target/mips/tcg/translate.h +++ b/target/mips/tcg/translate.h @@ -224,6 +224,8 @@ bool decode_64bit_enabled(DisasContext *ctx); /* decodetree generated */ bool decode_isa_micromips16(DisasContext *ctx, uint16_t insn); bool decode_isa_micromips32(DisasContext *ctx, uint32_t insn); +bool decode_isa_nanomips16(DisasContext *ctx, uint16_t insn); +bool decode_isa_nanomips32(DisasContext *ctx, uint32_t insn); bool decode_isa_rel6(DisasContext *ctx, uint32_t insn); bool decode_ase_msa(DisasContext *ctx, uint32_t insn); bool decode_ext_txx9(DisasContext *ctx, uint32_t insn); diff --git a/target/mips/tcg/nanomips16.decode b/target/mips/tcg/nanomips16.decode new file mode 100644 index 0000000000..81fdc68e98 --- /dev/null +++ b/target/mips/tcg/nanomips16.decode @@ -0,0 +1,8 @@ +# nanoMIPS32 16-bit instruction set extensions +# +# Copyright (C) 2021 Philippe Mathieu-Daudé +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: nanoMIPS32 Instruction Set Technical Reference Manual +# (Document Number: MD01247) diff --git a/target/mips/tcg/nanomips32.decode b/target/mips/tcg/nanomips32.decode new file mode 100644 index 0000000000..9cecf1e13d --- /dev/null +++ b/target/mips/tcg/nanomips32.decode @@ -0,0 +1,8 @@ +# nanoMIPS32 32-bit instruction set extensions +# +# Copyright (C) 2021 Philippe Mathieu-Daudé +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: nanoMIPS32 Instruction Set Technical Reference Manual +# (Document Number: MD01247) diff --git a/target/mips/tcg/nanomips_translate.c b/target/mips/tcg/nanomips_translate.c new file mode 100644 index 0000000000..c148c13ed9 --- /dev/null +++ b/target/mips/tcg/nanomips_translate.c @@ -0,0 +1,14 @@ +/* + * MIPS emulation for QEMU - nanoMIPS translation routines + * + * Copyright (c) 2021 Philippe Mathieu-Daudé + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "qemu/osdep.h" +#include "translate.h" + +/* Include the auto-generated decoders. */ +#include "decode-nanomips16.c.inc" +#include "decode-nanomips32.c.inc" diff --git a/target/mips/tcg/nanomips_translate.c.inc b/target/mips/tcg/nanomips_translate.c.inc index 1e274143bb..e401b92bfd 100644 --- a/target/mips/tcg/nanomips_translate.c.inc +++ b/target/mips/tcg/nanomips_translate.c.inc @@ -4482,6 +4482,13 @@ static int decode_isa_nanomips(CPUMIPSState *env, DisasContext *ctx) return 2; } + if (decode_isa_nanomips16(ctx, ctx->opcode)) { + return 2; + } + if (decode_isa_nanomips32(ctx, ctx->opcode)) { + return 4; + } + op = extract32(ctx->opcode, 10, 6); switch (op) { case NM_P16_MV: diff --git a/target/mips/tcg/meson.build b/target/mips/tcg/meson.build index 5db5681eb1..f815174ed1 100644 --- a/target/mips/tcg/meson.build +++ b/target/mips/tcg/meson.build @@ -2,6 +2,8 @@ gen = [ decodetree.process('micromips16.decode', extra_args: ['--decode=decode_isa_micromips16', '--insnwidth=16']), decodetree.process('micromips32.decode', extra_args: ['--decode=decode_isa_micromips32']), decodetree.process('rel6.decode', extra_args: ['--decode=decode_isa_rel6']), + decodetree.process('nanomips16.decode', extra_args: ['--decode=decode_isa_nanomips16', '--insnwidth=16']), + decodetree.process('nanomips32.decode', extra_args: ['--decode=decode_isa_nanomips32']), decodetree.process('msa.decode', extra_args: '--decode=decode_ase_msa'), decodetree.process('tx79.decode', extra_args: '--static-decode=decode_tx79'), decodetree.process('vr54xx.decode', extra_args: '--decode=decode_ext_vr54xx'), @@ -21,6 +23,7 @@ mips_ss.add(files( 'micromips_translate.c', 'msa_helper.c', 'msa_translate.c', + 'nanomips_translate.c', 'op_helper.c', 'rel6_translate.c', 'translate.c',