From ec70e4c63acccef19e840f5003824cc51af6826c Mon Sep 17 00:00:00 2001 From: Jiawei Date: Tue, 2 May 2023 20:36:04 +0800 Subject: [PATCH 1/5] Add RISC-V Profiles format Add RISC-V Profiles format. Signed-off-by: Jiawei --- README.mkd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.mkd b/README.mkd index 92197f5..23d5da2 100644 --- a/README.mkd +++ b/README.mkd @@ -61,6 +61,23 @@ The ISA subset naming conventions are described in Chapter 27 of the RISC-V user-level ISA specification. However, tools do not currently follow this specification (input is case sensitive, ...). +### Profile-based format + +Profiles should be recognized and used in the `-march=` option. +The benefit is that it is easy for toolchain parsing the profiles string and expanding it into normal extensions combinations. It’s also easy to combine a profile with any extensions. + +As the spec defines, to use the profiles it should follow profile naming convention (See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)), the toolchain will check whether an input profile name is correct at first, then do the parse work. + +In order to distinguish between ordinary extension input and input with profiles, profiles are assumed to be entered `at the beginning of the -march option`, and then input other extensions. Profiles `should use uppercase letters` in the -march option. + +e.g. `-march = RVA20U64` is a legal profile input, it will be expand into: + +`-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs` +which include all the mandatory extensions required by this profile. +Here we are `not dealing with optional extensions` to profiles in the toolchain. + +Moreover, some extensions are still not ratified yet. So the toolchain only keeps their name strings only. + If the 'C' (compressed) instruction set extension is targeted, the compiler will generate compressed instructions where possible. From 47389da04558ad23f196f3abc16851792ffb5971 Mon Sep 17 00:00:00 2001 From: Jiawei Date: Thu, 29 Jun 2023 12:46:49 +0800 Subject: [PATCH 2/5] Update profiles format descriptions Update profiles format descriptions, follow all comments in discuss. Thanks Alex Bradbury and Kito Cheng's review. Signed-off-by: Jiawei --- README.mkd | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/README.mkd b/README.mkd index 23d5da2..b363cc2 100644 --- a/README.mkd +++ b/README.mkd @@ -61,25 +61,38 @@ The ISA subset naming conventions are described in Chapter 27 of the RISC-V user-level ISA specification. However, tools do not currently follow this specification (input is case sensitive, ...). +If the 'C' (compressed) instruction set extension is targeted, the compiler +will generate compressed instructions where possible. + ### Profile-based format -Profiles should be recognized and used in the `-march=` option. -The benefit is that it is easy for toolchain parsing the profiles string and expanding it into normal extensions combinations. It’s also easy to combine a profile with any extensions. +Profiles should be recognized and used in the `-march=` option. The benefit use +`-march` option is easy for toolchain parsing the profiles string and expanding +it into normal extensions combinations. + +Profiles format has the following form `-march=[+]+`. -As the spec defines, to use the profiles it should follow profile naming convention (See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)), the toolchain will check whether an input profile name is correct at first, then do the parse work. +As the spec defines, to use the profiles it should follow profile naming convention +(See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)), the toolchain +will check whether an input profile name is correct at first, then do the parse +work. -In order to distinguish between ordinary extension input and input with profiles, profiles are assumed to be entered `at the beginning of the -march option`, and then input other extensions. Profiles `should use uppercase letters` in the -march option. +In order to distinguish between ordinary extension input and input with profiles, +profiles are assumed to be entered `at the beginning of the -march option`, and +then input other extensions. Profiles `should use uppercase letters` in the `-march` +option. e.g. `-march = RVA20U64` is a legal profile input, it will be expand into: -`-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs` +`-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs`, which include all the mandatory extensions required by this profile. -Here we are `not dealing with optional extensions` to profiles in the toolchain. -Moreover, some extensions are still not ratified yet. So the toolchain only keeps their name strings only. +`-march = RVA20U64+zba_zbb_zbc_zbs` is also a legal profile input, it will add +four new extensions after expanded profile strings: -If the 'C' (compressed) instruction set extension is targeted, the compiler -will generate compressed instructions where possible. +`-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs_zba_zbb_zbc_zbs` + +and `-march = rva20u64` is an illegal profile input, it not use uppercase letters. ### Issues for consideration * Whether `riscv32` and `riscv64` should be accepted as synonyms for `rv32` From 11a65d4101cc886c03206265cdf8cae1e22c92be Mon Sep 17 00:00:00 2001 From: Jiawei Date: Fri, 30 Jun 2023 21:14:22 +0800 Subject: [PATCH 3/5] Update Profile name defination with BNF. --- README.mkd | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.mkd b/README.mkd index b363cc2..41a08a5 100644 --- a/README.mkd +++ b/README.mkd @@ -70,7 +70,19 @@ Profiles should be recognized and used in the `-march=` option. The benefit use `-march` option is easy for toolchain parsing the profiles string and expanding it into normal extensions combinations. -Profiles format has the following form `-march=[+]+`. +Profiles format has the following BNF form `"-march=""+"[option-ext]*`. + +`profile-name ::= "RV"` + +`profile-family-name ::= "I" | "M" | "A"` + +`profile-ratified-year ::= "20" | "22" | "23"` + +`privilege-mode ::= "U" | "S" | "M"` + +`ISA-XLEN ::= "64" | "32"` + +`option-ext ::= 'a legal RISC-V extension name'` As the spec defines, to use the profiles it should follow profile naming convention (See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)), the toolchain From 378d5eba91bc548f1914d10006c44ce85b0d9be4 Mon Sep 17 00:00:00 2001 From: Jiawei Date: Tue, 18 Jul 2023 15:10:23 +0800 Subject: [PATCH 4/5] Update the syntax. Update the syntax of description. Signed-off-by: Jiawei --- README.mkd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.mkd b/README.mkd index 41a08a5..a714306 100644 --- a/README.mkd +++ b/README.mkd @@ -66,8 +66,8 @@ will generate compressed instructions where possible. ### Profile-based format -Profiles should be recognized and used in the `-march=` option. The benefit use -`-march` option is easy for toolchain parsing the profiles string and expanding +Profiles should be recognized and used in the `-march=` option. The benefit of using +the `-march` option is easy for toolchain parsing the profiles string and expanding it into normal extensions combinations. Profiles format has the following BNF form `"-march=""+"[option-ext]*`. @@ -89,12 +89,12 @@ As the spec defines, to use the profiles it should follow profile naming convent will check whether an input profile name is correct at first, then do the parse work. -In order to distinguish between ordinary extension input and input with profiles, +To distinguish between ordinary extension input and input with profiles, profiles are assumed to be entered `at the beginning of the -march option`, and then input other extensions. Profiles `should use uppercase letters` in the `-march` option. -e.g. `-march = RVA20U64` is a legal profile input, it will be expand into: +e.g. `-march = RVA20U64` is a legal profile input, it will be expanded into: `-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs`, which include all the mandatory extensions required by this profile. @@ -104,7 +104,7 @@ four new extensions after expanded profile strings: `-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs_zba_zbb_zbc_zbs` -and `-march = rva20u64` is an illegal profile input, it not use uppercase letters. +and `-march = rva20u64` is an illegal profile input, it does not use uppercase letters. ### Issues for consideration * Whether `riscv32` and `riscv64` should be accepted as synonyms for `rv32` From f6bd8730eb9c93a28287b949cdda4be9aebfd3b7 Mon Sep 17 00:00:00 2001 From: Jiawei Date: Wed, 19 Jul 2023 16:10:14 +0800 Subject: [PATCH 5/5] Remove incorrect spaces using. Remove incorrect spaces using. Signed-off-by: Jiawei --- README.mkd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.mkd b/README.mkd index a714306..d4c6f9b 100644 --- a/README.mkd +++ b/README.mkd @@ -94,17 +94,17 @@ profiles are assumed to be entered `at the beginning of the -march option`, and then input other extensions. Profiles `should use uppercase letters` in the `-march` option. -e.g. `-march = RVA20U64` is a legal profile input, it will be expanded into: +e.g. `-march=RVA20U64` is a legal profile input, it will be expanded into: -`-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs`, +`-march=rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs`, which include all the mandatory extensions required by this profile. -`-march = RVA20U64+zba_zbb_zbc_zbs` is also a legal profile input, it will add +`-march=RVA20U64+zba_zbb_zbc_zbs` is also a legal profile input, it will add four new extensions after expanded profile strings: -`-march = rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs_zba_zbb_zbc_zbs` +`-march=rv64imafdc_zicsr_ziccif_ziccrse_ziccamoa_zicclsm_za128rs_zba_zbb_zbc_zbs` -and `-march = rva20u64` is an illegal profile input, it does not use uppercase letters. +and `-march=rva20u64` is an illegal profile input, it does not use uppercase letters. ### Issues for consideration * Whether `riscv32` and `riscv64` should be accepted as synonyms for `rv32`