add anchor points or events to timing diagrams

+1 vote
asked Mar 30, 2020 in Wanted features by awschult (360 points)

I would really like to be able to add anchor points and events to timing diagrams. There are times when it's easier to describe something as event based very much like the Gantt charts where one thing follows the next. But also i anchor points that we can reference for both labels as well as timing of the events. In the example below, I focus on anchor points, or being able to describe a place in time as a variable that we can reference. It allows flexibility if we have to change the timing of the diagram later, but not the overall structure. Also, as the end i show how some form of labeling can be done in reference to those anchor points. one will display that actual time delta, the other will display custom text.


@startuml

binary Enable

robust dataBus




@0

databus is "idle"

enable is low

@100 is wrtBeg

@wrtBeg databus is "0xf23a"

@wrtBeg + 40 enable is high

wrtBeg+100 is wrtEnd

@wrtEnd databus is "0x0000"

@wrtEnd + 20 enable is low




label time from wrtBeg to wrtEnd

label "write here" from wrtBeg to wrtEnd


What do you think?

commented May 12, 2023 by Pertti

I have a more modest wish regarding the anchor points:

Let's first fix this fundamental flaw at least in version 1.2023.0

@0 as :start

@:start  => Works

@:start+1  => Works

@:start+1.1  => Does not work (!) = One cannot use any fractional timings with anchor points such as 1.1[µs]

Thanks,

Pertti

1 Answer

0 votes
answered Apr 6, 2020 by plantuml (294,660 points)
selected Jun 3, 2022 by awschult
 
Best answer

There seems to be good idea here...

Could you first post a simple working example (so without any anchor or variable) so that we start to discuss about it ? Keep your example as simple as possible. Having a real image would help us to better understand your need.

Thanks!

commented Apr 6, 2020 by awschult (360 points)

Consider the following working example. The databus always changes a set time after the enable signal. I would like to be able to tell the system that the databus will change at enable + XX.

@startuml
clock clk with period 1
binary "enable" as en
concise "dataBus" as db

@0
en is low
db is "0x0"

@10
 en is high
@11
 db is "0xDEADBEEF"

@20
en is low
@21 
db is "0x0"

@enduml

This functionality is already built into the Gantt chart. see below:

@startgantt
[Prototype design] lasts 10 days
[Code prototype] lasts 10 days
[Write tests] lasts 5 days
[Code prototype] starts at [Prototype design]'s end
[Write tests] starts at [Code prototype]'s start
@endgantt

Also:. Being able to paramertise the time something happens (like in my example the original post). If I could define a time as a variable, then use that variable like an event or anchor point to base other signal off of, that would greatly reduce my overhead.

Here is a complex example:

@startuml
clock clk with period 1
binary "enable" as en
binary "R/W" as rw
binary "data Valid" as dv
concise "dataBus" as db
concise "address bus" as addr

@0
en is low
db is "0x0"
addr is "0x03f"
rw is 1
dv is 0

@3
 en is high
@4
 db is "0xDEADBEEF"
@5
dv is 1


@8
dv is low
@9
rw is low
db is "0x0"
addr is "0x23"

@12
dv is high
@13 
db is "0xFFFF"

@20
en is low
dv is low
@21 
db is "0x0"

highlight 4 to 9 #Gold;line:DimGrey : Write to address
highlight 9 to 21 #lightBlue;line:DimGrey : Read From Address

db@4 <-> @9 : setup time
db@4 -> addr@9 : hold
@enduml

If you could imagine, you have that diagram, and i ask you to expand the hold time by another period. In order to keep everything constrained to the correct timing; you would need to adjust all of the signals and highlighted region by hand. This is very cumbersome and limiting. If we could specify time as a variable and then perform arithmetic operations, then we can greatly increase the flexibility and reusability of the graph.

@9 is hold_time
@hold_time + 1
db is "0x234"
commented Apr 6, 2020 by plantuml (294,660 points)

Thanks for your detailled answer. It really helps.

Few remarks.

First, you can use relative time, like in the following example. http://www.plantuml.com/plantuml/uml/LOvB3i8m34JtFiKeMpR93KBLSezyB1erEAX9LRWz3KWWTlQyqTFOsjpQjbkca4jO4FA2FRKPTrvJYJ3aaxZr2SNYV6O5Ly52eKX8bQ6YQsxOwZkFdiXgOa6go6MdwFkbz4EhWnXD-B0vNMUo9qFuDiRfF0xJT57KWVb9-ei_asM9n-8N

But I think it does not really help in your case.

Second, you can use the preprocessor like in http://www.plantuml.com/plantuml/uml/VL1BJyCm3BxxLvYE6qBq0H8CXhffZ_iEx9msXaPBqob9L_RlIPfkPHoeLCN-7lwSvCOoRTjQmirjNyuUNKMApq9xzmHGogRSOodts0bRuO6qQ3WcK0Z5z0aZKgoG524pIEg2RXzsFQIx2yIPPVZ1fE0zmuzGDgeKXWArQ4t0Yn5dd6io1ek1ypr07WCf50Pbqm4lV1N5tt44dZvtsMS4klDT0lpepzWvCy1WhSHN1Ncu9U1bo78rNovMgtNaE59yS2RWhC--6KBp5p_x_mtIB7Ak90ss8J39SDIltUSrwTLznf0qmQlXu6T8zriCYwDjqA-9aqqZ-QiKYgPBKMyqdN2AEoqiUSdmYgCzc1pZ4YOzif0j_VLlYN5SwwR6-J30RPCFoM_txzW_aHCQikq1hQZfby3nFlUigTo2aBkwhUKF

Note that the preprocessor allows much more than that : you can create functions that you can reuse. For example, you can have http://www.plantuml.com/plantuml/uml/VL9DZvim4BtFhvYm71fbg_BHIjkqMtcZ97lVG_Tii5Ei63koJMZ-VMrC8EbXaP1dtfitRnXChAF6TQs4HJg4przzn1LxZkdg6m0i3fsgdT0AqqRyQQH_tQVqO7Jxc3gz14HMaI77dvz_8V4Whj5orvtGYPRV5dYUCcR6caPB1WjlTtK0gAMkZrZB8_R2DNZYHcY6ELH2KNF1X2jQIPuWjSZLXBvzUHyWqqyGeuxYRoe56nXsXbghMbWUgKrd8rxDU9YCMulLo8KSW6J05GgBKlV0gX0bsTyiWK1Vi_AGWEb3bWCxXpFpoX8mIiFUWCIT0avDjhkNxMQtsoT0mj97PGvU-XIIqPHy3xq_dg0e4w_AYr4M3VCIv_gzVq9DSVSziqcHurrpc7usni7HQGnZuiEhbko758gljw9zDVo2Qtmtml5GCcvnbaUHPxp3mu1iPCV_rxznod0VxiZBs01khbkSu75ejRnZ0h8g8xDwMWBnPzVAVm00

Now, after saying all this, I agree that having anchor/event/variable would be good. For those anchor, we need a separator to ease the parser job. We probably are going to use a colon for this. So you could have:

@9 as :hold_time
@:hold_time+1
db is "0x234"

We'll post a message here when a beta will be ready with this feature.

commented Apr 7, 2020 by plantuml (294,660 points)

Using last beta http://beta.plantuml.net/plantuml.jar and on the online server, you can now have:

@startuml
clock clk with period 1
binary "enable" as en
concise "dataBus" as db

@0
en is low
db is "0x0"

@10 as :start
 en is high
@:start+1
 db is "0xDEADBEEF"

@:start+20 as :end
en is low
@:end+1
db is "0x0"

highlight :start to :start+5 #Gold;line:DimGrey : Write to address

@enduml

http://www.plantuml.com/plantuml/uml/LP1BQiCm48RtSueVTUcDNUZ6tRZ1RexGjHv3FKIHYgIGvlQLuc2QXM0q_-E3cNBHgLpEdgoFzWJhJxXAMV73IQB3G4Q2JZSe3jfuLj0P7CZ6O2KpbDD57oxvldU6QEg90oJ3noivqoRL__QgAaFVJEETIDXSgtolD6sxRY3iYNdvc0_Bygbebr-tF0Vt3p6rVpVWcTLgVNtbWKE9ZwbxmyinUlVk9V0uo_cO-8OHNqaADvjsBd7E5LkBws7-0000

This is really a first version and a proposal. Tell us if it helps!

commented Apr 7, 2020 by awschult (360 points)
heck yeah! this is a huge help! Thank you for being so responsive!

I would be interested in updating the main site with these examples. How do i go about doing that?
commented Apr 7, 2020 by plantuml (294,660 points)

You can go to http://wiki.plantuml.net/site/timing-diagram

You can update this wiki as you like. You don't even have to create an account : it's completely open.

Our documentation is in bad shape so really do whatever you think is useful (but please only on the English version). Once you'll be finished, we have some scripts that retrieve content from this wiki and publish it to the official server.

commented Apr 7, 2020 by awschult (360 points)
Thank you. I have updated the wiki
commented Apr 7, 2020 by plantuml (294,660 points)
It's published ! That's nice.

Reading your example http://www.plantuml.com/plantuml/uml/NO_D2W8X58NtzoakRYDm9chHIeBPpYl4zQT6nZH6XwctRnmC8rV7Z-ySKSH4KveV3fGBQaJbHbni6l1f9XiqDY2jf-cDp7YIpZ2aY5qFAdXbeq6cAT5bZXlN4a3mdCxRB8ZZTZ7-EjZxW20Q_WKkBB3QHUnwj14pqp8dnbzyFImRfLsS70lDUYrMSz_MbLjxeD-LtUd_1M6yNl__0G00

I wonder if we should not print anchor's names ("start" / "en_high" / "en_low" ) on the time axis just below theirs respective values (0 / 5 / 10). What do you think ? Does it make sense ?
commented Apr 8, 2020 by awschult (360 points)
I do not think we should add anchor names to the rendered image. Anchor names are a code only utility and won't always have a proper customer facing name.

One should use labels and arrows based off of the anchor points if they want to show something like that.
...