5个不稳定版本
| 0.3.0 | 2020年8月24日 |
|---|---|
| 0.2.1 | 2020年8月12日 |
| 0.2.0 | 2020年8月12日 |
| 0.1.1 | 2020年8月11日 |
| 0.1.0 | 2020年8月11日 |
26KB
367 行
mif
内存初始化文件
特性
- 将MIF表示为
Vec<(word: T, bulk: usize)>。 - 检测单字序列
[first..last]: word,但不会检测二进制数据中的多字序列[first..last]: words..。 - 验证字是否适合MIF的字宽(位)。
- 只要字适合,就可以将具有不同字宽的多个MIF连接起来。
- 可选地使用给定的(文件)名称注释字中的连接偏移量。
- 提供简单的
mif dump子命令。 - 通过TOML指令文件提供可重复的
mif join子命令。
库
为Mif结构实现了MIF创建和序列化。
禁用默认功能,如cli和bin,以减少依赖关系
[dependencies]
mif = { version = "0.3", default-features = false }
默认功能
-
cli:提供mif二进制文件的命令行界面功能。需要:
anyhow、indexmap、serde、toml -
bin:启用编译mif二进制文件。需要:
cli、clap
命令行界面
通过cargo install mif安装。
提供两个子命令,dump和join。
mif 0.3.0
Rouven Spreckels <rs@qu1x.dev>
Memory Initialization File
USAGE:
mif <SUBCOMMAND>
OPTIONS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
dump Dumps binary as MIF
join Joins binaries' memory areas to MIFs
help Prints this message or the help of the given subcommand(s)
dump子命令
mif-dump
Dumps binary as MIF
USAGE:
mif dump [input]
ARGS:
<input> Input file or standard input (-) [default: -]
OPTIONS:
-w, --width <bits> Word width in bits from 1 to 128 [default: 16]
-f, --first <lsb|msb> LSB/MSB first (little/big-endian) [default: lsb]
-h, --help Prints help information
-V, --version Prints version information
join子命令
mif-join
Joins binaries' memory areas to MIFs
USAGE:
mif join [OPTIONS] [toml]
ARGS:
<toml> TOML file or standard input (-) [default: -]
OPTIONS:
-i, --bins <path> Input directory [default: .]
-o, --mifs <path> Output directory [default: .]
-n, --no-comments No comments in MIFs
-h, --help Prints help information
-V, --version Prints version information
join示例
假设有两个ROM转储文件,a.rom和b.rom,其程序和数据区域连接如下
cat a.程序.rom a.数据.rom>a.romcat b.程序.rom b.数据.rom>b.rom
以下TOML文件定义了如何将两个程序区域连接到一个MIF,并将两个数据区域连接到另一个MIF,假设程序区域为深度1267和1747的24位程序字,数据区域为每个1024个16位数据字。此外,每个区域都转储到其自己的单独MIF以进行验证。然后,在程序区域和数据区域之间应有一个未使用的区域,包含0xffffff个字,应跳过这些字。在skips指令中列出它们将验证该区域只包含这些字。
[["a.rom"]]
first = "lsb" # Least-significant byte first. Default, can be omitted.
width = 24
depth = 1267
joins = ["a.prog.mif", "ab.prog.mif"]
[["a.rom"]]
first = "lsb" # Least-significant byte first. Default, can be omitted.
width = 24
depth = 781
skips = [0xffffff] # Empty [] for skipping without verification.
[["a.rom"]]
first = "msb"
width = 16 # Default, can be omitted.
depth = 1024
joins = ["a.data.mif", "ab.data.mif"]
[["b.rom"]]
width = 24
depth = 1747
joins = ["b.prog.mif", "ab.prog.mif"]
[["b.rom"]]
width = 24
depth = 301
skips = [0xffffff]
[["b.rom"]]
depth = 1024
joins = ["b.data.mif", "ab.data.mif"]
许可证
双许可协议下使用 MIT OR Apache-2.0。
贡献
除非您明确声明,否则您有意提交以包含在您作品中的任何贡献,都应按上述许可方式授权,不附加任何额外条款或条件。
依赖
~0.5–1.4MB
~28K SLoC