pub struct Bitstream { /* private fields */ }
Expand description
ECP5 bitstream in-memory.
Can be loaded from a path or file, and modified as required to change IDCODE checks and SPI mode and frequency.
Implementations§
Source§impl Bitstream
impl Bitstream
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
Open a bitstream from the provided path.
Sourcepub fn from_file(file: &mut File) -> Result<Self>
pub fn from_file(file: &mut File) -> Result<Self>
Open a bitstream from the provided open File
.
Sourcepub fn check_and_fix_idcode(
&mut self,
idcode: ECP5IDCODE,
fix: bool,
) -> Result<()>
pub fn check_and_fix_idcode( &mut self, idcode: ECP5IDCODE, fix: bool, ) -> Result<()>
Check the provided IDCODE matches the IDCODE check in the bitstream.
If the bitstream does not contain an IDCODE check, no action is taken.
If the bitstream contains a compatible but different IDCODE, and fix
is true, a warning is logged and the bitstream is patched to idcode
.
If the bitstream contains an incompatible IDCODE, an error is logged and this method returns an error.
Sourcepub fn remove_idcode(&mut self) -> Result<()>
pub fn remove_idcode(&mut self) -> Result<()>
Replace the VERIFY_ID command, if any, with NOOPs.
If the bitstream does not contain an IDCODE check, no action is taken.
Sourcepub fn remove_spimode(&mut self) -> Result<()>
pub fn remove_spimode(&mut self) -> Result<()>
Replace the SPI_MODE command, if any, with NOOPs.
If the bitstream metadata parsing was not successful or no SPI_MODE command was found, no action is taken.