kaitai-io / kaitai_struct_formats

Kaitai Struct: library of binary file formats (.ksy)
http://formats.kaitai.io
695 stars 201 forks source link

Xilinx FPGA bitstream #255

Open KOLANICH opened 4 years ago

KOLANICH commented 4 years ago
meta:
  id: xilinx_bitstream
  title: Xilinx FPGA Bitstream
  license: Apache-2.0
  endian: be
WiP: https://github.com/SymbiFlow/prjxray/blob/fa162e0b54d1d3a01e915012f7c71881c23c0b88/docs/xilinx_bitstream.ksy

Implemented by @kc8apf and @mithro but was dropped in https://github.com/SymbiFlow/prjxray/commit/a6f1e92ee67cb73207e186e10e357e690b8fbba9 .

mx-shift commented 4 years ago

It was removed because it is of very limited utility. Only the lowest level packet format can be decoded with Kaitai. The packets describe register reads and writes that require preserving state to interpret. There are also bugs in the official bitstream generator that require preserving state to correct. I abandoned Kaitai and wrote a C++ parser and later a Rust parser.

On Tue, Dec 31, 2019, 9:53 AM KOLANICH notifications@github.com wrote:

meta: id: xilinx_bitstream title: Xilinx FPGA Bitstream license: Apache-2.0endian: be

WiP: https://github.com/SymbiFlow/prjxray/blob/fa162e0b54d1d3a01e915012f7c71881c23c0b88/docs/xilinx_bitstream.ksy

Implemented by @kc8apf https://github.com/kc8apf and @mithro https://github.com/mithro but was removed in SymbiFlow/prjxray@a6f1e92 https://github.com/SymbiFlow/prjxray/commit/a6f1e92ee67cb73207e186e10e357e690b8fbba9 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kaitai-io/kaitai_struct_formats/issues/255?email_source=notifications&email_token=ACIEHFYMSNFQMIQXO5EFYU3Q3OBILA5CNFSM4KBXCCRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IDQOI7A, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACIEHFZMK2LPYWNBRQMPYILQ3OBILANCNFSM4KBXCCRA .

KOLANICH commented 4 years ago

There are also bugs in the official bitstream generator that require preserving state to correct.

Does it affect the layer that can be written in KS? In fact there are ways of preserving state using caches and/or recursion but they are hacks.

mx-shift commented 4 years ago

Yes. Debug and per-frame-CRC bitstreams generated by the official tools omit a packet header when inserting a required frame of all zeros after a row switch. Naive parsing shows this as a packet of type zero which is illegal.

On Tue, Dec 31, 2019, 11:53 AM KOLANICH notifications@github.com wrote:

There are also bugs in the official bitstream generator that require preserving state to correct.

Does it affect the layer that can be written in KS? In fact there are ways of preserving state using caches, but they are hacks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kaitai-io/kaitai_struct_formats/issues/255?email_source=notifications&email_token=ACIEHFYEHELKIB5J7FZKVGTQ3OPLPA5CNFSM4KBXCCRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH4TW7Q#issuecomment-569981822, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACIEHF5F4JAX7FMUW3NLTNTQ3OPLPANCNFSM4KBXCCRA .