From: Cupertino Miranda <Cupertino.Miranda@synopsys.com> To: Richard Henderson <richard.henderson@linaro.org>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org> Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>, Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>, "linux-snps-arc@lists.infradead.org" <linux-snps-arc@lists.infradead.org>, "cupertinomiranda@gmail.com" <cupertinomiranda@gmail.com> Subject: QEmu ARC port - decoder implementation feedback Date: Wed, 9 Jun 2021 09:58:34 +0000 [thread overview] Message-ID: <a882003d-4949-06ac-d111-8f41cb2d54b9@synopsys.com> (raw) Hi Richard, Last few weeks I have been working on cleaning up ARC port for further reviewing. In the context of the decoder, if I recall well, your observation was that a linear search was not Ok. Your suggestion was not to reinvent the wheel and generate decodetree to create the decoder. We started to do that and in the process we realize that the approach would bring us yet another encoding language description to maintain. Also that decodetree alone would not allow us to properly disassembly code, still requiring to keep the initial structure. Taking in consideration that we do all the other toolchain tools for ARC and that the decoder structure is already upstreamed in binutils we would definitely prefer to keep that structure and optimize the surroundings for proper decoding speeds. So far, we did the following: - converted opcodes.def to macros instead of table entries. - created a script that reads those entries and outputs macros that directly translate to a switch/case decision tree (example below), just like the ones produced by decodetree. The difference is that the switch will return the enum entry for the proper decoder structure instead of calling a translation function. - the script can either be contributed in C or python language as it is based on a simple recursive algorithm. As you have been the one giving attention to our target, I seek for your early feedback and to make sure that the solution is still inline with your expectations. Looking forward for your feedback. Regards, Cupertino PS: Would it be asking too much if we could have a call, just to get to meet each other. Unfortunately, no one now is able to do it any other way. I miss the traveling and conferences. Example1 (first few lines of the file): MATCH_PATTERN(0xf8000000) /* 11111000000000000000000000000000 */ MATCH_VALUE(0x0) /* 0 */ MATCH_PATTERN(0x10000) /* 10000000000000000 */ MATCH_VALUE(0x0) /* 0 */ RETURN_MATCH(OPCODE_ARCv2HS_b_0x00000000_0xF8010000_BRANCH_OP_SIMM21_A16_5) /* 00000ssssssssss0SSSSSSSSSSNQQQQQ */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x10000) /* 10000000000000000 */ RETURN_MATCH(OPCODE_ARCv2HS_b_0x00010000_0xF8010000_BRANCH_OP_SIMM25_A16_5) /* 00000ssssssssss1SSSSSSSSSSNRtttt */ END_MATCH_VALUE(0x10000) /* 10000000000000000 */ END_MATCH_PATTERN(0x10000) /* 10000000000000000 */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x8000000) /* 1000000000000000000000000000 */ MATCH_PATTERN(0x10000) /* 10000000000000000 */ MATCH_VALUE(0x0) /* 0 */ MATCH_PATTERN(0x20000) /* 100000000000000000 */ MATCH_VALUE(0x0) /* 0 */ RETURN_MATCH(OPCODE_ARCv2HS_bl_0x08000000_0xF8030000_BRANCH_OP_SIMM21_A32_5) /* 00001sssssssss00SSSSSSSSSSNQQQQQ */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x20000) /* 100000000000000000 */ RETURN_MATCH(OPCODE_ARCv2HS_bl_0x08020000_0xF8030000_BRANCH_OP_SIMM25_A32_5) /* 00001sssssssss10SSSSSSSSSSNRtttt */ END_MATCH_VALUE(0x20000) /* 100000000000000000 */ END_MATCH_PATTERN(0x20000) /* 100000000000000000 */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x10000) /* 10000000000000000 */ MATCH_PATTERN(0x17) /* 10111 */ MATCH_VALUE(0x0) /* 0 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x08010000_0xF8010017_BRCC_OP_RB_RC_SIMM9_A16_8) /* 00001bbbsssssss1SBBBCCCCCCN0Y000 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x08010F80_0xF8010FF7_BRCC_OP_RB_LIMM_SIMM9_A16_8) /* 00001bbbsssssss1SBBB11111000Y000 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x0E017000_0xFF017037_BRCC_OP_LIMM_RC_SIMM9_A16_8) /* 00001110sssssss1S111CCCCCC00Y000 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x0E017F80_0xFF017FF7_BRCC_OP_LIMM_LIMMdup_SIMM9_A16_8) /* 00001110sssssss1S11111111000Y000 */ END_MATCH_VALUE(0x0) /* 0 */ _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
WARNING: multiple messages have this Message-ID (diff)
From: Cupertino Miranda <Cupertino.Miranda@synopsys.com> To: Richard Henderson <richard.henderson@linaro.org>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org> Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>, Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>, "linux-snps-arc@lists.infradead.org" <linux-snps-arc@lists.infradead.org>, "cupertinomiranda@gmail.com" <cupertinomiranda@gmail.com> Subject: QEmu ARC port - decoder implementation feedback Date: Wed, 9 Jun 2021 09:58:34 +0000 [thread overview] Message-ID: <a882003d-4949-06ac-d111-8f41cb2d54b9@synopsys.com> (raw) Hi Richard, Last few weeks I have been working on cleaning up ARC port for further reviewing. In the context of the decoder, if I recall well, your observation was that a linear search was not Ok. Your suggestion was not to reinvent the wheel and generate decodetree to create the decoder. We started to do that and in the process we realize that the approach would bring us yet another encoding language description to maintain. Also that decodetree alone would not allow us to properly disassembly code, still requiring to keep the initial structure. Taking in consideration that we do all the other toolchain tools for ARC and that the decoder structure is already upstreamed in binutils we would definitely prefer to keep that structure and optimize the surroundings for proper decoding speeds. So far, we did the following: - converted opcodes.def to macros instead of table entries. - created a script that reads those entries and outputs macros that directly translate to a switch/case decision tree (example below), just like the ones produced by decodetree. The difference is that the switch will return the enum entry for the proper decoder structure instead of calling a translation function. - the script can either be contributed in C or python language as it is based on a simple recursive algorithm. As you have been the one giving attention to our target, I seek for your early feedback and to make sure that the solution is still inline with your expectations. Looking forward for your feedback. Regards, Cupertino PS: Would it be asking too much if we could have a call, just to get to meet each other. Unfortunately, no one now is able to do it any other way. I miss the traveling and conferences. Example1 (first few lines of the file): MATCH_PATTERN(0xf8000000) /* 11111000000000000000000000000000 */ MATCH_VALUE(0x0) /* 0 */ MATCH_PATTERN(0x10000) /* 10000000000000000 */ MATCH_VALUE(0x0) /* 0 */ RETURN_MATCH(OPCODE_ARCv2HS_b_0x00000000_0xF8010000_BRANCH_OP_SIMM21_A16_5) /* 00000ssssssssss0SSSSSSSSSSNQQQQQ */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x10000) /* 10000000000000000 */ RETURN_MATCH(OPCODE_ARCv2HS_b_0x00010000_0xF8010000_BRANCH_OP_SIMM25_A16_5) /* 00000ssssssssss1SSSSSSSSSSNRtttt */ END_MATCH_VALUE(0x10000) /* 10000000000000000 */ END_MATCH_PATTERN(0x10000) /* 10000000000000000 */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x8000000) /* 1000000000000000000000000000 */ MATCH_PATTERN(0x10000) /* 10000000000000000 */ MATCH_VALUE(0x0) /* 0 */ MATCH_PATTERN(0x20000) /* 100000000000000000 */ MATCH_VALUE(0x0) /* 0 */ RETURN_MATCH(OPCODE_ARCv2HS_bl_0x08000000_0xF8030000_BRANCH_OP_SIMM21_A32_5) /* 00001sssssssss00SSSSSSSSSSNQQQQQ */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x20000) /* 100000000000000000 */ RETURN_MATCH(OPCODE_ARCv2HS_bl_0x08020000_0xF8030000_BRANCH_OP_SIMM25_A32_5) /* 00001sssssssss10SSSSSSSSSSNRtttt */ END_MATCH_VALUE(0x20000) /* 100000000000000000 */ END_MATCH_PATTERN(0x20000) /* 100000000000000000 */ END_MATCH_VALUE(0x0) /* 0 */ MATCH_VALUE(0x10000) /* 10000000000000000 */ MATCH_PATTERN(0x17) /* 10111 */ MATCH_VALUE(0x0) /* 0 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x08010000_0xF8010017_BRCC_OP_RB_RC_SIMM9_A16_8) /* 00001bbbsssssss1SBBBCCCCCCN0Y000 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x08010F80_0xF8010FF7_BRCC_OP_RB_LIMM_SIMM9_A16_8) /* 00001bbbsssssss1SBBB11111000Y000 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x0E017000_0xFF017037_BRCC_OP_LIMM_RC_SIMM9_A16_8) /* 00001110sssssss1S111CCCCCC00Y000 */ MULTI_MATCH(OPCODE_ARCv2HS_breq_0x0E017F80_0xFF017FF7_BRCC_OP_LIMM_LIMMdup_SIMM9_A16_8) /* 00001110sssssss1S11111111000Y000 */ END_MATCH_VALUE(0x0) /* 0 */
next reply other threads:[~2021-06-09 10:03 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-09 9:58 Cupertino Miranda [this message] 2021-06-09 9:58 ` QEmu ARC port - decoder implementation feedback Cupertino Miranda 2021-06-09 16:39 ` Richard Henderson 2021-06-09 16:39 ` Richard Henderson 2021-06-09 20:00 ` Cupertino Miranda 2021-06-09 20:00 ` Cupertino Miranda
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=a882003d-4949-06ac-d111-8f41cb2d54b9@synopsys.com \ --to=cupertino.miranda@synopsys.com \ --cc=Claudiu.Zissulescu@synopsys.com \ --cc=Shahab.Vahedi@synopsys.com \ --cc=cupertinomiranda@gmail.com \ --cc=linux-snps-arc@lists.infradead.org \ --cc=qemu-devel@nongnu.org \ --cc=richard.henderson@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.