Bitstream Format

The format of the bitstream has many similarities to ECP5 and previous Lattice devices. It is still a command-based format with many similar commands, albeit with changes for some of the new features.

"Magic" and comments

The first four bytes of the bitstream are 0x4C 0x53 0x43 0x43 (LSCC, i.e. Lattice SemiConductor Corporation). (TODO: test - this may be needed for SPI flash boot to work.)

This the follows an option comment section, which is bounded by 0xFF 0x00 and 0x00 0xFF. It contains several null-terminated strings used by tools like Radiant Programmer to determine the device, package, build date/time etc. It is not parsed by the chip.

Preamble

The four bytes marking the start of an actual bitstream are 0xFF 0xFF 0xBD 0xB3, the same as the ECP5.

Commands

All commands (except the 0xFF dummy command) are followed by three "parameter" bytes and then zero or more bytes of payload. All multi-byte integers are big endian.

Config Frames

Config frames are written in three chunks (numbers for LIFCL):

It is believed this ordering is for the "early IO release" feature.

The final 14 bits of each config frame are used for an error correcting code ("parity"). This uses the typical CRC algorithm with polynomial 0x202D.

The error correcting code does not include LUT RAM initialisation bits, these are masked with zeroes, because they can change at runtime.

Following each frame is the standard packet CRC16, which uses the common 0x8005 polynomial.

IP/RAM bus

IP and RAM configuration and initialisation is not done using general configuration frames but using a special bus, which for IP mirrors the LMMI bus exposed to fabric.

The first byte of the 32-bit bus address is used to determine the destination type, and the word size for LSC_BUS_WRITE: