BitstreamWriter::writeBitstream (fpga/xilinx/bitstream-writer.h:159-188) was refactored from an ofstream-by-path to a generic std::ostream, and backpatches the 4-byte e (data length) record via tellp() / seekp(). It returns 0 unconditionally.
assembler.cc passes std::cout:
- With
fpga-as ... > out.bit the stream is seekable and everything works.
- Through a pipe (
fpga-as ... | prog) or a terminal, tellp() returns -1, seekp() sets failbit, the length field silently stays 0x00000000, and the tool still reports success.
- Stream write errors (disk full, EPIPE) are likewise never detected. The prjxray original at least returned 1 when the output file could not be opened.
Consumers that honor the e TLV length see a data length of 0.
Fix options: buffer the payload and write the length up front; or check out state after the final seekp/put sequence and return an error; or require a seekable stream explicitly.
Found by comparing against prjxray @ 7557c7cc.
BitstreamWriter::writeBitstream(fpga/xilinx/bitstream-writer.h:159-188) was refactored from an ofstream-by-path to a genericstd::ostream, and backpatches the 4-bytee(data length) record viatellp()/seekp(). It returns 0 unconditionally.assembler.ccpassesstd::cout:fpga-as ... > out.bitthe stream is seekable and everything works.fpga-as ... | prog) or a terminal,tellp()returns -1,seekp()setsfailbit, the length field silently stays0x00000000, and the tool still reports success.Consumers that honor the
eTLV length see a data length of 0.Fix options: buffer the payload and write the length up front; or check
outstate after the finalseekp/putsequence and return an error; or require a seekable stream explicitly.Found by comparing against prjxray @ 7557c7cc.