From 41b8336f958ac14d47a8335a6c0f6480562df27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20L=C3=A4ufer?= Date: Wed, 26 Jun 2024 13:31:53 -0400 Subject: [PATCH] wip: gtk wave loading --- Cargo.toml | 4 +- gtkw/Cargo.toml | 17 +++ gtkw/inputs/ghdl_oscar.gtkw | 22 ++++ gtkw/inputs/ghdl_oscar_test2.gtkw | 22 ++++ gtkw/inputs/waves.gtkw | 179 ++++++++++++++++++++++++++++++ gtkw/src/lib.rs | 40 +++++++ 6 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 gtkw/Cargo.toml create mode 100644 gtkw/inputs/ghdl_oscar.gtkw create mode 100644 gtkw/inputs/ghdl_oscar_test2.gtkw create mode 100644 gtkw/inputs/waves.gtkw create mode 100644 gtkw/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index a801684..001ffe3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,8 @@ [workspace] resolver = "2" -members = ["wellen"] -default-members = ["wellen"] +members = ["wellen", "gtkw"] +default-members = ["wellen", "gtkw"] [workspace.package] version = "0.9.14" diff --git a/gtkw/Cargo.toml b/gtkw/Cargo.toml new file mode 100644 index 0000000..d5ec8ef --- /dev/null +++ b/gtkw/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "gtkw" +version = "0.1.0" +edition.workspace = true +rust-version = "1.73.0" +authors.workspace = true +description = "GTKWave save file parser" +repository.workspace = true +license.workspace = true +include = ["Cargo.toml", "src/"] +keywords = ["gtkwave", "gtkw", "save"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[dev-dependencies] diff --git a/gtkw/inputs/ghdl_oscar.gtkw b/gtkw/inputs/ghdl_oscar.gtkw new file mode 100644 index 0000000..a0adbb3 --- /dev/null +++ b/gtkw/inputs/ghdl_oscar.gtkw @@ -0,0 +1,22 @@ +[*] +[*] GTKWave Analyzer v3.3.119 (w)1999-2024 BSI +[*] Fri Jun 21 14:45:38 2024 +[*] +[dumpfile] "/home/kevin/d/wellen/wellen/inputs/ghdl/oscar/test2.ghw" +[dumpfile_mtime] "Tue Jun 18 13:15:31 2024" +[dumpfile_size] 566 +[savefile] "/home/kevin/d/wellen/gtkw/inputs/ghdl_oscar.gtkw" +[timestart] 0 +[size] 1000 600 +[pos] 94 109 +*-25.525793 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[treeopen] top. +[treeopen] top.test2. +[sst_width] 273 +[signals_width] 78 +[sst_expanded] 1 +[sst_vpaned_height] 157 +@420 +top.test2.ea[0] +[pattern_trace] 1 +[pattern_trace] 0 diff --git a/gtkw/inputs/ghdl_oscar_test2.gtkw b/gtkw/inputs/ghdl_oscar_test2.gtkw new file mode 100644 index 0000000..a47313d --- /dev/null +++ b/gtkw/inputs/ghdl_oscar_test2.gtkw @@ -0,0 +1,22 @@ +[*] +[*] GTKWave Analyzer v3.3.119 (w)1999-2024 BSI +[*] Fri Jun 21 14:39:19 2024 +[*] +[dumpfile] "/home/kevin/d/wellen/wellen/inputs/ghdl/oscar/test2.ghw" +[dumpfile_mtime] "Tue Jun 18 13:15:31 2024" +[dumpfile_size] 566 +[savefile] "/home/kevin/d/wellen/gtkw/inputs/ghdl_oscar.gtkw" +[timestart] 0 +[size] 1000 600 +[pos] 94 109 +*0.000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[treeopen] top. +[treeopen] top.test2. +[sst_width] 273 +[signals_width] 78 +[sst_expanded] 1 +[sst_vpaned_height] 157 +@420 +top.test2.ea[0] +[pattern_trace] 1 +[pattern_trace] 0 diff --git a/gtkw/inputs/waves.gtkw b/gtkw/inputs/waves.gtkw new file mode 100644 index 0000000..9815faf --- /dev/null +++ b/gtkw/inputs/waves.gtkw @@ -0,0 +1,179 @@ +[*] source: https://github.com/tomverbeure/math/blob/628be231b362b875b9d15540aca1df8532a9b73d/waves.gtkw +[*] +[*] GTKWave Analyzer v3.3.90 (w)1999-2018 BSI +[*] Sun Oct 14 04:55:40 2018 +[*] +[dumpfile] "/home/tom/projects/math/simWorkspace/FpxxDemo/test.vcd" +[dumpfile_mtime] "Sun Oct 14 04:54:44 2018" +[dumpfile_size] 114361 +[savefile] "/home/tom/projects/math/waves.gtkw" +[timestart] 6508 +[size] 2825 1316 +[pos] -1 -1 +*-5.474033 6700 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[treeopen] TOP. +[treeopen] TOP.FpxxDemo. +[sst_width] 347 +[signals_width] 330 +[sst_expanded] 1 +[sst_vpaned_height] 410 +@28 +TOP.osc_clk +@22 +TOP.lz_in[22:0] +@25 +TOP.lz[4:0] +@200 +- +@28 +TOP.op_vld +@22 +TOP.op_a[31:0] +TOP.op_b[31:0] +@200 +- +@28 +TOP.op_a_p_op_b_vld +@22 +TOP.op_a_p_op_b[31:0] +@200 +- +@420 +TOP.FpxxDemo.core_add.exp_diff_a_b_p0[8:0] +@24 +TOP.FpxxDemo.core_add.exp_diff_b_a_p0[7:0] +@200 +- +@28 +TOP.FpxxDemo.core_add.op_a_p0_sign +TOP.FpxxDemo.core_add.op_b_p0_sign +@24 +TOP.FpxxDemo.core_add.op_a_p0_exp[7:0] +TOP.FpxxDemo.core_add.op_b_p0_exp[7:0] +@22 +TOP.FpxxDemo.core_add.mant_a_p0[23:0] +TOP.FpxxDemo.core_add.mant_b_p0[23:0] +@200 +- +@28 +TOP.FpxxDemo.core_add.sign_a_swap_p0 +TOP.FpxxDemo.core_add.sign_b_swap_p0 +@22 +TOP.FpxxDemo.core_add.mant_a_swap_p0[23:0] +TOP.FpxxDemo.core_add.mant_b_swap_p0[23:0] +@200 +- +@24 +TOP.FpxxDemo.core_add.exp_add_p0[7:0] +@28 +TOP.FpxxDemo.core_add.exp_diff_ovfl_p0 +@22 +TOP.FpxxDemo.core_add.exp_diff_p0[4:0] +@200 +- +@24 +TOP.FpxxDemo.core_add.exp_add_p0[7:0] +@22 +TOP.FpxxDemo.core_add.mant_a_adj_p1[24:0] +TOP.FpxxDemo.core_add.mant_b_adj_p1[24:0] +@200 +- +@24 +TOP.FpxxDemo.core_add.exp_add_p2[7:0] +@200 +- +@22 +TOP.FpxxDemo.core_add.mant_a_adj_p2[24:0] +TOP.FpxxDemo.core_add.mant_b_adj_p2[24:0] +@200 +- +@22 +TOP.FpxxDemo.core_add.mant_a_opt_inv_p2[25:0] +TOP.FpxxDemo.core_add.mant_b_opt_inv_p2[25:0] +@200 +- +- +@22 +TOP.FpxxDemo.core_add.mant_a_opt_inv_p3[25:0] +TOP.FpxxDemo.core_add.mant_b_opt_inv_p3[25:0] +>1080 +TOP.FpxxDemo.core_add.mant_add_p3[24:0] +@200 +>0 +- +@22 +TOP.FpxxDemo.core_add.lz_p4[4:0] +@24 +TOP.FpxxDemo.core_add.exp_add_p4[7:0] +TOP.FpxxDemo.core_add.exp_add_adj_p4[7:0] +@c00022 +TOP.FpxxDemo.core_add.mant_add_p4[24:0] +@28 +(0)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(1)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(2)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(3)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(4)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(5)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(6)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(7)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(8)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(9)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(10)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(11)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(12)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(13)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(14)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(15)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(16)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(17)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(18)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(19)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(20)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(21)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(22)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(23)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +(24)TOP.FpxxDemo.core_add.mant_add_p4[24:0] +@1401200 +-group_end +@c00022 +TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +@28 +(0)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(1)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(2)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(3)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(4)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(5)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(6)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(7)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(8)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(9)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(10)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(11)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(12)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(13)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(14)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(15)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(16)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(17)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(18)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(19)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(20)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(21)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(22)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +(23)TOP.FpxxDemo.core_add.mant_add_adj_p4[23:0] +@1401200 +-group_end +@200 +- +- +@28 +TOP.FpxxDemo.core_add.io_result_vld +@22 +TOP.FpxxDemo.core_add.io_result_exp[7:0] +TOP.FpxxDemo.core_add.io_result_mant[22:0] +@28 +TOP.FpxxDemo.core_add.io_result_sign +[pattern_trace] 1 +[pattern_trace] 0 diff --git a/gtkw/src/lib.rs b/gtkw/src/lib.rs new file mode 100644 index 0000000..fe16861 --- /dev/null +++ b/gtkw/src/lib.rs @@ -0,0 +1,40 @@ +// Copyright 2024 The Regents of the University of California +// released under BSD 3-Clause License +// author: Kevin Laeufer + +pub enum Command { + Dumpfile(String), + DumpfileTime(String), + DumpfileSize(u64), + Savefile(String), + /// Start of the wave view. + TimeStart(u64), + /// GTKWave zoom factor. + ZoomFactor(f64), + /// Unfold in the hierarchy view. + TreeOpen(HierarchyPath), + /// Called trace flags in GTKWave. + SignalFlags(SignalFlags), + SignalShift(i64), + /// Add a signal to the viewport. + AddSignal(VarName), +} + +pub struct HierarchyPath(String); +pub struct VarName(String); +pub struct SignalFlags(); + +/// List of commands that we ignore because they are too GTKWave specific! +pub const IGNORED: &[&[u8]] = [ + // window size (x,y) + b"size", + // window position (x,y) + b"pos", + // the following specify the size of GTKWave UI panels + b"sst_width", + b"sst_expanded", + b"sst_vpaned_height", + b"signals_width", + // TODO: what does this do? + b"pattern_trace", +]; \ No newline at end of file