diff options
author | James Bowman <jamesb@excamera.com> | 2017-10-12 18:37:40 -0700 |
---|---|---|
committer | James Bowman <jamesb@excamera.com> | 2017-10-12 18:41:29 -0700 |
commit | 3b4b0a629a972bf80fc0ac6202f89681fab1df37 (patch) | |
tree | c8cde198a64de3a48b1de08dbf65f68dbbc9a13d /opcodes | |
parent | d268bbaff7da90caf5fbc94456ae58315ffa1802 (diff) | |
download | binutils-3b4b0a629a972bf80fc0ac6202f89681fab1df37.zip binutils-3b4b0a629a972bf80fc0ac6202f89681fab1df37.tar.gz binutils-3b4b0a629a972bf80fc0ac6202f89681fab1df37.tar.bz2 |
FT32: support for FT32B processor - part 1
FT32B is a new FT32 family member. It has a code
compression scheme, which requires the use of linker
relaxations. The change is quite large, so submission
is in several parts.
Part 1 adds a 15-bit instruction field, and CPU-specific functions for
the code compression that are used in binutils and GDB.
bfd/ChangeLog:
2017-10-12 James Bowman <james.bowman@ftdichip.com>
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* elf32-ft32.c: Add HOWTO R_FT32_15.
* reloc.c: Add BFD_RELOC_FT32_15.
gas/ChangeLog:
2017-10-12 James Bowman <james.bowman@ftdichip.com>
* config/tc-ft32.c (md_assemble): Replace FT32_FLD_K8 with
K15.
(md_apply_fix, tc_gen_reloc): Add BFD_RELOC_FT32_15.
include/ChangeLog:
2017-10-12 James Bowman <james.bowman@ftdichip.com>
* elf/ft32.h: Add R_FT32_15.
* opcode/ft32.h: Replace FT32_FLD_K8 with K15.
(ft32_shortcode, sc_compar, ft32_split_shortcode,
ft32_merge_shortcode, ft32_merge_shortcode): New functions.
opcodes/ChangeLog:
2017-10-12 James Bowman <james.bowman@ftdichip.com>
* opcodes/ft32-dis.c (print_insn_ft32): Replace FT32_FLD_K8 with K15.
* opcodes/ft32-opc.c (ft32_opc_info): Replace FT32_FLD_K8 with
K15. Add jmpix pattern.
sim/ChangeLog:
2017-10-12 James Bowman <james.bowman@ftdichip.com>
* sim/ft32/interp.c (step_once): Replace FT32_FLD_K8 with K15.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 6 | ||||
-rw-r--r-- | opcodes/ft32-dis.c | 55 | ||||
-rw-r--r-- | opcodes/ft32-opc.c | 10 |
3 files changed, 49 insertions, 22 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d01f793..eebf69e 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2017-10-12 James Bowman <james.bowman@ftdichip.com> + + * ft32-dis.c (print_insn_ft32): Replace FT32_FLD_K8 with K15. + * ft32-opc.c (ft32_opc_info): Replace FT32_FLD_K8 with + K15. Add jmpix pattern. + 2017-10-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * s390-opc.txt (prno, tpei, irbm): New instructions added. diff --git a/opcodes/ft32-dis.c b/opcodes/ft32-dis.c index 93339a1..c99ef3e 100644 --- a/opcodes/ft32-dis.c +++ b/opcodes/ft32-dis.c @@ -39,32 +39,31 @@ sign_extend(int bit, int value) return (value & (onebit - 1)) - (value & onebit); } -int -print_insn_ft32 (bfd_vma addr, struct disassemble_info *info) +static void +ft32_opcode(bfd_vma addr ATTRIBUTE_UNUSED, + unsigned int iword, + struct disassemble_info *info) { - int status; - stream = info->stream; - bfd_byte buffer[4]; - unsigned int iword; const ft32_opc_info_t *oo; - fpr = info->fprintf_func; - - if ((status = info->read_memory_func (addr, buffer, 4, info))) - goto fail; - - iword = bfd_getl32 (buffer); - for (oo = ft32_opc_info; oo->name; oo++) if ((iword & oo->mask) == oo->bits) break; + unsigned int sc[2]; + if (ft32_decode_shortcode((unsigned int)addr, iword, sc)) + { + ft32_opcode(addr, sc[0], info); + fpr (stream, " ; "); + ft32_opcode(addr, sc[1], info); + } + if (oo->name) { int f = oo->fields; int imm; - fpr (stream, "%08x %s", iword, oo->name); + fpr (stream, "%s", oo->name); if (oo->dw) { fpr (stream, ".%c ", "bsl"[(iword >> FT32_FLD_DW_BIT) & 3]); @@ -148,9 +147,9 @@ print_insn_ft32 (bfd_vma addr, struct disassemble_info *info) imm = iword & ((1 << FT32_FLD_K16_SIZ) - 1); fpr(stream, "%d", imm); break; - case FT32_FLD_K8: - imm = iword & ((1 << FT32_FLD_K8_SIZ) - 1); - fpr(stream, "%d", sign_extend(7, imm)); + case FT32_FLD_K15: + imm = iword & ((1 << FT32_FLD_K15_SIZ) - 1); + fpr(stream, "%d", sign_extend(14, imm)); break; case FT32_FLD_R_D_POST: fpr(stream, "$r%d", (iword >> FT32_FLD_R_D_BIT) & 0x1f); @@ -171,8 +170,28 @@ print_insn_ft32 (bfd_vma addr, struct disassemble_info *info) } else { - fpr (stream, "%08x!", iword); + fpr (stream, "!"); } +} + +int +print_insn_ft32 (bfd_vma addr, struct disassemble_info *info) +{ + int status; + stream = info->stream; + bfd_byte buffer[4]; + unsigned int iword; + + fpr = info->fprintf_func; + + if ((status = info->read_memory_func (addr, buffer, 4, info))) + goto fail; + + iword = bfd_getl32 (buffer); + + fpr (stream, "%08x ", iword); + + ft32_opcode(addr, iword, info); return 4; diff --git a/opcodes/ft32-opc.c b/opcodes/ft32-opc.c index 2b592ce..1a70d29 100644 --- a/opcodes/ft32-opc.c +++ b/opcodes/ft32-opc.c @@ -27,8 +27,8 @@ const ft32_opc_info_t ft32_opc_info[] = { "nop", 0, 0xffffffffU, 0x40004000U, 0}, { "move", 1, 0xf8007fffU, 0x40004000U, FT32_FLD_R_D|FT32_FLD_R_1}, { "streamin", 1, 0xf800000fU, 0xf000000cU, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, -{ "ldi", 1, 0xf8000000U, 0xa8000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_K8}, -{ "exi", 1, 0xf8000000U, 0xe8000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_K8}, +{ "ldi", 1, 0xf8000000U, 0xa8000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_K15}, +{ "exi", 1, 0xf8000000U, 0xe8000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_K15}, { "return", 0, 0xfc000000U, 0xa0000000U, 0}, { "or", 1, 0xf800000fU, 0x40000005U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "pop", 1, 0xf8000000U, 0x88000000U, FT32_FLD_R_D}, @@ -52,12 +52,12 @@ const ft32_opc_info_t ft32_opc_info[] = { "strcmp", 1, 0xf800000fU, 0xf0000004U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "mul", 1, 0xf800000fU, 0xf0000008U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "push", 1, 0xf8000000U, 0x80000000U, FT32_FLD_R_1}, -{ "sti", 1, 0xf8000000U, 0xb0000000U, FT32_FLD_R_D|FT32_FLD_K8|FT32_FLD_R_1_POST}, +{ "sti", 1, 0xf8000000U, 0xb0000000U, FT32_FLD_R_D|FT32_FLD_K15|FT32_FLD_R_1_POST}, { "mod", 1, 0xf800000fU, 0xf0000003U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "umod", 1, 0xf800000fU, 0xf0000001U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "addcc", 1, 0xf9f0000fU, 0x59e00000U, FT32_FLD_R_1|FT32_FLD_RIMM}, { "streamout", 1, 0xf800000fU, 0xf000000eU, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, -{ "lpmi", 1, 0xf8000000U, 0xc8000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_K8}, +{ "lpmi", 1, 0xf8000000U, 0xc8000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_K15}, { "udiv", 1, 0xf800000fU, 0xf0000000U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "sub", 1, 0xf800000fU, 0x40000002U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "lshr", 1, 0xf800000fU, 0x40000009U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, @@ -79,10 +79,12 @@ const ft32_opc_info_t ft32_opc_info[] = { "ashr", 1, 0xf800000fU, 0x4000000aU, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "jmpi", 0, 0xfffc0000U, 0x08300000U, FT32_FLD_R_2}, { "jmpic", 0, 0xf8040000U, 0x08000000U, FT32_FLD_CBCRCV|FT32_FLD_R_2}, +{ "jmpix", 0, 0xf8040000U, 0x08000000U, FT32_FLD_CR|FT32_FLD_CB|FT32_FLD_CV|FT32_FLD_R_2}, { "ashl", 1, 0xf800000fU, 0x40000008U, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, { "jmpc", 0, 0xfe340000U, 0x00200000U, FT32_FLD_CBCRCV|FT32_FLD_PA}, { "jmpx", 0, 0xf8040000U, 0x00000000U, FT32_FLD_CR|FT32_FLD_CB|FT32_FLD_CV|FT32_FLD_PA}, { "lpm", 1, 0xf8000000U, 0x68000000U, FT32_FLD_R_D|FT32_FLD_PA}, {"streamouti", 1, 0xf800000fU, 0xf000000fU, FT32_FLD_R_D|FT32_FLD_R_1|FT32_FLD_RIMM}, +{ "halt", 0, 0xf8000000U, 0x78000000U, 0}, { NULL, 0, 0, 0, 0} }; |