[util] Remove wavegen
This tool was used by the old docgen approach and is not used anymore.
The Hugo documentation flow includes the wavejson and uses wavedrom
JavaScript for direct rendering.
Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org>
diff --git a/doc/rm/markdown_usage_style.md b/doc/rm/markdown_usage_style.md
index 39b3e49..f7cf8cb 100644
--- a/doc/rm/markdown_usage_style.md
+++ b/doc/rm/markdown_usage_style.md
@@ -78,15 +78,6 @@
Waveforms can be included by adding [wavejson](https://github.com/wavedrom/schema/blob/master/WaveJSON.md) code surrounded by `{{</* wavejson */>}}` shortcode tags.
-<!-- TODO: This comment isn't correct, the WaveDrom library being used hasn't been modified.
-There is a standalone tool for wavejson to svg conversion.
-Details of the tool and a full description of the wavejson syntax that is supported can be found in the [README](https://github.com/lowRISC/opentitan/tree/master/util/wavegen) for the `wavegen.py` tool.
-Note that there are several incomplete descriptions of wavejson, the syntax supported is derived primarily from the examples in the [WaveDrom Tutorial](https://observablehq.com/@drom/wavedrom).
-
-An online editor for wavejson can be found on the [WaveDrom](https://wavedrom.com/) website.
-The processor built in to `docgen` should produce the identical output, but has one extension that `cdata` may be used in place of `data` to allow labeling all bit positions not just the `2345` ones.
--->
-
### Text Format
Where possible, please restrict Markdown text to the ASCII character set to avoid downstream tool issues.
diff --git a/util/_index.md b/util/_index.md
index 6a8793b..2283b56 100644
--- a/util/_index.md
+++ b/util/_index.md
@@ -17,4 +17,3 @@
* `tlgen.py` utility for TileLink bus matrix [README]({{< relref "util/tlgen/README.md" >}})
* `uvmdvgen.py` utility for generating testbenches for comportable IP [README]({{< relref "util/uvmdvgen/README.md" >}})
* `fpvgen.py` utility for generating FPV testbenches for comportable IP [README]({{< relref "util/fpvgen/README.md" >}})
-* `wavegen.py` utility for creating technical waveforms in documentation [README]({{< relref "util/wavegen/README.md" >}})
diff --git a/util/diff_generated_util_output.py b/util/diff_generated_util_output.py
index c8f19df..aed5c42 100755
--- a/util/diff_generated_util_output.py
+++ b/util/diff_generated_util_output.py
@@ -37,8 +37,6 @@
"./docgen.py docgen/examples/uart16550.md > ", ""],
["regdoc.md", False,
"./regtool.py --doc > ", ""],
- ["wave.html", False,
- "./wavetool.py wavegen/examples/* > ", ""],
["uart_rtl", True,
"./regtool.py -r -t ", " ../hw/ip/uart/data/uart.hjson"],
["uart_dv", True,
diff --git a/util/wavegen/LICENSE.wavedrom b/util/wavegen/LICENSE.wavedrom
deleted file mode 100644
index cd49285..0000000
--- a/util/wavegen/LICENSE.wavedrom
+++ /dev/null
@@ -1,24 +0,0 @@
-This software is based on WaveDrom javascript. In particular the
-svg defs section and Bricks generation are substantial copies.
-
-The MIT License (MIT)
-
-Copyright (c) 2011-2018 Aliaksei Chapyzhenka
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/util/wavegen/README.md b/util/wavegen/README.md
deleted file mode 100644
index 1d6057c..0000000
--- a/util/wavegen/README.md
+++ /dev/null
@@ -1,215 +0,0 @@
-# Wavegen -- Waveform generator in Python
-
-Wavegen is a Python tool to read waveform descriptions in Hjson and
-generate `svg` pictures of the waveform.
-
-The source is a JSON representation of the waveform using the wavejson
-format defined for Wavedrom. This is sort of described at
-[here](https://github.com/drom/wavedrom/wiki/WaveJSON)
-
-Note that the same wavejson could be embedded in a webpage and
-wavedrom javascript used to render it directly in the browser. An
-online editor for wavejson can be found at [https://wavedrom.com/](https://wavedrom.com/)
-
-The example commands assume `$REPO_TOP` is set to the toplevel directory
-of the repo.
-
-### Setup
-
-If packages have not previously been installed you will need to set a
-few things up. First use `pip3` to install some required packages:
-```console
-$ pip3 install --user hjson
-```
-
-### Examples using standalone wavetool
-
-Normally for documentation the `docgen` tool will automatically use
-wavegen when it encounters a code block labeled for wavejson. See the
-examples in the `docgen` module README.
-
-The wavetool provides a standalone way to run wavegen.
-
-The basic test mode can be invoked with `-T`. In this case a builtin
-wavejson string is used as the source and is instantiated twice (it
-should look the same but the second svg will not include the defines
-that can be accessed by id from the first).
-
-```console
-$ cd $REPO_TOP/util
-$ ./wavetool.py -T > /tmp/out.html
-```
-
-The examples directory contains the example wavejson from the
-[Tutorial](https://wavedrom.com/tutorial.html). These can be formed in
-to a webpage to allow comparison with the tutorial output.
-
-```console
-$ cd $REPO_TOP/util
-$ ./wavetool.py -v wavegen/examples/* > /tmp/out.html
-```
-
-## WaveJSON format and extension
-
-The tool includes an extension to the wavejson format. In addition to
-data: being used to label fields that are of type '=2345' the
-alternative cdata can be used to label all active data cycles
-'01=2345ud' (for example this allows the start and stop bits to be
-labeled for the uart in the -T test).
-
-
-### The signal object
-
-The main object in the WaveJSON is the 'signal'. This consists of a
-list of signal values or groups.
-
-```hjson
-{ "signal" : [
- value1,
- value2,
- ...
-]}
-```
-The value is either:
-
-* A group. This is a list with the group name as a string as the first
- element, and values for the other elements. `[ "Group name", {
- value1 }, { value2 }]` Groups may be nested, the code allows for
- three deep nesting without the name area being made larger.
-
-* A gap. This element with no waveform generates a gap. `{}` There may
- be a `node:` element in a gap to add markers and allow labeling of
- cycles (see examples).
-
-* A real signal! This is a comma separated list of key/value pairs:
- * `name:` the name that the signal will be labeled with
- * `wave:` a string describing the waveform using characters listed below.
- * `data:` an array of comma separated labels (or a string of space
- separated lables). The labels will be added to any of the value
- types (see below) in the waveform, four or five characters is the
- maximum that will fit for `hscale=1`, `period=1`.
- * `cdata:` **Extension to wavedrom** an array of comma separated
- labels (or a string of space separated lables). The labels will be
- added to any of the cycle types (see below) in the waveform, four
- or five characters is the maximum that will fit for hscale=1,
- period=1.
- * `period:` A positive integer that specifies the period for this signal
- * `phase:` A half-integer (integer or integer.5) specifing the phase
- shift of the signal. Positive values cause the start of the wave
- field to be discarded. Typically 0.5 to shift things back a
- half-cycle which causes the first half of the first character in
- wave to be skipped in the drawing.
- * `node:` A string specifying where timing markers should be
- placed. The string mirrors the wave string. If the node string
- contains a `.` then no marker is inserted. If it contains a
- lower-case letter then a marker with that name will be inserted
- and the letter shown on the waveform. If it contains an upper-case
- letter then a marker will be inserted but no letter shown in the
- waveform. The markers are used to add arrows in the edge
- directive.
-
-Other than signal the top-level keys are:
-
-* `config:` A list of key/value pairs the only one used is hscale
- which is an integer that sets the horizontal scale (1= normal,
- 2=twice width etc). `config: { hscale: 2 }` **Note: skins in the
- config are not currently implemented.**
-
-* `head:` Details of the header. This contains:
- * `text:` the string to put in the header. May also be a list with
- first element 'tspan' to add attributes/formatiing. The tspan list
- can be a three element list where the second item in `{` to `}` is
- a comma separated list of key:value pairs that will become
- `key="value"` arguments of the svg tspan and the third item is
- another string/tspan. Or the tspan list is a list of string/tspan.
- * `tick:` integer, optional. Add cycle labels and lines on rising
- egdes. The first edge is numbered with the integer given and
- subsequent edges with incrementing integers.
- * `tock:` integer, optional. Add cycle labels and lines on falling
- egdes. The first edge is numbered with the integer given and
- subsequent edges with incrementing integers.
-
-* `tail:` As head but text and labels go below
-
-* `edge:` An array of strings containing details of edge arrows to be
- drawn on the waveforms.
-
-
-### wave characters
-
-Characters in the wave= element describe the waveform. There are more
-in the wavedrom tutorial than in the WaveJSON description. Listing the
-supported ones here.
-
-These generate a sharp square wave edge into the new state.
-
-- `p` - (usually first in string) creates a cycle of a positive edged clock
-- `n` - (usually first in string) creates a cycle of a negative edged clock
-- `P` - same as p but with arrow
-- `N` - same as n but with arrow
-- `l` - low level
-- `h` - high level
-- `L` - low level with an arrow
-- `H` - high level with an arrow
-
-These generate a soft edge into the state. The data: list can be used
-to labal any of the ones marked "value". Extending WaveJSON the cdata:
-list can be used to label any of these. Note that a label will be
-centered on the cycle and subsequent '.' extensions.
-
-- `0` - low level
-- `1` - high level
-- `=` - value (default color 2)
-- `2` - value with color 2
-- `3` - value with color 3
-- `4` - value with color 4
-- `5` - value with color 5
-- `x` - undefined value (crosshatch)
-- `z` - high-impedance state
-- `u` - pull-up (weak 1)
-- `d` - pull-down (weak 0)
-
-These generate extensions of the previous cycle:
-- `.` - extends previous cycle
-- `|` - extends previous cycle and draw discontinuity gap on top of it
-
-### edge arrows
-
-Each element in the `edge:` array is a single string that describes
-an arrow or line and the label that is associated with the arrow/line.
-
-```hjson
-{ ...
- "edge" : ["a->b edge 1", "b-~>c My Second Edge"]
-}
-```
-
-The string may contain multiple words separated by spaces. The first
-word defines the from and to points and the arrow shape. The rest of
-the text (after first space gap) will be placed as the label on the
-line. The first and last characters in the arrow text select the
-markers (defined in a node string) used as the endpoints for a line
-(if these are upper case letters then no text is shown for the marker
-but the line will be drawn to the corresponding point). The central
-characters define the line shape. If the first shape character is a
-`<` an arrowhead is inserted pointing to the start marker. If the last
-character in the shape is a `>` an arrowhead is inserted pointing to
-the end marker. (Note the original wavedrom may not support only
-having an arrow to the start marker.) The remaining characters define
-the arrow to be used:
-
-* `-` a straight line between the markers, label centered on line
-* `~ ` a curved line between the markers, label centered on line
-* `-~` a curved line between the markers biased to end, label closer
- to end marker
-* `~-` a curved line between the markers biased to start, label closer
- to start marker
-* `-|` a straight line horizontally from the start then vertically to
- end, label closer to the end
-* `|-` a straight line vertically from the start then horizontally to
- end, label closer to the start
-* `-|-` a straight line horizontally from the start to the horizontal
- mid-point, then vertically, then horizontal to the end, label
- centered
-
-See examples for how the different sorts of arrows actually look.
diff --git a/util/wavegen/__init__.py b/util/wavegen/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/util/wavegen/__init__.py
+++ /dev/null
diff --git a/util/wavegen/examples/step2 b/util/wavegen/examples/step2
deleted file mode 100644
index ae67c7e..0000000
--- a/util/wavegen/examples/step2
+++ /dev/null
@@ -1,12 +0,0 @@
-{ signal: [
- { name: "pclk", wave: 'p.......' },
- { name: "Pclk", wave: 'P.......' },
- { name: "nclk", wave: 'n.......' },
- { name: "Nclk", wave: 'N.......' },
- {},
- { name: 'clk0', wave: 'phnlPHNL' },
- { name: 'clk1', wave: 'xhlhLHl.' },
- { name: 'clk2', wave: 'hpHplnLn' },
- { name: 'clk3', wave: 'nhNhplPl' },
- { name: 'clk4', wave: 'xlh.L.Hx' },
-]}
diff --git a/util/wavegen/examples/step3 b/util/wavegen/examples/step3
deleted file mode 100644
index ac5b4ed..0000000
--- a/util/wavegen/examples/step3
+++ /dev/null
@@ -1,5 +0,0 @@
-{ signal: [
- { name: "clk", wave: "P......" },
- { name: "bus", wave: "x.==.=x", data: ["head", "body", "tail", "data"] },
- { name: "wire", wave: "0.1..0." }
-]}
diff --git a/util/wavegen/examples/step4 b/util/wavegen/examples/step4
deleted file mode 100644
index 8bac595..0000000
--- a/util/wavegen/examples/step4
+++ /dev/null
@@ -1,7 +0,0 @@
-{ signal: [
- { name: "clk", wave: "p.....|..." },
- { name: "Data", wave: "x.345x|=.x", data: ["head", "body", "tail", "data"] },
- { name: "Request", wave: "0.1..0|1.0" },
- {},
- { name: "Acknowledge", wave: "1.....|01." }
-]}
diff --git a/util/wavegen/examples/step5 b/util/wavegen/examples/step5
deleted file mode 100644
index 8ea7d82..0000000
--- a/util/wavegen/examples/step5
+++ /dev/null
@@ -1,18 +0,0 @@
-{ signal: [
- { name: 'clk', wave: 'p..Pp..P'},
- ['Master',
- ['ctrl',
- {name: 'write', wave: '01.0....'},
- {name: 'read', wave: '0...1..0'}
- ],
- { name: 'addr', wave: 'x3.x4..x', data: 'A1 A2'},
- { name: 'wdata', wave: 'x3.x....', data: 'D1' },
- ],
- {},
- ['Slave',
- ['ctrl',
- {name: 'ack', wave: 'x01x0.1x'},
- ],
- { name: 'rdata', wave: 'x.....4x', data: 'Q2'},
- ]
-]}
diff --git a/util/wavegen/examples/step6 b/util/wavegen/examples/step6
deleted file mode 100644
index c2e8b5e..0000000
--- a/util/wavegen/examples/step6
+++ /dev/null
@@ -1,7 +0,0 @@
-{ signal: [
- { name: "CK", wave: "P.......", period: 2 },
- { name: "CMD", wave: "x.3x=x4x=x=x=x=x", data: "RAS NOP CAS NOP NOP NOP NOP", phase: 0.5 },
- { name: "ADDR", wave: "x.=x..=x........", data: "ROW COL", phase: 0.5 },
- { name: "DQS", wave: "z.......0.1010z." },
- { name: "DQ", wave: "z.........5555z.", data: "D0 D1 D2 D3" }
-]}
diff --git a/util/wavegen/examples/step7 b/util/wavegen/examples/step7
deleted file mode 100644
index 0b124b6..0000000
--- a/util/wavegen/examples/step7
+++ /dev/null
@@ -1,7 +0,0 @@
-{ signal: [
- { name: "clk", wave: "p...." },
- { name: "Data", wave: "x345x", data: ["head", "body", "tail"] },
- { name: "Request", wave: "01..0" }
- ],
- config: { hscale: 1 }
-}
diff --git a/util/wavegen/examples/step7a b/util/wavegen/examples/step7a
deleted file mode 100644
index 6cf7de9..0000000
--- a/util/wavegen/examples/step7a
+++ /dev/null
@@ -1,7 +0,0 @@
-{ signal: [
- { name: "clk", wave: "p...." },
- { name: "Data", wave: "x345x", data: ["head", "body", "tail"] },
- { name: "Request", wave: "01..0" }
- ],
- config: { hscale: 2 }
-}
diff --git a/util/wavegen/examples/step7b b/util/wavegen/examples/step7b
deleted file mode 100644
index 3404cce..0000000
--- a/util/wavegen/examples/step7b
+++ /dev/null
@@ -1,7 +0,0 @@
-{ signal: [
- { name: "clk", wave: "p...." },
- { name: "Data", wave: "x345x", data: ["head", "body", "tail"] },
- { name: "Request", wave: "01..0" }
- ],
- config: { hscale: 3 }
-}
diff --git a/util/wavegen/examples/step7c b/util/wavegen/examples/step7c
deleted file mode 100644
index 11e3a18..0000000
--- a/util/wavegen/examples/step7c
+++ /dev/null
@@ -1,14 +0,0 @@
-{signal: [
- {name:'clk', wave: 'p....' },
- {name:'Data', wave: 'x345x', data: 'a b c' },
- {name:'Request', wave: '01..0' }
-],
- head:{
- text:'WaveDrom example',
- tick:0,
- },
- foot:{
- text:'Figure 100',
- tock:9
- },
-}
diff --git a/util/wavegen/examples/step7d b/util/wavegen/examples/step7d
deleted file mode 100644
index 6816eaa..0000000
--- a/util/wavegen/examples/step7d
+++ /dev/null
@@ -1,29 +0,0 @@
-{signal: [
- {name:'clk', wave: 'p.....PPPPp....' },
- {name:'dat', wave: 'x....2345x.....', data: 'a b c d' },
- {name:'req', wave: '0....1...0.....' }
-],
-head: {text:
- ['tspan',
- ['tspan', {class:'error h1'}, 'error '],
- ['tspan', {class:'warning h2'}, 'warning '],
- ['tspan', {class:'info h3'}, 'info '],
- ['tspan', {class:'success h4'}, 'success '],
- ['tspan', {class:'muted h5'}, 'muted '],
- ['tspan', {class:'h6'}, 'h6 '],
- 'default ',
- ['tspan', {fill:'pink', 'font-weight':'bold', 'font-style':'italic'}, 'pink-bold-italic']
- ]
-},
-foot: {text:
- ['tspan', 'E=mc',
- ['tspan', {dy:'-5'}, '2'],
- ['tspan', {dy: '5'}, '. '],
- ['tspan', {'font-size':'25'}, 'B '],
- ['tspan', {'text-decoration':'overline'},'over '],
- ['tspan', {'text-decoration':'underline'},'under '],
- ['tspan', {'baseline-shift':'sub'}, 'sub '],
- ['tspan', {'baseline-shift':'super'}, 'super ']
- ],tock:-5
-}
-}
diff --git a/util/wavegen/examples/step8 b/util/wavegen/examples/step8
deleted file mode 100644
index 176f8ca..0000000
--- a/util/wavegen/examples/step8
+++ /dev/null
@@ -1,12 +0,0 @@
-{ signal: [
- { name: 'A', wave: '01........0....', node: '.a........j' },
- { name: 'B', wave: '0.1.......0.1..', node: '..b.......i' },
- { name: 'C', wave: '0..1....0...1..', node: '...c....h..' },
- { name: 'D', wave: '0...1..0.....1.', node: '....d..g...' },
- { name: 'E', wave: '0....10.......1', node: '.....ef....' }
- ],
- edge: [
- 'a~b t1', 'c-~a t2', 'c-~>d time 3', 'd~-e',
- 'e~>f', 'f->g', 'g-~>h', 'h~>i some text', 'h~->j'
- ]
-}
diff --git a/util/wavegen/examples/step8-Bforb b/util/wavegen/examples/step8-Bforb
deleted file mode 100644
index a7ffcc8..0000000
--- a/util/wavegen/examples/step8-Bforb
+++ /dev/null
@@ -1,12 +0,0 @@
-{ signal: [
- { name: 'A', wave: '01........0....', node: '.a........j' },
- { name: 'B', wave: '0.1.......0.1..', node: '..B.......i' },
- { name: 'C', wave: '0..1....0...1..', node: '...c....h..' },
- { name: 'D', wave: '0...1..0.....1.', node: '....d..g...' },
- { name: 'E', wave: '0....10.......1', node: '.....ef....' }
- ],
- edge: [
- 'a~B t1', 'c-~a t2', 'c-~>d time 3', 'd~-e',
- 'e~>f', 'f->g', 'g-~>h', 'h~>i some text', 'h~->j'
- ]
-}
diff --git a/util/wavegen/examples/step8a b/util/wavegen/examples/step8a
deleted file mode 100644
index 2d0972b..0000000
--- a/util/wavegen/examples/step8a
+++ /dev/null
@@ -1,11 +0,0 @@
-{ signal: [
- { name: 'A', wave: '01..0..', node: '.a..e..' },
- { name: 'B', wave: '0.1..0.', node: '..b..d.', phase:0.5 },
- { name: 'C', wave: '0..1..0', node: '...c..f' },
- { node: '...g..h' }
- ],
- edge: [
- 'b-|a t1', 'a-|c t2', 'b-|-c t3', 'c-|->e t4', 'e-|>f more text',
- 'e|->d t6', 'c-g', 'f-h', 'g<->h 3 ms'
- ]
-}
diff --git a/util/wavegen/examples/tickbug b/util/wavegen/examples/tickbug
deleted file mode 100644
index 7de3a68..0000000
--- a/util/wavegen/examples/tickbug
+++ /dev/null
@@ -1,14 +0,0 @@
-{ signal: [
- { name: 'CSB', wave: '10.........|....1.'},
- { name: 'SCK', wave: '0.p........|....l.'},
- { name: 'MOSI', wave: 'z.=..=.=.=.=.=.=.=.=.=|=.=.=.=.z....',
- data:['R07','R06','R05','R04','R03','R02','R01','R00','R17',
- 'R74','R73','R72','R71','R70'], period:0.5, },
- { name: 'MISO', wave: 'z...=.=.=.=.=.=.=.=.=.=|=.=.=.=.z...',
- data:['T07','T06','T05','T04','T03','T02','T01','T00','T17',
- 'T74','T73','T72','T71','T70'], period:0.5}],
- head:{
- text: 'Data Transfer',
- tick: ['-2 -1 0 1 2 3 4 5 6 7 8 9 60 61 62 63 ']
- }
-}
diff --git a/util/wavegen/examples/tickbug2 b/util/wavegen/examples/tickbug2
deleted file mode 100644
index 9240927..0000000
--- a/util/wavegen/examples/tickbug2
+++ /dev/null
@@ -1,27 +0,0 @@
-{ signal: [
- { name: 'CSB', wave: '10.........|....1.'},
- { name: 'SCK', wave: '0.p........|....l.'},
- { name: 'MOSI', wave: 'z.=..=.=.=.=.=.=.=.=.=|=.=.=.=.z....',
- data:['R07','R06','R05','R04','R03','R02','R01','R00','R17',
- 'R74','R73','R72','R71','R70'], period:0.5, },
- { name: 'MISO', wave: 'z.=========|====z..',
- data:['T07','T06','T05','T04','T03','T02','T01','T00','T17',
- 'T73','T72','T71','T70'] },
- { name: 'MIS0.5', wave: 'z...=.=.=.=.=.=.=.=.=.=|=.=.=.=.z..',
- data:['T07','T06','T05','T04','T03','T02','T01','T00','T17',
- '','T73','T72','T71','T70'], period:0.5 },
- { name: 'MIS1', wave: 'z...=.=.=.=.=.=.=.=.=.=|=.=.=.=.z...',
- data:['T07','T06','T05','T04','T03','T02','T01','T00','T17',
- 'T74','T73','T72','T71','T70'] },
- { name: 'MIS1.5', wave: 'z...=.=.=.=.=.=.=.=.=.=|=.=.=.=.z...',
- data:['T07','T06','T05','T04','T03','T02','T01','T00','T17',
- 'T74','T73','T72','T71','T70'], period:1.5 }],
- head:{
- text: 'Data Transfer',
- tick: ['-2', '-1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '60', '61', '62', '63']
- }
- foot:{
- text: "text here"
- tock: '-2 -1 0 1 2 3 4 5 6 7 8 9 60 61 62 63 '
- }
-}
diff --git a/util/wavegen/wavesvg.py b/util/wavegen/wavesvg.py
deleted file mode 100644
index 060d5fb..0000000
--- a/util/wavegen/wavesvg.py
+++ /dev/null
@@ -1,761 +0,0 @@
-# Copyright lowRISC contributors.
-# Licensed under the Apache License, Version 2.0, see LICENSE for details.
-# SPDX-License-Identifier: Apache-2.0
-
-# portions adapted from the javascript wavedrom.js
-# https://github.com/drom/wavedrom/blob/master/wavedrom.js
-# see LICENSE.wavedrom
-
-import io
-import logging as log
-
-from wavegen import wavesvg_data
-
-# Generate brick: follows wavedrom.js
-
-
-def gen_brick(texts, extra, times):
- res = []
-
- # length of four indicates 2 phases each with 2 bricks
- if (len(texts) == 4):
- if extra != int(extra):
- log.error("Clock must have an integer period")
- for j in range(times):
- res.append(texts[0])
- for i in range(int(extra)):
- res.append(texts[1])
- res.append(texts[2])
- for i in range(int(extra)):
- res.append(texts[3])
- return res
-
- if (len(texts) == 1):
- t1 = texts[0]
- else:
- t1 = texts[1]
-
- res.append(texts[0])
- for i in range(times * int(2 * (extra + 1)) - 1):
- res.append(t1)
- return res
-
-
-# Generate first brick in a line: follows wavedrom.js
-def gen_first_wavebrick(text, extra, times):
-
- gentext = {
- 'p': ['pclk', '111', 'nclk', '000'],
- 'n': ['nclk', '000', 'pclk', '111'],
- 'P': ['Pclk', '111', 'nclk', '000'],
- 'N': ['Nclk', '000', 'pclk', '111'],
- 'l': ['000'],
- 'L': ['000'],
- '0': ['000'],
- 'h': ['111'],
- 'H': ['111'],
- '1': ['111'],
- '=': ['vvv-2'],
- '2': ['vvv-2'],
- '3': ['vvv-3'],
- '4': ['vvv-4'],
- '5': ['vvv-5'],
- 'd': ['ddd'],
- 'u': ['uuu'],
- 'z': ['zzz']
- }
- return gen_brick(gentext.get(text, ['xxx']), extra, times)
-
-
-# Generate subsequent bricks: text contains before and after states
-# Follows wavedrom
-def gen_wavebrick(text, extra, times):
-
- # new states that have a hard edge going in to them
- new_hardedges = {
- 'p': 'pclk',
- 'n': 'nclk',
- 'P': 'Pclk',
- 'N': 'Nclk',
- 'h': 'pclk',
- 'l': 'nclk',
- 'H': 'Pclk',
- 'L': 'Nclk'
- }
-
- # new state with a soft edge
- new_softedges = {
- '0': '0',
- '1': '1',
- 'x': 'x',
- 'd': 'd',
- 'u': 'u',
- 'z': 'z',
- '=': 'v',
- '2': 'v',
- '3': 'v',
- '4': 'v',
- '5': 'v'
- }
-
- # state we are coming from
- old_edges = {
- 'p': '0',
- 'n': '1',
- 'P': '0',
- 'N': '1',
- 'h': '1',
- 'l': '0',
- 'H': '1',
- 'L': '0',
- '0': '0',
- '1': '1',
- 'x': 'x',
- 'd': 'd',
- 'u': 'u',
- 'z': 'z',
- '=': 'v',
- '2': 'v',
- '3': 'v',
- '4': 'v',
- '5': 'v'
- }
-
- # tags (basically the colour) -- js had two arrays for this
- tags = {
- 'p': '',
- 'n': '',
- 'P': '',
- 'N': '',
- 'h': '',
- 'l': '',
- 'H': '',
- 'L': '',
- '0': '',
- '1': '',
- 'x': '',
- 'd': '',
- 'u': '',
- 'z': '',
- '=': '-2',
- '2': '-2',
- '3': '-3',
- '4': '-4',
- '5': '-5'
- }
-
- # drawing for the second half of the new state
- new_secondbricks = {
- 'p': '111',
- 'n': '000',
- 'P': '111',
- 'N': '000',
- 'h': '111',
- 'l': '000',
- 'H': '111',
- 'L': '000',
- '0': '000',
- '1': '111',
- 'x': 'xxx',
- 'd': 'ddd',
- 'u': 'uuu',
- 'z': 'zzz',
- '=': 'vvv-2',
- '2': 'vvv-2',
- '3': 'vvv-3',
- '4': 'vvv-4',
- '5': 'vvv-5'
- }
-
- phase2_firstbricks = {'p': 'nclk', 'n': 'pclk', 'P': 'nclk', 'N': 'pclk'}
-
- phase2_secondbricks = {'p': '000', 'n': '111', 'P': '000', 'N': '111'}
-
- xclude = {
- 'hp': '111',
- 'Hp': '111',
- 'ln': '000',
- 'Ln': '000',
- 'nh': '111',
- 'Nh': '111',
- 'pl': '000',
- 'Pl': '000'
- }
-
- secondbrick = new_secondbricks.get(text[1])
- hardbrick = new_hardedges.get(text[1])
- if hardbrick == None:
- # a soft edge gets the brick type constructed from the
- # old state, m, new state. Old and new states may have
- # tags which basically represent the colour
- newch = new_softedges.get(text[1])
- oldch = old_edges.get(text[0])
- if newch == None or oldch == None:
- # unknown: can't find the characters to make an edge
- return gen_brick(['xxx'], extra, times)
- else:
- # soft curves
- return gen_brick([
- oldch + 'm' + newch + tags[text[0]] + tags[text[1]],
- secondbrick
- ], extra, times)
- else:
- specialcase = xclude.get(text)
- if specialcase != None:
- hardbrick = specialcase
-
- # sharp curves
- twophase = phase2_firstbricks.get(text[1])
- if twophase == None:
- # hlHL
- return gen_brick([hardbrick, secondbrick], extra, times)
- else:
- # pnPN
- return gen_brick([
- hardbrick, secondbrick, twophase,
- phase2_secondbricks.get(text[1])
- ], extra, times)
-
-
-# text is the wave member of the signal object
-# extra = hscale-1 ( padding )
-
-
-def parse_wavelane(text, extra):
- res = []
- pos = 1
- tlen = len(text)
- subCycle = False
- if tlen == 0:
- return res;
- next = text[0]
-
- repeats = 1
- while pos < tlen and (text[pos] == '.' or text[pos] == '|'):
- pos += 1
- repeats += 1
-
- res = gen_first_wavebrick(next, extra, repeats)
-
- while pos < tlen:
- top = next
- next = text[pos]
- pos += 1
- if next == '<': # sub-cycles on
- subCycle = True
- next = text[pos]
- pos += 1
-
- if next == '>': # sub-cycles off
- subCycle = False
- next = text[pos]
- pos += 1
-
- repeats = 1
- while pos < tlen and (text[pos] == '.' or text[pos] == '|'):
- pos += 1
- repeats += 1
- if subCycle:
- res.extend(gen_wavebrick(top + next, 0, repeats - lane.period))
- else:
- res.extend(gen_wavebrick(top + next, extra, repeats))
-
- # res is array of half brick types, each is item is string
- return res
-
-
-def render_svghead(out, width, height, bricksused, svgn):
- out.write(' <svg id="svgcontent_' + str(svgn) + '"\n')
- out.write(wavesvg_data.head1)
- out.write('height="' + str(height) + '" width="' + str(width) + '"\n')
- out.write('viewBox="0 0 ' + str(width) + ' ' + str(height) + '">\n')
- out.write(wavesvg_data.head2)
- if len(bricksused) > 0:
- out.write(wavesvg_data.defs_head)
- for br in bricksused:
- out.write(wavesvg_data.use_defs[br])
- out.write(wavesvg_data.defs_tail)
-
-
-def render_svgtail(out):
- out.write(wavesvg_data.tail)
-
-
-def render_lanes_head(out, xoffset, yoffset, svgn):
- out.write(' <g id="lanes_' + str(svgn) + '" transform="translate(' +
- str(xoffset) + ', ' + str(yoffset) + ')">\n')
-
-
-def render_events(out, svgn, events, edges):
- out.write(' <g id="wavearcs_' + str(svgn) + '">\n')
- for edge in edges:
- sp_edge = edge.split(None, 1)
- log.info("Edge " + str(edge) + " splits " + str(sp_edge))
- ev_from = events.get(sp_edge[0][0])
- ev_to = events.get(sp_edge[0][-1])
- shape = sp_edge[0][1:-1]
- if (len(sp_edge) > 1):
- label = sp_edge[1]
- else:
- label = ''
-
- if ev_from == None or ev_to == None or len(shape) < 1:
- log.warn("Could not find events for " + sp_edge[0])
- continue
-
- dx = ev_to[0] - ev_from[0]
- dy = ev_to[1] - ev_from[1]
- # lx,ly is the center of the label, it may be adjusted
- lx = (ev_to[0] + ev_from[0]) // 2
- ly = (ev_to[1] + ev_from[1]) // 2
-
- if shape[0] == '<' and shape[-1] == '>':
- path_s = 'marker-end:url(#arrowhead);' \
- 'marker-start:url(#arrowtail);stroke:#0041c4;' \
- 'stroke-width:1;fill:none'
- shape = shape[1:-1]
- elif shape[-1] == '>':
- path_s = 'marker-end:url(#arrowhead);stroke:#0041c4;' \
- 'stroke-width:1;fill:none'
- shape = shape[:-1]
- elif shape[0] == '<':
- path_s = 'marker-start:url(#arrowtail);stroke:#0041c4;' \
- 'stroke-width:1;fill:none'
- shape = shape[1:]
- else:
- path_s = 'fill:none;stroke:#00F;stroke-width:1'
-
- # SVG uses the case to indicate abs or relative
- path_type = 'M'
- # always start at the from point
- path_d = ' ' + str(ev_from)[1:-1]
-
- if shape == '~':
- path_d += (' c ' + str(0.7 * dx) + ', 0 ' + str(0.3 * dx) + ', ' +
- str(dy) + ' ' + str(dx) + ', ' + str(dy))
- elif shape == '-~':
- path_d += (' c ' + str(0.7 * dx) + ', 0 ' + str(dx) + ', ' +
- str(dy) + ' ' + str(dx) + ', ' + str(dy))
- lx = ev_from[0] + dx * 0.75
- elif shape == '~-':
- path_d += (' c 0, 0 ' + str(0.3 * dx) + ', ' + str(dy) + ' ' +
- str(dx) + ', ' + str(dy))
- lx = ev_from[0] + dx * 0.25
- elif shape == '-|':
- path_d += ' ' + str(dx) + ',0 0,' + str(dy)
- path_type = 'm'
- lx = ev_to[0]
- elif shape == '|-':
- path_d += ' 0,' + str(dy) + ' ' + str(dx) + ',0'
- path_type = 'm'
- lx = ev_from[0]
- elif shape == '-|-':
- path_d += (' ' + str(dx / 2) + ',0 0,' + str(dy) + ' ' + str(
- dx / 2) + ',0')
- path_type = 'm'
- else: # catch - here (and anything else)
- path_d += ' ' + str(ev_to)[1:-1]
-
- out.write(' <path id="gmark_' + sp_edge[0][0] + '_' +
- sp_edge[0][-1] + '" d="' + path_type + path_d + '" style="' +
- path_s + '"></path>\n')
- if len(label) != 0:
- out.write(' <rect height="9" '
- 'style="fill: rgb(255, 255, 255);" '
- 'width="' + str(5 * len(label)) + '" '
- 'x="' + str(lx - 2.5 * len(label)) + '" '
- 'y="' + str(ly - 8) + '"></rect>\n')
- out.write(' <text style="font-size: 10px;" '
- 'text-anchor="middle" xml:space="preserve" '
- 'x="' + str(lx) + '" y="' + str(ly) + '">'
- '<tspan>' + label + '</tspan></text>\n')
-
- # Do events last so they are on top
- for e in events:
- log.info("Event " + e)
- if e.islower():
- (evx, evy) = events[e]
- # rectangles are taller than in js because it looks better to me
- out.write(' <rect y="' + str(evy - 8) + '" height="12" '
- 'x="' + str(evx - 3) + '" width="6" '
- 'style="fill: rgb(255, 255, 255);"></rect>\n')
- out.write(' <text style="font-size: 8px;" '
- 'x="' + str(evx) + '" y="' + str(evy) + '" '
- 'text-anchor="middle">' + e + '</text>\n')
- out.write(' </g>\n')
-
-
-def render_wavelanes(out, xscale, yscale, lanes, svgn, events):
- lnum = 0
- x_edgeoff = 6
- for lane in lanes:
- phase = lane[5]
-
- out.write(' <g id="wavelane_' + str(svgn) + '_' + str(lnum) + '"'
- ' transform="translate(0,' + str(lnum * yscale + 5) +
- ')">\n')
- if len(lane[0]) != 0:
- out.write(' <text x="-15" y="15" class="info" '
- 'text-anchor="end" xml:space="preserve">'
- '<tspan>' + lane[0] + '</tspan></text>\n')
- out.write(' <g id="wavelane_draw_' + str(svgn) + '_' +
- str(lnum) + '" '
- 'transform="translate(0,0)">\n')
- if phase < 0:
- bnum = abs(phase)
- lstart = 0
- else:
- bnum = 0
- lstart = phase
-
- for x in lane[1][lstart:]:
- out.write(' <use xlink:href="#' + x + '" '
- 'transform="translate(' + str(bnum * xscale) +
- ')"></use>\n')
- bnum += 1
- dpos = 0
- dend = len(lane[3])
- period = lane[4]
- if phase < 0:
- i = 0
- else:
- # start point ensures bnum below is never less than -1
- i = phase // 2
-
- if dend > 0 and lane[3][-1] == '!cdata!':
- lane[3].pop()
- dend -= 1;
- labelif = '01=2345ud'
- else:
- labelif = '=2345'
-
- scan_max = max(len(lane[2]), len(lane[6]))
- while (i < scan_max):
- bnum = i * 2 - phase
-
- if (i < len(lane[2])):
- x = lane[2][i]
- if dpos < dend and x in labelif:
- nslot = 1
- while (i + nslot) < len(
- lane[2]) and lane[2][i + nslot] == '.':
- nslot += 1
- xcenter = period * xscale * nslot + bnum * period * xscale
- # the center needs to be offset by the width of the
- # edge because that lives in the first brick
- xcenter += x_edgeoff
- out.write(' <text x="' + str(xcenter))
- out.write('" y="' + str(yscale / 2) + '" '
- 'text-anchor="middle" xml:space="preserve">')
- tspan_or_text(out, lane[3][dpos], True)
- out.write('</text>')
- dpos = dpos + 1
- if x == '|':
- # render a gap (this diverges from how the js does it
- # where it is in a different g
- out.write(' <use xlink:href="#gap" transform="'
- 'translate(' +
- str(period * (bnum * xscale + xscale)) + ')"'
- '></use>\n')
-
- if i < len(lane[6]):
- ev = lane[6][i]
- if ev != '.':
- events[ev] = (period * bnum * xscale + x_edgeoff,
- lnum * yscale + 2 + yscale // 2)
- i += 1
-
- out.write(' </g>\n </g>\n')
- lnum += 1
-
-
-def render_marks(out, nbricks, xscale, ylen, svgn):
- out.write(' <g id="gmarks_' + str(svgn) + '">\n')
- mnum = 0
- for i in range(nbricks // 2):
- out.write(' <path id="gmark_' + str(svgn) + '_' + str(mnum) +
- '" '
- 'd="m ' + str(i * 2 * xscale) + ',0 0,' + str(ylen) + '" '
- 'style="stroke: rgb(136, 136, 136); '
- 'stroke-width:0.5; stroke-dasharray:1,3"'
- '></path>\n')
- mnum += 1
- out.write(' </g>\n')
-
-
-def tspan_or_text(out, text, outerspan):
- if isinstance(text, str):
- if outerspan: out.write('<tspan>')
- out.write(text)
- if (outerspan): out.write('</tspan>')
- else:
- if text[0] != 'tspan':
- log.warn('Expecting tspan, got ' + str(text[0]))
- return
- if len(text) == 3 and isinstance(text[1], dict):
- out.write('<tspan ')
- for x in text[1]:
- out.write(x + '="' + text[1][x] + '" ')
- out.write('>')
- tspan_or_text(out, text[2], False)
- else:
- out.write('<tspan>')
- for x in text[1:]:
- tspan_or_text(out, x, False)
- out.write('</tspan>')
-
-
-def render_caption(out, text, nbricks, xscale, yoffset):
- out.write(' <text x="' + str(nbricks * xscale // 2) + '" '
- 'y="' + str(yoffset) + '" '
- ' text-anchor="middle" fill="#000" xml:space="preserve">')
- tspan_or_text(out, text, True)
- out.write('</text>\n')
-
-
-def render_ticktock(out, info, xoff, xsep, yoff, num):
- # info could be a number/string representing the lowest tick number
- # or a string containing a list of space separated labels
- # or a list containing separate strings or a single string
-
- if isinstance(info, int) or (isinstance(info, str) and info.isdecimal()):
- base = int(info)
- for i in range(num):
- out.write('<text x="' + str(xoff + i * xsep) + '" y="' +
- str(yoff) + '" '
- 'text-anchor="middle" class="muted" xml:space="preserve"'
- '>' + str(i + base) + '</text>\n')
- else:
- if isinstance(info, list):
- if len(info) == 1:
- labels = info[0].split()
- else:
- labels = info
- else:
- labels = info.split()
- if num > len(labels):
- num = len(labels)
- for i in range(num):
- out.write('<text x="' + str(xoff + i * xsep) + '" y="' +
- str(yoff) + '" '
- 'text-anchor="middle" class="muted" xml:space="preserve"'
- '>' + labels[i] + '</text>\n')
-
-
-def render_lanes_tail(out):
- out.write(' </g>\n')
-
-
-# group array is [0=Name, 1=startlane, 2=endlane+1, 3=depth]
-def render_groups(out, groups, yhead, yoff, snum):
- gdepth = 0
- if len(groups) == 0:
- return
-
- for gr in groups:
- if gr[3] > gdepth:
- gdepth = gr[3]
- xgoff = 80 - gdepth * 25
-
- out.write(' <g id="groups_' + str(snum) + '">\n')
-
- gnum = 0
- for gr in groups:
- ymin = yhead + gr[1] * yoff
- ylen = (gr[2] - gr[1]) * yoff
-
- out.write(' <path id="group_' + str(snum) + '_' + str(gnum) +
- '" ')
- out.write('d="m ' + str(xgoff + 25 * gr[3]) + ',' + str(ymin + 3.5) +
- ' c -3,0 -5,2 -5,5 l 0,' + str(ylen - 16) + ' c 0,3 2,5 5,5"'
- 'style="stroke: rgb(0, 65, 196); stroke-width: 1; '
- 'fill: none;"></path>\n')
- if len(gr[0]) > 0:
- out.write(' <g transform="translate(' +
- str(xgoff - 10 + 25 * gr[3]) + ',' +
- str(ymin + ylen // 2) + ')">\n')
- out.write(' <g transform="rotate(270)">\n')
- out.write(' <text text-anchor="middle" class="info" '
- 'xml:space="preserve"><tspan>' + gr[0] +
- '</tspan></text>\n </g>\n </g>')
- gnum += 1
- out.write(' </g>\n')
-
-
-def parse_wave(x, hscale, lanes, groups, gdepth, bricksused):
- sname = ""
- wave = ''
- node = ''
- labels = []
- bricks = []
- extra = hscale - 1
- phase = 0
- xmax = 0
- global prevdefs
-
- if isinstance(x, list):
- gname = x[0]
- startlane = len(lanes)
- for y in x[1:]:
- ymax = parse_wave(y, hscale, lanes, groups, gdepth + 1, bricksused)
- if ymax > xmax:
- xmax = ymax
- groups.append([gname, startlane, len(lanes), gdepth])
- return xmax
-
- if 'name' in x:
- sname = x['name']
-
- # period must be before wave because it changes extra
- if 'period' in x:
- fp = float(x['period'])
- if fp < 0 or fp * 2 != int(fp * 2):
- log.error("Period must be integer or 0.5")
- extra = hscale * fp - 1
- if 'phase' in x:
- phase = int(x['phase'] * 2)
- if 'wave' in x:
- wave = x['wave']
- bricks = parse_wavelane(wave, extra)
- for br in bricks:
- if not br in bricksused and not br in prevdefs:
- bricksused.append(br)
- if 'data' in x:
- labels = x['data']
- if isinstance(labels, str):
- labels = labels.split()
- if 'cdata' in x:
- labels = x['cdata']
- if isinstance(labels, str):
- labels = labels.split()
- labels.append('!cdata!')
-
- if 'node' in x:
- node = x['node']
-
- lanes.append([sname, bricks, wave, labels, extra + 1, phase, node])
- return len(bricks)
-
-
-# obj is Hjson parsed object with wavejson
-# svg_num is a number that makes this svg unique. First one must be 0
-
-
-def convert(obj, svg_num):
- xs = 20 # x scale = width of cycle
- ys = 20 # y scale = height of wave
- yo = int(ys * 1.5) # y offest between lines of waves
- xg = 150 # xoffset of waves (space for names and groups)
- yh0 = 0 # height allocated for header tick/tock labels
- yh1 = 0 # height allocated for header string
- headtext = '' # header string
- headticktock = 0 # does header have tick=1/tock=2
- yf0 = 0 # height allocated for footer tick/tock labels
- yf1 = 0 # height allocated for footer string
- foottext = '' # footer string
- footticktock = 0 # does footer have tick=1/tock=2
- global prevdefs # holds bricks previously defined
- events = {}
-
- if svg_num == 0:
- bricksused = ['gap']
- prevdefs = []
- else:
- bricksused = []
-
- # section was parseConfig in js
- if 'config' in obj and 'hscale' in obj['config']:
- hscale = int(obj['config']['hscale'])
- log.info("Set hscale to " + str(hscale))
- else:
- hscale = 1
-
- if 'head' in obj:
- head = obj['head']
- if 'tick' in head:
- yh0 = 20
- headtt = head['tick']
- headticktock = 1
- elif 'tock' in head:
- yh0 = 20
- headtt = head['tock']
- headticktock = 2
-
- if 'text' in head:
- yh1 = 46
- headtext = head['text']
-
- if 'foot' in obj:
- foot = obj['foot']
- if 'tick' in foot:
- yf0 = 20
- foottt = foot['tick']
- footticktock = 1
- elif 'tock' in foot:
- yf0 = 20
- foottt = foot['tock']
- footticktock = 2
-
- if 'text' in foot:
- yf1 = 46
- foottext = foot['text']
-
- if 'edge' in obj:
- if 'arrows' not in prevdefs:
- bricksused.append('arrows')
- edges = obj['edge']
- log.info("Got edge: " + str(edges))
- else:
- edges = []
-
- # build the signal bricks array
-
- lanes = []
- groups = []
- xmax = 0
- if 'signal' in obj:
- for x in obj['signal']:
- xlen = parse_wave(x, hscale, lanes, groups, 0, bricksused)
- if xlen > xmax:
- xmax = xlen
-
- log.info("Got " + str(len(lanes)) + " lanes. xmax is " + str(xmax))
- log.info(str(lanes))
-
- outbuf = io.StringIO()
-
- height = len(lanes) * yo + yh0 + yh1 + yf0 + yf1
- width = xg + xmax * xs + xs
- wheight = len(lanes) * yo
-
- render_svghead(outbuf, width, height, bricksused, svg_num)
- render_lanes_head(outbuf, xg, yh0 + yh1, svg_num)
- render_marks(outbuf, xmax, xs, wheight, svg_num)
- if yh1 != 0:
- render_caption(outbuf, headtext, xmax, xs, -33 if yh0 != 0 else -13)
-
- if yf1 != 0:
- render_caption(outbuf, foottext, xmax, xs,
- wheight + (45 if yf0 != 0 else 25))
-
- if headticktock == 1:
- render_ticktock(outbuf, headtt, 0, 2 * xs, -5, xmax // 2)
- if headticktock == 2:
- render_ticktock(outbuf, headtt, xs, 2 * xs, -5, xmax // 2)
-
- if footticktock == 1:
- render_ticktock(outbuf, foottt, 0, 2 * xs, wheight + 15, xmax // 2)
- if footticktock == 2:
- render_ticktock(outbuf, foottt, xs, 2 * xs, wheight + 15, xmax // 2)
-
- render_wavelanes(outbuf, xs, yo, lanes, svg_num, events)
- if (len(events) > 0):
- render_events(outbuf, svg_num, events, edges)
- render_lanes_tail(outbuf)
- render_groups(outbuf, groups, yh0 + yh1, yo, svg_num)
- render_svgtail(outbuf)
- prevdefs.extend(bricksused)
-
- generated = outbuf.getvalue()
- outbuf.close()
- return generated
diff --git a/util/wavegen/wavesvg_data.py b/util/wavegen/wavesvg_data.py
deleted file mode 100644
index 6463b2b..0000000
--- a/util/wavegen/wavesvg_data.py
+++ /dev/null
@@ -1,985 +0,0 @@
-# Copyright lowRISC contributors.
-# Licensed under the Apache License, Version 2.0, see LICENSE for details.
-# SPDX-License-Identifier: Apache-2.0
-
-# portions adapted from the javascript wavedrom.js
-# https://github.com/drom/wavedrom/blob/master/wavedrom.js
-# see LICENSE.wavedrom
-
-head1 = """
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- overflow="hidden"
-"""
-
-# Styles are from wavedrom.js
-head2 = """
- <style type="text/css">
- text { font-size: 11pt; font-style: normal; font-variant:
- normal; font-weight: normal; font-stretch: normal;
- text-align: center; fill-opacity: 1; font-family:
- Helvetica }
-
- .muted {
- fill: #aaa
- }
-
- .warning {
- fill: #f6b900
- }
-
- .error {
- fill: #f60000
- }
-
- .info {
- fill: #0041c4
- }
-
- .success {
- fill: #00ab00
- }
-
- .h1 {
- font-size: 33pt;
- font-weight: bold
- }
-
- .h2 {
- font-size: 27pt;
- font-weight: bold
- }
-
- .h3 {
- font-size: 20pt;
- font-weight: bold
- }
-
- .h4 {
- font-size: 14pt;
- font-weight: bold
- }
-
- .h5 {
- font-size: 11pt;
- font-weight: bold
- }
-
- .h6 {
- font-size: 8pt;
- font-weight: bold
- }
-
- .s1 {
- fill: none;
- stroke: #000;
- stroke-width: 1;
- stroke-linecap: round;
- stroke-linejoin: miter;
- stroke-miterlimit: 4;
- stroke-opacity: 1;
- stroke-dasharray: none
- }
-
- .s2 {
- fill: none;
- stroke: #000;
- stroke-width: 0.5;
- stroke-linecap: round;
- stroke-linejoin: miter;
- stroke-miterlimit: 4;
- stroke-opacity: 1;
- stroke-dasharray: none
- }
-
- .s3 {
- color: #000;
- fill: none;
- stroke: #000;
- stroke-width: 1;
- stroke-linecap: round;
- stroke-linejoin: miter;
- stroke-miterlimit: 4;
- stroke-opacity: 1;
- stroke-dasharray: 1, 3;
- stroke-dashoffset: 0;
- marker: none;
- visibility: visible;
- display: inline;
- overflow: visible;
- enable-background: accumulate
- }
-
- .s4 {
- color: #000;
- fill: none;
- stroke: #000;
- stroke-width: 1;
- stroke-linecap: round;
- stroke-linejoin: miter;
- stroke-miterlimit: 4;
- stroke-opacity: 1;
- stroke-dasharray: none;
- stroke-dashoffset: 0;
- marker: none;
- visibility: visible;
- display: inline;
- overflow: visible
- }
-
- .s5 {
- fill: #fff;
- stroke: none
- }
-
- .s6 {
- color: #000;
- fill: #ffffb4;
- fill-opacity: 1;
- fill-rule: nonzero;
- stroke: none;
- stroke-width: 1px;
- marker: none;
- visibility: visible;
- display: inline;
- overflow: visible;
- enable-background: accumulate
- }
-
- .s7 {
- color: #000;
- fill: #ffe0b9;
- fill-opacity: 1;
- fill-rule: nonzero;
- stroke: none;
- stroke-width: 1px;
- marker: none;
- visibility: visible;
- display: inline;
- overflow: visible;
- enable-background: accumulate
- }
-
- .s8 {
- color: #000;
- fill: #b9e0ff;
- fill-opacity: 1;
- fill-rule: nonzero;
- stroke: none;
- stroke-width: 1px;
- marker: none;
- visibility: visible;
- display: inline;
- overflow: visible;
- enable-background: accumulate
- }
-
- .s9 {
- fill: #000;
- fill-opacity: 1;
- stroke: none
- }
-
- .s10 {
- color: #000;
- fill: #fff;
- fill-opacity: 1;
- fill-rule: nonzero;
- stroke: none;
- stroke-width: 1px;
- marker: none;
- visibility: visible;
- display: inline;
- overflow: visible;
- enable-background: accumulate
- }
-
- .s11 {
- fill: #0041c4;
- fill-opacity: 1;
- stroke: none
- }
-
- .s12 {
- fill: none;
- stroke: #0041c4;
- stroke-width: 1;
- stroke-linecap: round;
- stroke-linejoin: miter;
- stroke-miterlimit: 4;
- stroke-opacity: 1;
- stroke-dasharray: none
- }
- </style>
-"""
-
-defs_head = """
- <defs>
-"""
-
-defs_tail = """
- </defs>
-"""
-
-tail = """
- </svg>
-"""
-
-# Brick definitions from wavedrom.js
-# Split out here so only the ones that are used are inserted in the svg
-
-use_defs = {
- 'arrows':
- ''' <marker id="arrowhead" style="fill: rgb(0, 65, 196);" markerHeight="7" markerWidth="10" markerUnits="strokeWidth" viewBox="0 -4 11 8" refX="15" refY="0" orient="auto">
- <path d="M0 -4 11 0 0 4z"></path>
- </marker>
- <marker id="arrowtail" style="fill: rgb(0, 65, 196);" markerHeight="7" markerWidth="10" markerUnits="strokeWidth" viewBox="-11 -4 11 8" refX="-15" refY="0" orient="auto">
- <path d="M0 -4 -11 0 0 4z"></path>
- </marker>
-''',
- 'socket':
- ''' <g id="socket">
- <rect y="15" x="6" height="20" width="20"></rect>
- </g>''',
- 'pclk':
- ''' <g id="pclk">
- <path d="M0,20 0,0 20,0" class="s1"></path>
- </g>''',
- 'nclk':
- ''' <g id="nclk">
- <path d="m0,0 0,20 20,0" class="s1"></path>
- </g>''',
- '000':
- ''' <g id="000">
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- '0m0':
- ''' <g id="0m0">
- <path d="m0,20 3,0 3,-10 3,10 11,0" class="s1"></path>
- </g>''',
- '0m1':
- ''' <g id="0m1">
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- '0mx':
- ''' <g id="0mx">
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 5,20" class="s2"></path>
- <path d="M20,0 4,16" class="s2"></path>
- <path d="M15,0 6,9" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- '0md':
- ''' <g id="0md">
- <path d="m8,20 10,0" class="s3"></path>
- <path d="m0,20 5,0" class="s1"></path>
- </g>''',
- '0mu':
- ''' <g id="0mu">
- <path d="m0,20 3,0 C 7,10 10.107603,0 20,0" class="s1"></path>
- </g>''',
- '0mz':
- ''' <g id="0mz">
- <path d="m0,20 3,0 C 10,10 15,10 20,10" class="s1"></path>
- </g>''',
- '111':
- ''' <g id="111">
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- '1m0':
- ''' <g id="1m0">
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- </g>''',
- '1m1':
- ''' <g id="1m1">
- <path d="M0,0 3,0 6,10 9,0 20,0" class="s1"></path>
- </g>''',
- '1mx':
- ''' <g id="1mx">
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 6,9" class="s2"></path>
- <path d="M10,0 5,5" class="s2"></path>
- <path d="M3.5,1.5 5,0" class="s2"></path>
- </g>''',
- '1md':
- ''' <g id="1md">
- <path d="m0,0 3,0 c 4,10 7,20 17,20" class="s1"></path>
- </g>''',
- '1mu':
- ''' <g id="1mu">
- <path d="M0,0 5,0" class="s1"></path>
- <path d="M8,0 18,0" class="s3"></path>
- </g>''',
- '1mz':
- ''' <g id="1mz">
- <path d="m0,0 3,0 c 7,10 12,10 17,10" class="s1"></path>
- </g>''',
- 'xxx':
- ''' <g id="xxx">
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,5 5,0" class="s2"></path>
- <path d="M0,10 10,0" class="s2"></path>
- <path d="M0,15 15,0" class="s2"></path>
- <path d="M0,20 20,0" class="s2"></path>
- <path d="M5,20 20,5" class="s2"></path>
- <path d="M10,20 20,10" class="s2"></path>
- <path d="m15,20 5,-5" class="s2"></path>
- </g>''',
- 'xm0':
- ''' <g id="xm0">
- <path d="M0,0 4,0 9,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,5 4,1" class="s2"></path>
- <path d="M0,10 5,5" class="s2"></path>
- <path d="M0,15 6,9" class="s2"></path>
- <path d="M0,20 7,13" class="s2"></path>
- <path d="M5,20 8,17" class="s2"></path>
- </g>''',
- 'xm1':
- ''' <g id="xm1">
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,20 4,20 9,0" class="s1"></path>
- <path d="M0,5 5,0" class="s2"></path>
- <path d="M0,10 9,1" class="s2"></path>
- <path d="M0,15 7,8" class="s2"></path>
- <path d="M0,20 5,15" class="s2"></path>
- </g>''',
- 'xmx':
- ''' <g id="xmx">
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,5 5,0" class="s2"></path>
- <path d="M0,10 10,0" class="s2"></path>
- <path d="M0,15 15,0" class="s2"></path>
- <path d="M0,20 20,0" class="s2"></path>
- <path d="M5,20 20,5" class="s2"></path>
- <path d="M10,20 20,10" class="s2"></path>
- <path d="m15,20 5,-5" class="s2"></path>
- </g>''',
- 'xmd':
- ''' <g id="xmd">
- <path d="m0,0 4,0 c 3,10 6,20 16,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,5 4,1" class="s2"></path>
- <path d="M0,10 5.5,4.5" class="s2"></path>
- <path d="M0,15 6.5,8.5" class="s2"></path>
- <path d="M0,20 8,12" class="s2"></path>
- <path d="m5,20 5,-5" class="s2"></path>
- <path d="m10,20 2.5,-2.5" class="s2"></path>
- </g>''',
- 'xmu':
- ''' <g id="xmu">
- <path d="M0,0 20,0" class="s1"></path>
- <path d="m0,20 4,0 C 7,10 10,0 20,0" class="s1"></path>
- <path d="M0,5 5,0" class="s2"></path>
- <path d="M0,10 10,0" class="s2"></path>
- <path d="M0,15 10,5" class="s2"></path>
- <path d="M0,20 6,14" class="s2"></path>
- </g>''',
- 'xmz':
- ''' <g id="xmz">
- <path d="m0,0 4,0 c 6,10 11,10 16,10" class="s1"></path>
- <path d="m0,20 4,0 C 10,10 15,10 20,10" class="s1"></path>
- <path d="M0,5 4.5,0.5" class="s2"></path>
- <path d="M0,10 6.5,3.5" class="s2"></path>
- <path d="M0,15 8.5,6.5" class="s2"></path>
- <path d="M0,20 11.5,8.5" class="s2"></path>
- </g>''',
- 'ddd':
- ''' <g id="ddd">
- <path d="m0,20 20,0" class="s3"></path>
- </g>''',
- 'dm0':
- ''' <g id="dm0">
- <path d="m0,20 10,0" class="s3"></path>
- <path d="m12,20 8,0" class="s1"></path>
- </g>''',
- 'dm1':
- ''' <g id="dm1">
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'dmx':
- ''' <g id="dmx">
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 5,20" class="s2"></path>
- <path d="M20,0 4,16" class="s2"></path>
- <path d="M15,0 6,9" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'dmd':
- ''' <g id="dmd">
- <path d="m0,20 20,0" class="s3"></path>
- </g>''',
- 'dmu':
- ''' <g id="dmu">
- <path d="m0,20 3,0 C 7,10 10.107603,0 20,0" class="s1"></path>
- </g>''',
- 'dmz':
- ''' <g id="dmz">
- <path d="m0,20 3,0 C 10,10 15,10 20,10" class="s1"></path>
- </g>''',
- 'uuu':
- ''' <g id="uuu">
- <path d="M0,0 20,0" class="s3"></path>
- </g>''',
- 'um0':
- ''' <g id="um0">
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- </g>''',
- 'um1':
- ''' <g id="um1">
- <path d="M0,0 10,0" class="s3"></path>
- <path d="m12,0 8,0" class="s1"></path>
- </g>''',
- 'umx':
- ''' <g id="umx">
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 6,9" class="s2"></path>
- <path d="M10,0 5,5" class="s2"></path>
- <path d="M3.5,1.5 5,0" class="s2"></path>
- </g>''',
- 'umd':
- ''' <g id="umd">
- <path d="m0,0 3,0 c 4,10 7,20 17,20" class="s1"></path>
- </g>''',
- 'umu':
- ''' <g id="umu">
- <path d="M0,0 20,0" class="s3"></path>
- </g>''',
- 'umz':
- ''' <g id="umz">
- <path d="m0,0 3,0 c 7,10 12,10 17,10" class="s4"></path>
- </g>''',
- 'zzz':
- ''' <g id="zzz">
- <path d="m0,10 20,0" class="s1"></path>
- </g>''',
- 'zm0':
- ''' <g id="zm0">
- <path d="m0,10 6,0 3,10 11,0" class="s1"></path>
- </g>''',
- 'zm1':
- ''' <g id="zm1">
- <path d="M0,10 6,10 9,0 20,0" class="s1"></path>
- </g>''',
- 'zmx':
- ''' <g id="zmx">
- <path d="m6,10 3,10 11,0" class="s1"></path>
- <path d="M0,10 6,10 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 6.5,8.5" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- </g>''',
- 'zmd':
- ''' <g id="zmd">
- <path d="m0,10 7,0 c 3,5 8,10 13,10" class="s1"></path>
- </g>''',
- 'zmu':
- ''' <g id="zmu">
- <path d="m0,10 7,0 C 10,5 15,0 20,0" class="s1"></path>
- </g>''',
- 'zmz':
- ''' <g id="zmz">
- <path d="m0,10 20,0" class="s1"></path>
- </g>''',
- 'gap':
- ''' <g id="gap">
- <path d="m7,-2 -4,0 c -5,0 -5,24 -10,24 l 4,0 C 2,22 2,-2 7,-2 z" class="s5"></path>
- <path d="M-7,22 C -2,22 -2,-2 3,-2" class="s1"></path>
- <path d="M-3,22 C 2,22 2,-2 7,-2" class="s1"></path>
- </g>''',
- '0mv-3':
- ''' <g id="0mv-3">
- <path d="M9,0 20,0 20,20 3,20 z" class="s6"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- '1mv-3':
- ''' <g id="1mv-3">
- <path d="M2.875,0 20,0 20,20 9,20 z" class="s6"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'xmv-3':
- ''' <g id="xmv-3">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s6"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,5 3.5,1.5" class="s2"></path>
- <path d="M0,10 4.5,5.5" class="s2"></path>
- <path d="M0,15 6,9" class="s2"></path>
- <path d="M0,20 4,16" class="s2"></path>
- </g>''',
- 'dmv-3':
- ''' <g id="dmv-3">
- <path d="M9,0 20,0 20,20 3,20 z" class="s6"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'umv-3':
- ''' <g id="umv-3">
- <path d="M3,0 20,0 20,20 9,20 z" class="s6"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'zmv-3':
- ''' <g id="zmv-3">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s6"></path>
- <path d="m6,10 3,10 11,0" class="s1"></path>
- <path d="M0,10 6,10 9,0 20,0" class="s1"></path>
- </g>''',
- 'vvv-3':
- ''' <g id="vvv-3">
- <path d="M20,20 0,20 0,0 20,0" class="s6"></path>
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vm0-3':
- ''' <g id="vm0-3">
- <path d="M0,20 0,0 3,0 9,20" class="s6"></path>
- <path d="M0,0 3,0 9,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vm1-3':
- ''' <g id="vm1-3">
- <path d="M0,0 0,20 3,20 9,0" class="s6"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,20 3,20 9,0" class="s1"></path>
- </g>''',
- 'vmx-3':
- ''' <g id="vmx-3">
- <path d="M0,0 0,20 3,20 6,10 3,0" class="s6"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 7,8" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- </g>''',
- 'vmd-3':
- ''' <g id="vmd-3">
- <path d="m0,0 0,20 20,0 C 10,20 7,10 3,0" class="s6"></path>
- <path d="m0,0 3,0 c 4,10 7,20 17,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vmu-3':
- ''' <g id="vmu-3">
- <path d="m0,0 0,20 3,0 C 7,10 10,0 20,0" class="s6"></path>
- <path d="m0,20 3,0 C 7,10 10,0 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vmz-3':
- ''' <g id="vmz-3">
- <path d="M0,0 3,0 C 10,10 15,10 20,10 15,10 10,10 3,20 L 0,20" class="s6"></path>
- <path d="m0,0 3,0 c 7,10 12,10 17,10" class="s1"></path>
- <path d="m0,20 3,0 C 10,10 15,10 20,10" class="s1"></path>
- </g>''',
- 'vmv-3-3':
- ''' <g id="vmv-3-3">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s6"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s6"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-3-4':
- ''' <g id="vmv-3-4">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s7"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s6"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-3-5':
- ''' <g id="vmv-3-5">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s8"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s6"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-4-3':
- ''' <g id="vmv-4-3">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s6"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s7"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-4-4':
- ''' <g id="vmv-4-4">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s7"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s7"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-4-5':
- ''' <g id="vmv-4-5">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s8"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s7"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-5-3':
- ''' <g id="vmv-5-3">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s6"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s8"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-5-4':
- ''' <g id="vmv-5-4">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s7"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s8"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-5-5':
- ''' <g id="vmv-5-5">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s8"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s8"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- '0mv-4':
- ''' <g id="0mv-4">
- <path d="M9,0 20,0 20,20 3,20 z" class="s7"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- '1mv-4':
- ''' <g id="1mv-4">
- <path d="M2.875,0 20,0 20,20 9,20 z" class="s7"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'xmv-4':
- ''' <g id="xmv-4">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s7"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,5 3.5,1.5" class="s2"></path>
- <path d="M0,10 4.5,5.5" class="s2"></path>
- <path d="M0,15 6,9" class="s2"></path>
- <path d="M0,20 4,16" class="s2"></path>
- </g>''',
- 'dmv-4':
- ''' <g id="dmv-4">
- <path d="M9,0 20,0 20,20 3,20 z" class="s7"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'umv-4':
- ''' <g id="umv-4">
- <path d="M3,0 20,0 20,20 9,20 z" class="s7"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'zmv-4':
- ''' <g id="zmv-4">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s7"></path>
- <path d="m6,10 3,10 11,0" class="s1"></path>
- <path d="M0,10 6,10 9,0 20,0" class="s1"></path>
- </g>''',
- '0mv-5':
- ''' <g id="0mv-5">
- <path d="M9,0 20,0 20,20 3,20 z" class="s8"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- '1mv-5':
- ''' <g id="1mv-5">
- <path d="M2.875,0 20,0 20,20 9,20 z" class="s8"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'xmv-5':
- ''' <g id="xmv-5">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s8"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,5 3.5,1.5" class="s2"></path>
- <path d="M0,10 4.5,5.5" class="s2"></path>
- <path d="M0,15 6,9" class="s2"></path>
- <path d="M0,20 4,16" class="s2"></path>
- </g>''',
- 'dmv-5':
- ''' <g id="dmv-5">
- <path d="M9,0 20,0 20,20 3,20 z" class="s8"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'umv-5':
- ''' <g id="umv-5">
- <path d="M3,0 20,0 20,20 9,20 z" class="s8"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'zmv-5':
- ''' <g id="zmv-5">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s8"></path>
- <path d="m6,10 3,10 11,0" class="s1"></path>
- <path d="M0,10 6,10 9,0 20,0" class="s1"></path>
- </g>''',
- 'vvv-4':
- ''' <g id="vvv-4">
- <path d="M20,20 0,20 0,0 20,0" class="s7"></path>
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vm0-4':
- ''' <g id="vm0-4">
- <path d="M0,20 0,0 3,0 9,20" class="s7"></path>
- <path d="M0,0 3,0 9,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vm1-4':
- ''' <g id="vm1-4">
- <path d="M0,0 0,20 3,20 9,0" class="s7"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,20 3,20 9,0" class="s1"></path>
- </g>''',
- 'vmx-4':
- ''' <g id="vmx-4">
- <path d="M0,0 0,20 3,20 6,10 3,0" class="s7"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 7,8" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- </g>''',
- 'vmd-4':
- ''' <g id="vmd-4">
- <path d="m0,0 0,20 20,0 C 10,20 7,10 3,0" class="s7"></path>
- <path d="m0,0 3,0 c 4,10 7,20 17,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vmu-4':
- ''' <g id="vmu-4">
- <path d="m0,0 0,20 3,0 C 7,10 10,0 20,0" class="s7"></path>
- <path d="m0,20 3,0 C 7,10 10,0 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vmz-4':
- ''' <g id="vmz-4">
- <path d="M0,0 3,0 C 10,10 15,10 20,10 15,10 10,10 3,20 L 0,20" class="s7"></path>
- <path d="m0,0 3,0 c 7,10 12,10 17,10" class="s1"></path>
- <path d="m0,20 3,0 C 10,10 15,10 20,10" class="s1"></path>
- </g>''',
- 'vvv-5':
- ''' <g id="vvv-5">
- <path d="M20,20 0,20 0,0 20,0" class="s8"></path>
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vm0-5':
- ''' <g id="vm0-5">
- <path d="M0,20 0,0 3,0 9,20" class="s8"></path>
- <path d="M0,0 3,0 9,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vm1-5':
- ''' <g id="vm1-5">
- <path d="M0,0 0,20 3,20 9,0" class="s8"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,20 3,20 9,0" class="s1"></path>
- </g>''',
- 'vmx-5':
- ''' <g id="vmx-5">
- <path d="M0,0 0,20 3,20 6,10 3,0" class="s8"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 7,8" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- </g>''',
- 'vmd-5':
- ''' <g id="vmd-5">
- <path d="m0,0 0,20 20,0 C 10,20 7,10 3,0" class="s8"></path>
- <path d="m0,0 3,0 c 4,10 7,20 17,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vmu-5':
- ''' <g id="vmu-5">
- <path d="m0,0 0,20 3,0 C 7,10 10,0 20,0" class="s8"></path>
- <path d="m0,20 3,0 C 7,10 10,0 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vmz-5':
- ''' <g id="vmz-5">
- <path d="M0,0 3,0 C 10,10 15,10 20,10 15,10 10,10 3,20 L 0,20" class="s8"></path>
- <path d="m0,0 3,0 c 7,10 12,10 17,10" class="s1"></path>
- <path d="m0,20 3,0 C 10,10 15,10 20,10" class="s1"></path>
- </g>''',
- 'Pclk':
- ''' <g id="Pclk">
- <path d="M-3,12 0,3 3,12 C 1,11 -1,11 -3,12 z" class="s9"></path>
- <path d="M0,20 0,0 20,0" class="s1"></path>
- </g>''',
- 'Nclk':
- ''' <g id="Nclk">
- <path d="M-3,8 0,17 3,8 C 1,9 -1,9 -3,8 z" class="s9"></path>
- <path d="m0,0 0,20 20,0" class="s1"></path>
- </g>''',
- 'vvv-2':
- ''' <g id="vvv-2">
- <path d="M20,20 0,20 0,0 20,0" class="s10"></path>
- <path d="m0,20 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vm0-2':
- ''' <g id="vm0-2">
- <path d="M0,20 0,0 3,0 9,20" class="s10"></path>
- <path d="M0,0 3,0 9,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vm1-2':
- ''' <g id="vm1-2">
- <path d="M0,0 0,20 3,20 9,0" class="s10"></path>
- <path d="M0,0 20,0" class="s1"></path>
- <path d="M0,20 3,20 9,0" class="s1"></path>
- </g>''',
- 'vmx-2':
- ''' <g id="vmx-2">
- <path d="M0,0 0,20 3,20 6,10 3,0" class="s10"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m20,15 -5,5" class="s2"></path>
- <path d="M20,10 10,20" class="s2"></path>
- <path d="M20,5 8,17" class="s2"></path>
- <path d="M20,0 7,13" class="s2"></path>
- <path d="M15,0 7,8" class="s2"></path>
- <path d="M10,0 9,1" class="s2"></path>
- </g>''',
- 'vmd-2':
- ''' <g id="vmd-2">
- <path d="m0,0 0,20 20,0 C 10,20 7,10 3,0" class="s10"></path>
- <path d="m0,0 3,0 c 4,10 7,20 17,20" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'vmu-2':
- ''' <g id="vmu-2">
- <path d="m0,0 0,20 3,0 C 7,10 10,0 20,0" class="s10"></path>
- <path d="m0,20 3,0 C 7,10 10,0 20,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'vmz-2':
- ''' <g id="vmz-2">
- <path d="M0,0 3,0 C 10,10 15,10 20,10 15,10 10,10 3,20 L 0,20" class="s10"></path>
- <path d="m0,0 3,0 c 7,10 12,10 17,10" class="s1"></path>
- <path d="m0,20 3,0 C 10,10 15,10 20,10" class="s1"></path>
- </g>''',
- '0mv-2':
- ''' <g id="0mv-2">
- <path d="M9,0 20,0 20,20 3,20 z" class="s10"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- '1mv-2':
- ''' <g id="1mv-2">
- <path d="M2.875,0 20,0 20,20 9,20 z" class="s10"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'xmv-2':
- ''' <g id="xmv-2">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s10"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,5 3.5,1.5" class="s2"></path>
- <path d="M0,10 4.5,5.5" class="s2"></path>
- <path d="M0,15 6,9" class="s2"></path>
- <path d="M0,20 4,16" class="s2"></path>
- </g>''',
- 'dmv-2':
- ''' <g id="dmv-2">
- <path d="M9,0 20,0 20,20 3,20 z" class="s10"></path>
- <path d="M3,20 9,0 20,0" class="s1"></path>
- <path d="m0,20 20,0" class="s1"></path>
- </g>''',
- 'umv-2':
- ''' <g id="umv-2">
- <path d="M3,0 20,0 20,20 9,20 z" class="s10"></path>
- <path d="m3,0 6,20 11,0" class="s1"></path>
- <path d="M0,0 20,0" class="s1"></path>
- </g>''',
- 'zmv-2':
- ''' <g id="zmv-2">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s10"></path>
- <path d="m6,10 3,10 11,0" class="s1"></path>
- <path d="M0,10 6,10 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-3-2':
- ''' <g id="vmv-3-2">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s10"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s6"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-4-2':
- ''' <g id="vmv-4-2">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s10"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s7"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-5-2':
- ''' <g id="vmv-5-2">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s10"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s8"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-2-3':
- ''' <g id="vmv-2-3">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s6"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s10"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-2-4':
- ''' <g id="vmv-2-4">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s7"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s10"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-2-5':
- ''' <g id="vmv-2-5">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s8"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s10"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
- 'vmv-2-2':
- ''' <g id="vmv-2-2">
- <path d="M9,0 20,0 20,20 9,20 6,10 z" class="s10"></path>
- <path d="M3,0 0,0 0,20 3,20 6,10 z" class="s10"></path>
- <path d="m0,0 3,0 6,20 11,0" class="s1"></path>
- <path d="M0,20 3,20 9,0 20,0" class="s1"></path>
- </g>''',
-}
diff --git a/util/wavetool.py b/util/wavetool.py
deleted file mode 100755
index cfe8c12..0000000
--- a/util/wavetool.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/env python3
-# Copyright lowRISC contributors.
-# Licensed under the Apache License, Version 2.0, see LICENSE for details.
-# SPDX-License-Identifier: Apache-2.0
-r"""Command-line tool to convert wavejson to svg
-"""
-
-import argparse
-import logging as log
-import sys
-
-import hjson
-import pkg_resources # part of setuptools
-
-from reggen import version
-from wavegen import wavesvg
-
-USAGE = """
- wavetool [options]
- wavetool [options] <input> [<input>]...
-"""
-
-wavejson = """
-{signal: [
- {name:'Baud Clock', wave: 'p...........' },
- {name:'Data 8 bit', wave: '10========1=',
- data: [ "lsb", "", "", "", "", "", "", "msb", "next" ] },
- {name:'Data 7 bit', wave: '10=======1=.',
- data: [ "lsb", "", "", "", "", "", "msb", "next" ] },
- {name:'Data 6 bit', wave: '10======1=..',
- data: [ "lsb", "", "", "", "", "msb", "next" ] },
- {name:'5 bit,halfbaud', wave: '10=====1=.|.', period:2,
- data: [ "lsb", "", "", "", "msb", "next" ] },
- {},
- {name:'8 with Parity', wave: '10=========1',
- data: [ "lsb", "", "", "", "", "", "", "msb", "par" ] },
- {name:'10udz1xHL', wave: '10udz1xHL' },
- {name:'5 bit,cdata', wave: '10=====1=...',
- cdata: [ "idle", "start", "lsb", "", "", "", "msb", "stop", "next" ] },
- ],
- head:{
- text:'Serial Line format (one stop bit)',
- tock:-1,
- }
-}
-
-"""
-
-
-def main():
- done_stdin = False
- parser = argparse.ArgumentParser(
- prog="wavetool",
- formatter_class=argparse.RawDescriptionHelpFormatter,
- usage=USAGE,
- description=__doc__,
- epilog='defaults or the filename - can be used for stdin/stdout')
- parser.add_argument(
- '--version', action='store_true', help='Show version and exit')
- parser.add_argument(
- '-v',
- '--verbose',
- action='store_true',
- help='Verbose output during processing')
- parser.add_argument(
- '-T',
- '--testmode',
- action='store_true',
- help='Run test with built-in source')
- parser.add_argument(
- '-o',
- '--output',
- type=argparse.FileType('w'),
- default=sys.stdout,
- metavar='file',
- help='Output file (default stdout)')
- parser.add_argument(
- 'srcfile',
- nargs='*',
- metavar='input',
- default='-',
- help='source wavejson file (default stdin)')
- args = parser.parse_args()
-
- if args.version:
- version.show_and_exit(__file__, ["Hjson"])
-
- if (args.verbose):
- log.basicConfig(format="%(levelname)s: %(message)s", level=log.DEBUG)
- else:
- log.basicConfig(format="%(levelname)s: %(message)s")
-
- outfile = args.output
-
- with outfile:
- if args.testmode:
- obj = hjson.loads(wavejson)
-
- svg0 = wavesvg.convert(obj, 0)
- svg1 = wavesvg.convert(obj, 1)
- outfile.write(svg0)
- outfile.write('<h2>Generate again, should not repeat defs</h2>\n')
- outfile.write(svg1)
- else:
- num = 0
- for filename in args.srcfile:
- if (filename == '-'):
- if (done_stdin):
- log.warn("Ignore stdin after first use\n")
- continue
- done_stdin = True
- infile = sys.stdin
- else:
- infile = open(filename, 'r', encoding='UTF-8')
- with infile:
- obj = hjson.load(infile)
- log.info("\nFile now " + filename)
- outfile.write("<H2>" + filename + "</H2>")
- outfile.write(wavesvg.convert(obj, num))
- num += 1
-
-
-if __name__ == '__main__':
- main()