Hardware-to-Cloud Bridge
iverilog but we provide a container with an install.valclkrsttest and c1!c1.clk (denoted ") changes to value 1 at time #3.$ pip install vcd2df
$ python3 -c "import vcd2df as v; print(v.vcd2df('test.vcd'))"
#0 #1 #2 #3 #4 #5 #6 #7 #8
val -1 0 0 0 0 1 1 2 2
clk 0 1 0 1 0 1 0 1 0
rst 0 0 0 0 0 1 1 1 1
out -1 0 0 0 0 1 1 2 2-1 denotes an uninitialized (not yet set) register.NaN to denote invalid entiries.Option type.Type
Optionrepresents an optional value: everyOptionis eitherSomeand contains a value, orNone, and does not.
Nonelet tmp: Vec<Option<u64>> = curr.values().cloned().collect();
times.push(Column::new(time.into(), tmp));┌───────┬──────┬─────┬─────┬───┬─────┬─────┬─────┬─────┐
│ Names ┆ #0 ┆ #1 ┆ #2 ┆ … ┆ #6 ┆ #7 ┆ #8 ┆ #9 │
│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ u64 ┆ u64 ┆ u64 ┆ ┆ u64 ┆ u64 ┆ u64 ┆ u64 │
╞═══════╪══════╪═════╪═════╪═══╪═════╪═════╪═════╪═════╡
│ val ┆ null ┆ 0 ┆ 0 ┆ … ┆ 1 ┆ 2 ┆ 2 ┆ 3 │
│ clk ┆ 0 ┆ 1 ┆ 0 ┆ … ┆ 0 ┆ 1 ┆ 0 ┆ 1 │
│ rst ┆ 0 ┆ 0 ┆ 0 ┆ … ┆ 1 ┆ 1 ┆ 1 ┆ 1 │
│ out ┆ null ┆ 0 ┆ 0 ┆ … ┆ 1 ┆ 2 ┆ 2 ┆ 3 │
└───────┴──────┴─────┴─────┴───┴─────┴─────┴─────┴─────┘-1’s that don’t make sense are now an Arrow null by way of a Rust None!┌──────────────────────┬──────┬───────┬────────┬───┬────────────┬────────────┬────────────┬────────────┐
│ Names ┆ #0 ┆ #5000 ┆ #10000 ┆ … ┆ #10980000 ┆ #10985000 ┆ #10990000 ┆ #10995000 │
│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ u64 ┆ u64 ┆ u64 ┆ ┆ u64 ┆ u64 ┆ u64 ┆ u64 │
╞══════════════════════╪══════╪═══════╪════════╪═══╪════════════╪════════════╪════════════╪════════════╡
│ trap ┆ 0 ┆ 0 ┆ 0 ┆ … ┆ 0 ┆ 0 ┆ 0 ┆ 0 │
│ decoded_rs ┆ null ┆ null ┆ null ┆ … ┆ null ┆ null ┆ null ┆ null │
│ mem_la_wdata ┆ null ┆ null ┆ null ┆ … ┆ 45 ┆ 45 ┆ 45 ┆ 45 │
│ mem_wstrb ┆ null ┆ null ┆ null ┆ … ┆ 0 ┆ 0 ┆ 15 ┆ 15 │
│ decoded_rs1 ┆ null ┆ null ┆ null ┆ … ┆ 31 ┆ 31 ┆ 31 ┆ 31 │
│ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … │
│ mem_do_wdata ┆ 0 ┆ 0 ┆ 0 ┆ … ┆ 1 ┆ 1 ┆ 1 ┆ 1 │
│ decoded_imm_j ┆ null ┆ null ┆ null ┆ … ┆ 4294967284 ┆ 4294967284 ┆ 4294967284 ┆ 4294967284 │
│ mem_la_firstword_reg ┆ 0 ┆ 0 ┆ 0 ┆ … ┆ 0 ┆ 0 ┆ 0 ┆ 0 │
│ decoded_rd ┆ null ┆ null ┆ null ┆ … ┆ 0 ┆ 0 ┆ 0 ┆ 0 │
│ mem_la_secondword ┆ 0 ┆ 0 ┆ 0 ┆ … ┆ 0 ┆ 0 ┆ 0 ┆ 0 │
└──────────────────────┴──────┴───────┴────────┴───┴────────────┴────────────┴────────────┴────────────┘┌──────────────────────┬───────────┐
│ Names ┆ Canonical │
│ --- ┆ --- │
│ str ┆ bool │
╞══════════════════════╪═══════════╡
│ trap ┆ False │
│ decoded_rs ┆ False │
│ mem_la_wdata ┆ False │
│ mem_wstrb ┆ False │
│ decoded_rs1 ┆ False │
│ … ┆ False │
│ mem_do_wdata ┆ False │
│ decoded_imm_j ┆ False │
│ mem_la_firstword_reg ┆ False │
│ decoded_rd ┆ False │
│ mem_la_secondword ┆ False │
└──────────────────────┴───────────┘To do so, we implemented a crate in Rust and performed a simple example, based on a use case involving a map of information flow detection across 181 value change dump files.
| Python | Rust |
|---|---|
| 74.5s | 291.7s |
| Python | Build | Cluster |
|---|---|---|
| 1.76 GB | 2.59 GB | .78 GB |
| Python | Rust |
|---|---|
| 28.5s | 2.2s |
We found this performance unexpectedly high. Having specifically worked in Python for this research direction for close to a decade, we have few remaining optimizations… By contrast, we… were concerned a lack of familiarity with the language may incur heavy costs due to unnecessary borrows or poor choice of types.