Mark Hayter | 14336e7 | 2019-12-29 16:21:34 -0800 | [diff] [blame] | 1 | # Copyright lowRISC contributors. |
| 2 | # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Svg data for I2C display |
| 6 | |
| 7 | # constants in svg tag |
| 8 | svgtag_consts = """ |
| 9 | xmlns="http://www.w3.org/2000/svg" |
| 10 | xmlns:xlink="http://www.w3.org/1999/xlink" |
| 11 | overflow="hidden" |
| 12 | """ |
| 13 | |
| 14 | # styles |
| 15 | svgstyle = """ |
| 16 | <style type="text/css"> |
| 17 | text { font-size: 11pt; font-style: normal; font-variant: |
| 18 | normal; font-weight: bold; font-stretch: normal; |
| 19 | text-align: center; text-anchor: middle; fill-opacity: 1; font-family: |
| 20 | Helvetica } |
| 21 | |
| 22 | .tt { |
| 23 | text-anchor: start; font-weight: normal; font-size: 10pt; |
| 24 | font-family: monospace |
| 25 | } |
| 26 | |
| 27 | .shost { |
| 28 | fill: none; |
| 29 | stroke: #000; |
| 30 | stroke-width: 1; |
| 31 | stroke-linecap: round; |
| 32 | stroke-linejoin: miter; |
| 33 | stroke-miterlimit: 4; |
| 34 | stroke-opacity: 1; |
| 35 | stroke-dasharray: none |
| 36 | } |
| 37 | |
| 38 | .dash { |
| 39 | fill: none; |
| 40 | stroke: #000; |
| 41 | stroke-width: 1; |
| 42 | stroke-linecap: butt; |
| 43 | stroke-linejoin: miter; |
| 44 | stroke-miterlimit: 4; |
| 45 | stroke-opacity: 1; |
| 46 | stroke-dasharray: 8; |
| 47 | } |
| 48 | |
| 49 | .sdev { |
| 50 | fill: #CCC; |
| 51 | stroke: #000; |
| 52 | stroke-width: 1; |
| 53 | stroke-linecap: round; |
| 54 | stroke-linejoin: miter; |
| 55 | stroke-miterlimit: 4; |
| 56 | stroke-opacity: 1; |
| 57 | stroke-dasharray: none |
| 58 | } |
| 59 | |
| 60 | |
| 61 | </style> |
| 62 | """ |
| 63 | |
| 64 | # width of the svg |
| 65 | svgw = 1000 |
| 66 | |
| 67 | # svg defs are made with a bit-box 20,40 so set constants based on that |
| 68 | bitw = 20 |
| 69 | bith = 40 |
| 70 | bytew = 160 |
| 71 | |
| 72 | # text is offset from the top of a bit |
| 73 | txty = 25 |
| 74 | |
| 75 | # formatting: |
| 76 | wrap = 880 # the wrap point for long transactions |
| 77 | cindent = 60 # the indentation for continuation lines |
| 78 | linesep = 50 # separation between lines |
| 79 | |
| 80 | svg_defs = """ |
| 81 | <defs> |
| 82 | <g id="start"> |
| 83 | <path d="M0,0 h 20 m0,40 h -20 v -40" class="shost" /> |
| 84 | <text x="10" y="25">S</text> |
| 85 | </g> |
| 86 | <g id="pstop"> |
| 87 | <path d="M0,0 h 20 v 40 h -20 M0,0" class="shost" /> |
| 88 | <text x="10" y="25">P</text> |
| 89 | </g> |
| 90 | <g id="ackh"> |
| 91 | <path d="M0,0 h 20 v 40 h -20 v -40" class="shost" /> |
| 92 | <text x="10" y="25">A</text> |
| 93 | </g> |
| 94 | <g id="ackd"> |
| 95 | <path d="M0,0 h 20 v 40 h -20 v -40" class="sdev" /> |
| 96 | <text x="10" y="25">A</text> |
| 97 | </g> |
| 98 | <g id="nackh"> |
| 99 | <path d="M0,0 h 20 v 40 h -20 v -40" class="shost" /> |
| 100 | <text x="10" y="25">N</text> |
| 101 | </g> |
| 102 | <g id="nackd"> |
| 103 | <path d="M0,0 h 20 v 40 h -20 v -40" class="sdev" /> |
| 104 | <text x="10" y="25">N</text> |
| 105 | </g> |
| 106 | <g id="norackd"> |
| 107 | <path d="M0,0 h 20 v 40 h -20 v -40" class="sdev" /> |
| 108 | <text x="5" y="15">A/</text> |
| 109 | <text x="15" y="35">N</text> |
| 110 | </g> |
| 111 | <g id="skip"> |
| 112 | <path d="M0,0 h 8 l-5,30 l5,-10 l-5,20 h -3 v -40" class="shost" /> |
| 113 | <path d="M17,0 h 3 v 40 h -8 l5,-30 l-5,10 l5,-20" class="shost" /> |
| 114 | </g> |
| 115 | <g id="hbyte"> |
| 116 | <path d="M0,0 h 160 m0,40 h -160 v -40" class="shost" /> |
| 117 | </g> |
| 118 | <g id="dbyte"> |
| 119 | <path d="M0,0 h 160 v 40 h -160 v -40" class="sdev" /> |
| 120 | </g> |
| 121 | <g id="adr0"> |
| 122 | <path d="M0,0 h 160 m0,40 h -160 v -40" class="shost" /> |
| 123 | <path d="M140,0 v 40" class="dash" /> |
| 124 | <text x="80" y="25">Adr</text> |
| 125 | <text x="150" y="25">wr</text> |
| 126 | </g> |
| 127 | <g id="adr1"> |
| 128 | <path d="M0,0 h 160 m0,40 h -160 v -40" class="shost" /> |
| 129 | <path d="M140,0 v 40" class="dash" /> |
| 130 | <text x="80" y="25">Adr</text> |
| 131 | <text x="150" y="25">rd</text> |
| 132 | </g> |
| 133 | <g id="adr2"> |
| 134 | <path d="M0,0 h 160 m0,40 h -160 v -40" class="shost" /> |
| 135 | <path d="M140,0 v 40" class="dash" /> |
| 136 | <text x="80" y="25">Adr</text> |
| 137 | <text x="150" y="25">d</text> |
| 138 | </g> |
| 139 | |
| 140 | </defs> |
| 141 | """ |