Skip to main content

Crate veriloghex

Crate veriloghex 

Source
Expand description

This is a library for reading and parsing Verilog hex files obtained with objcopy -O verilog.

Inspired by https://github.com/martinmroz/ihex/blob/master/src/reader.rs

§Iterating over bytes example:

static TEXT_STR: &str = r#"
@81000000
09 A0 F3 22 20 34 63 84 02 00 6F 00 E0 57 81 40
01 41 81 41 01 42 81 42 01 43 81 43 01 44 81 44"#;

let reader = crate::Reader::new(TEXT_STR);
for data in reader {
    std::println!("{}", data.unwrap());
}

Output:

new address: 0x81000000
0x81000000: 09
0x81000001: A0
0x81000002: F3
0x81000003: 22

§Grouping bytes example:

static TEXT_STR: &str = r#"
@81000000
09 A0 F3 22 20 34 63 84 02 00 6F 00 E0 57 81 40
01 41 81 41 01 42 81 42 01 43 81 43 01 44 81 44"#;

let reader = crate::Reader::new_with_options(TEXT_STR, crate::ReaderOptions { group: true });
for data in reader {
    std::println!("{}", data.unwrap());
}

Output:

new address: 0x81000000
0x81000000: 8463342022F3A009
0x81000008: 408157E0006F0002
0x81000010: 4281420141814101

Structs§

Reader
A reader for Verilog hex files.
ReaderOptions
Configuration options for the reader.

Enums§

DataType
Bytes in a line are grouped into N groups of M bytes each.
ReaderError
Custom simple error type.
Record
Syntax token type.

Functions§

read_file