TMS320C6x Disassembler
A pure python disassembler for the TMS320C6x family, currently supported up to ISA C674. Disassembles to python instruction objects for a configured ISA version.
This project is based on the TI C6X Disassembler included in libopcodes. The conversion scripts of this project are intended to parse opcode definitions from this source and convert them to JSON.
Usage
To make use of this library, create a Disassembler object for your ISA version. For an address and instruction bytes the disassembler returns a generator of instructions. The disassembly can optionally be limited to a number of (32-bit) words.
Please note that from version C64x+ the ISA supports header-based fetch packets (FPs). If such a version is specified, the disassembler requires knowledge about the last word of the FP to correctly disassembly instructions. Distinguishing between compact and regular instructions is only possible using the header (or the absence of one). Additionally, header information may be relevant for regular instructions (see protected loads). This library assumes no header if data ends in the middle of the FP and no header is specified. You can pass the header bytes (or last FP word in general) as a separate argument.
Example:
from tms320c6x_disassembler import Disassembler
from tms320c6x_disassembler.types import ISA
disassembler = Disassembler(ISA.C67XP)
instr = disassembler.disasm(bytes.fromhex('00000028'), 0x80)
str(next(instr)) # '00000080: mvk .S1 0, A0'
hb_disassembler = Disassembler(ISA.C674X)
instr = list(hb_disassembler.disasm(bytes.fromhex('6eec'), 0x80))
assert len(instr) == 0 # header word missing for compact instruction
instr = hb_disassembler.disasm(bytes.fromhex('6eec'), 0x80, header=bytes.fromhex('000020e0'))
str(next(instr)) # '00000080: nop 8'
Instruction Definitions
The source of truth for instructions, their encodings and semantics are the CPU and Instruction Set Reference Guides provided by TI. As mentioned above, the JSON definitions of the instructions are generated from header files from libopcodes. In some cases, the definitions in this repository differ from one of these sources.
This project updates the access information of the ADDK instruction. Only a write to the dst register is documented, but instead of reading the constant, this register should also be read. The register is treated as read+write here.
The following changes update the definitions of libobcodes in accordance with the reference guide. First, the flags of non-aligned load/store instructions were updated. All variants of these instructions should have the unaligned flag. Also, LDNDW/STNDW operands were updated to use scaled offsets. Lastly, the access information for BNOP and MVC was corrected to read in all cases. This is taken from the reference guide and seemingly incorrect in libobcodes.
For some instructions, the reference guide is not correct or at least less precise than libopcodes. The formats from libopcodes correct or specialize some formats, like for SPEKERNEL(R) and SPMASK(R). Additionally, libopcodes documents several errors in the reference guide for specific instructions. For example, a missing format for CMPGTU/CMPLTU instructions. In such cases, libopcodes is trusted.
Please also note that access information for memory operands does not document the register accesses in cycle 1 performed during address generation and optional base register update. Similarly, some instructions implicitly read control registers.
Contributing
Contributions are welcome. Please feel free to submit a pull request. Please refrain from purely AI-driven contributions (keep a human in the loop).
Metadata
Release files for tms320c6x-disassembler 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tms320c6x_disassembler-1.0.2.tar.gz | 44.2 kB | Without provenance | Details for tms320c6x_disassembler-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tms320c6x_disassembler-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for tms320c6x_disassembler-1.0.2-py3-none-any.whl |
Total release size: 91.5 kB
Release files / tms320c6x_disassembler-1.0.2.tar.gz
| Download URL | tms320c6x_disassembler-1.0.2.tar.gz |
|---|---|
| Size | 44.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff5b32f703d0842cd8501ec84ab8addd125bfa070ee998c43d4db6b577d8df0a
|
|
BLAKE2b-256 checksum How to use checksums |
df63b3f654e3783cf82667ee39743ad3e62f62dddbccf77e9bdb9e2586623d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / tms320c6x_disassembler-1.0.2-py3-none-any.whl
| Download URL | tms320c6x_disassembler-1.0.2-py3-none-any.whl |
|---|---|
| Size | 47.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d82471890d72af4bdacd76f04c6151be9d83f3bcf73fc128d6b339f42b31e14f
|
|
BLAKE2b-256 checksum How to use checksums |
cbb87ee1e16b82497ea7953f60eef4088d5e29b28dbe60188202fc398be0bac6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for tms320c6x-disassembler 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.