Diagram plugins and Konata integration #18
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Products/FastWave2.0#18
Loading…
Reference in a new issue
No description provided.
Delete branch "diagram_plugins_and_konata"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Diagram Connectors (Plugins)
Diagram Connectors are FastWave plugins providing interactivity to diagrams. They can both listen to diagram changes made by users and modify the diagram directly. Their main purpose is to connect signals / variables from VCD/FST files with the related diagrams. They are based on the same architecture like decoders - The WebAssembly Component Model. The Plugin and Host API is defined in WIT language and the plugins / diagram connectors can be written in any supported language - currently C/C++, C#, Go, Javascript, Python, Rust. However, we recommend to write plugins in Rust because the support and tooling, speed and size are the best.
In the demo below, the
wave.fst
file is loaded to get SV39 Memory Management Unit simulation data. Then a diagramcache_diagram.excalidraw
is loaded (the file contains a JSON-encoded diagram definition). This diagram is basically a dialog with text fields that can be modified by the user or the plugin in real-time. Then, the pluginrust_diagram_connector.wasm
is loaded through theJavascript commands
panel. The plugin automatically updatesAddress
andStatus
fields according to the value defined in theTime (ps)
field in the diagram after the plugin initialization and then on eachTime (ps)
value change.The Diagram Connector API can be easily extended according to the FastWave users feedback because bindings between plugins and FastWave is automatically generated from WIT files and the Rust compiler guarantees we cannot forget to implement additional host functions.
The demo:
A snippet from the
rust_diagram_connector.wasm
source code:Konata Integration
Konata is an instruction pipeline visualizer for Onikiri2-Kanata/Gem5-O3PipeView formats. It's a cross-platform app based on Electron. It didn't have an external API but the new API was implemented in the forked version. It's a REST API powered by Express: "Fast, unopinionated, minimalist web framework for Node.js". FastWave either connects to already running Konata process or starts the app by itself. Then it'll send a request to open the chosen file in a new Konata tab as demonstrated below. Konata is maintained since 2016, it's stable and thanks to Electron there is no problem to run it on any platform so we don't expect any merge conflicts in the future. Also the new API is easily extendable and we can prepare pre-built binaries to be downloaded automatically by FastWave later. And thanks to the FastWave Plugin architecture, users may write plugins to communicate with Konata through FastWave.
Konata integration demo - starting the app and then opening the second file in a new tab:
Note: In case you want to test the Konata bridge now (as demonstrated above), you can just clone the forked Konata version next to the FastWave repo and follow the steps in its README section Development.
@ -0,0 +4,4 @@
log: func(message: string);
listen-for-component-text-changes: func(diagram-connect-name: string, component-id: string);
set-component-text: func(component-id: string, text: string);
address-and-way: func(time-text: string) -> result<tuple<string, option<u32>>>;
Is the address-and-way function defined in excalidraw? If so, where?
I would assume that there is some javascript code somewhere that exports
address-and-way
for example?Local testing step by step:
rustup update stable
cargo install cargo-make
main
if the PR has been already merged.test_files/sv39_mmu_cache_sim.zip
tosv39_mmu_cache_sim
.makers install
makers start
Load file..
button and choosetest_files/sv39_mmu_cache_sim/fst/wave.fst
Open
and choosetest_files/cache_diagram.excalidraw
FW.add_diagram_connectors(["../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm"])
in theJavascript commands
panel. (The command is also written directly in the loaded diagram.)Time (ps)
field in the diagram and notice automatic changes in other fields.Konata
folder, put it next to the clonedFastWave2.0
folder.api
branch in theKonata
repo folder and pull latest changes.sudo npm -g install electron
sudo npm -g install electron-packager
make init
Open Konata file..
and selecttest_files/sv39_mmu_cache_sim/fst/konata.log
.konata.log
file.konata.log
again.Note A: When FastWave web-only version is implemented, then FastWave web app could open Konata app directly through custom protocol handlers (see Deep Links | Electron; e.g. Discord invitation links work the same way). Or we can initiate WebSocket connection from Konata app as a fallback solution. We can try to port / rewrite Konata later to integrate it directly into FastWave but I wouldn't recommended it until it's requested by multiple FastWave users and make it really sense.
Note B: Many steps will not be needed once both FastWave and updated Konata are released with their binaries and if we make possible to distribute wave data together with related diagrams and diagram connectors (in case users will need such feature).