From fa77a73ce263f2e471730ee086000153bb3efa25 Mon Sep 17 00:00:00 2001 From: Ben Marshall Date: Fri, 23 Jul 2021 12:58:02 +0100 Subject: scalar-crypto: post arch-review aes32* opcode change - After questions from the architecture review and subsequent cryptography task group meetings, we have stopped overlapping the aes32* and aes64* instruction encodings. - We've done this in the name of removing complexity, because opcode space is not as tight as we thought it was when we originally overlapped them. - Change affected by updating the aes32* opcodes only. On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: modified: opcodes-rv32k modified: parse_opcodes --- opcodes-rv32k | 8 ++++---- parse_opcodes | 8 -------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/opcodes-rv32k b/opcodes-rv32k index fb4c876..56ed607 100644 --- a/opcodes-rv32k +++ b/opcodes-rv32k @@ -6,10 +6,10 @@ # ------------------------------------------------------------ # Scalar AES - RV32 -aes32esmi rd rs1 rs2 bs 29..25=0b11011 14..12=0 6..0=0x33 -aes32esi rd rs1 rs2 bs 29..25=0b11001 14..12=0 6..0=0x33 -aes32dsmi rd rs1 rs2 bs 29..25=0b11111 14..12=0 6..0=0x33 -aes32dsi rd rs1 rs2 bs 29..25=0b11101 14..12=0 6..0=0x33 +aes32esmi rd rs1 rs2 bs 29..25=0b10011 14..12=0 6..0=0x33 +aes32esi rd rs1 rs2 bs 29..25=0b10001 14..12=0 6..0=0x33 +aes32dsmi rd rs1 rs2 bs 29..25=0b10111 14..12=0 6..0=0x33 +aes32dsi rd rs1 rs2 bs 29..25=0b10101 14..12=0 6..0=0x33 # Scalar SHA512 - RV32 sha512sum0r rd rs1 rs2 31..30=1 29..25=0b01000 14..12=0 6..0=0x33 diff --git a/parse_opcodes b/parse_opcodes index 7bb4dc9..603ae05 100755 --- a/parse_opcodes +++ b/parse_opcodes @@ -58,10 +58,6 @@ arglut['zimm11'] = (30,20) # Instructions which are _only_ in RV32 rv32_only = [ - "aes32esmi", - "aes32esi", - "aes32dsmi", - "aes32dsi", "sha512sum0r", "sha512sum1r", "sha512sig0l", @@ -75,10 +71,6 @@ rv64_only = [ "aes64ks1i", "aes64im", "aes64ks2", - "aes64esm", - "aes64es", - "aes64dsm", - "aes64ds", "sha512sum0", "sha512sum1", "sha512sig0", -- cgit v1.1 From c540f88a756cb836a5ce1966e9b7e5a2466537cf Mon Sep 17 00:00:00 2001 From: Ben Marshall Date: Wed, 28 Jul 2021 10:01:28 +0100 Subject: scalar-crypto: Remove rv*_only logic. - No instructions now share opcodes between RV32 and RV64. - Removing extra logic from parse_opcodes which was added to handle this. - Will also remove downstream logic in Spike to handle this too. On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) Changes to be committed: modified: parse_opcodes --- parse_opcodes | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) diff --git a/parse_opcodes b/parse_opcodes index 603ae05..7bb5c3a 100755 --- a/parse_opcodes +++ b/parse_opcodes @@ -53,44 +53,6 @@ arglut['zimm10'] = (29,20) arglut['zimm11'] = (30,20) # -# These lists allow instructions which only appear in either the RV32 or -# RV64 base architectures to overlap their opcodes. - -# Instructions which are _only_ in RV32 -rv32_only = [ - "sha512sum0r", - "sha512sum1r", - "sha512sig0l", - "sha512sig0h", - "sha512sig1l", - "sha512sig1h" -] - -# Instructions which are _only_ in RV64 -rv64_only = [ - "aes64ks1i", - "aes64im", - "aes64ks2", - "sha512sum0", - "sha512sum1", - "sha512sig0", - "sha512sig1" -] - -# Check rv32_only and rv64_only don't have shared elements. -for a in rv32_only: - assert (not a in rv64_only), ("Instruction '%s' marked as both RV32 only, and RV64 only." % a) - -def different_base_isa(name1, name2): - """ - Check if the two supplied instructions are mutually exclusive on - the base ISA they depend on. That is, they can never both be decoded - under the same XLEN. - """ - return (name1 in rv32_only) and (name2 in rv64_only) or \ - (name2 in rv32_only) and (name1 in rv64_only) - -# # Trap cause codes causes = [ (0x00, 'misaligned fetch'), @@ -442,17 +404,6 @@ def make_c(match,mask): for name in namelist: name2 = name.replace('.','_') print('DECLARE_INSN(%s, MATCH_%s, MASK_%s)' % (name2, name2.upper(), name2.upper())) - print("#ifdef DECLARE_RV32_ONLY") - for name in namelist: - if name in rv32_only: - print("DECLARE_RV32_ONLY(%s)" % name) - print("#endif") #ifdef DECLARE_RV32_ONLY - - print("#ifdef DECLARE_RV64_ONLY") - for name in namelist: - if name in rv64_only: - print("DECLARE_RV64_ONLY(%s)" % name) - print("#endif") # #ifdef DECLARE_RV64_ONLY print('#endif') # #ifdef DECLARE_INSN print('#ifdef DECLARE_CSR') @@ -1162,11 +1113,6 @@ def parse_inputs(args): else: for name2,match2 in match.items(): if name2 not in pseudos and (match2 & mymask) == mymatch: - if(different_base_isa(name, name2)): - # The instructions cannot collide, as they exist under - # different base ISAs. - continue - else: sys.exit("%s and %s overlap" % (name,name2)) mask[name] = mymask -- cgit v1.1