From nobody Tue Feb 10 13:17:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1591789340; cv=none; d=zohomail.com; s=zohoarc; b=cA7retLbOjm2aPYwg6nujF9XUbqEwg+zn0aG+FYY6BWc9aGCvzCzgGT4aW7lDQu8ndiiJkq8Ht+qm/I/HUkV7suu1Ywl6mhTrazkppWvp55F0KSrj6kHrigk+G9VO8sKabIkqtDQ4XJcK/cxuNf2kTSX1AK/pq7klBgNgpCQuNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591789340; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d3IQhTlKl0OpenWUs5yNC+CXhqcrlICMr+Hp1YLnuVY=; b=eK2FXZZbH4YMgfHf09g1MTAMKARdU37prjSB9JFEpu8mOER+WNvr8ytxS4rEGwRCmPfFmCquNAeh7l+x+AjJvnxTtnqmv9HPkUMHyteP5dcYGanjv0M4wKh/GNDIwuRxCI/7Hc6ksKxr3aW9Ziy8ex06cnKzxsUIUEyfvu5s0tA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591789340046842.1634344660133; Wed, 10 Jun 2020 04:42:20 -0700 (PDT) Received: from localhost ([::1]:38898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiz7a-0007ZJ-Ke for importer@patchew.org; Wed, 10 Jun 2020 07:42:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiz5N-0005qG-1o; Wed, 10 Jun 2020 07:40:01 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:54400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiz5M-0007hA-2Y; Wed, 10 Jun 2020 07:40:00 -0400 Received: from L-PF1D6DP4-1208.hz.ali.com(mailfrom:zhiwei_liu@c-sky.com fp:SMTPD_---.HkZMLa7_1591789191) by smtp.aliyun-inc.com(10.147.41.137); Wed, 10 Jun 2020 19:39:52 +0800 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.07876018|-1; CH=green; DM=|CONTINUE|false|; DS=CONTINUE|ham_regular_dialog|0.00410776-0.00307122-0.992821; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03302; MF=zhiwei_liu@c-sky.com; NM=1; PH=DS; RN=9; RT=8; SR=0; TI=SMTPD_---.HkZMLa7_1591789191; From: LIU Zhiwei To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v9 01/61] target/riscv: add vector extension field in CPURISCVState Date: Wed, 10 Jun 2020 19:36:48 +0800 Message-Id: <20200610113748.4754-2-zhiwei_liu@c-sky.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200610113748.4754-1-zhiwei_liu@c-sky.com> References: <20200610113748.4754-1-zhiwei_liu@c-sky.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=121.197.200.217; envelope-from=zhiwei_liu@c-sky.com; helo=smtp2200-217.mail.aliyun.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/10 07:37:52 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001, UNPARSEABLE_RELAY=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, wxy194768@alibaba-inc.com, wenmeng_zhang@c-sky.com, Alistair Francis , palmer@dabbelt.com, LIU Zhiwei Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The 32 vector registers will be viewed as a continuous memory block. It avoids the convension between element index and (regno, offset). Thus elements can be directly accessed by offset from the first vector base address. Signed-off-by: LIU Zhiwei Acked-by: Alistair Francis Reviewed-by: Richard Henderson --- target/riscv/cpu.h | 12 ++++++++++++ target/riscv/translate.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 80569f0d44..0018a79fa3 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -59,6 +59,7 @@ #define RVA RV('A') #define RVF RV('F') #define RVD RV('D') +#define RVV RV('V') #define RVC RV('C') #define RVS RV('S') #define RVU RV('U') @@ -88,9 +89,20 @@ typedef struct CPURISCVState CPURISCVState; =20 #include "pmp.h" =20 +#define RV_VLEN_MAX 512 + struct CPURISCVState { target_ulong gpr[32]; uint64_t fpr[32]; /* assume both F and D extensions */ + + /* vector coprocessor state. */ + uint64_t vreg[32 * RV_VLEN_MAX / 64] QEMU_ALIGNED(16); + target_ulong vxrm; + target_ulong vxsat; + target_ulong vl; + target_ulong vstart; + target_ulong vtype; + target_ulong pc; target_ulong load_res; target_ulong load_val; diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 43bf7e39a6..b71b7e4bc2 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -32,7 +32,7 @@ #include "instmap.h" =20 /* global register indices */ -static TCGv cpu_gpr[32], cpu_pc; +static TCGv cpu_gpr[32], cpu_pc, cpu_vl; static TCGv_i64 cpu_fpr[32]; /* assume F and D extensions */ static TCGv load_res; static TCGv load_val; @@ -886,6 +886,7 @@ void riscv_translate_init(void) } =20 cpu_pc =3D tcg_global_mem_new(cpu_env, offsetof(CPURISCVState, pc), "p= c"); + cpu_vl =3D tcg_global_mem_new(cpu_env, offsetof(CPURISCVState, vl), "v= l"); load_res =3D tcg_global_mem_new(cpu_env, offsetof(CPURISCVState, load_= res), "load_res"); load_val =3D tcg_global_mem_new(cpu_env, offsetof(CPURISCVState, load_= val), --=20 2.23.0