DrSensor / scdlang

Statechart Description Language (just an experiment, need to be rewritten)
Universal Permissive License v1.0
99 stars 2 forks source link

Generate timing diagram #27

Open DrSensor opened 5 years ago

DrSensor commented 5 years ago

How it looks like? (maybe)

entry |> State1 |> exit

state State2 {
  State21 >< activity

  initial -> State21
  State21 -> State22 @ Event
}

initial -> State1
State1 -> State2 @ Event[guard] |> action
State2 -> State1 @ Reset |> action

From 👆 to 👇 Screenshot_20190706_065814

{signal: [
  {name: 'execution', wave: '03524.02350', data: ['entry', 'exit', 'action', 'activity', 'action', 'entry', 'exit']},
  {name: 'trigger',   wave: '0..=0.==0..', data: ['Event [<i>guard</i>]', 'Event', 'Reset']},

  {name: 'State1',    wave: '01.x...1..0'},
  ['State2',
   {name: 'State21',  wave: '0x.1..x...0'},
   {name: 'State22',  wave: '0x....1x..0'},
  ],
],
  config: { hscale: 3 }
}

Paste 👆 to https://wavedrom.com/editor.html

I think I should move action, entry, and exit inside state timeline 🤔. Also separate activity to different lifeline, especially when in the compound state.

However, for easier implementation, it should lay flat. Imagine having an action that executed many times, how long the data will be 😅

Something needs to watch out!

References
Related issues
Viewers
Other approachs
brucou commented 5 years ago

My background is electrical engineering so it might get influence from that. There are several way to analyze FSM in ASIC design (see [here](FSM-viz Verilog)). Let's move the discussion in #27.

Yeah I had a look at the link. It is true that chips are on a clock, so it makes sense to visualize it that way. Did you ever heard about Lucid Synchrone or Esterel? Those are synchronous languages compiling to fsm with model checking and all the jazz. They embed a notion of clock and use clocked streams for everything.

For the FSM I deal with, I think the interesting information for tracing is the sequence itself , i.e. instead of visualizing [(x_i, t_i] i.e. a sequence of x occurring at time t it is more interesting to visualize just the [x_i] directly on the graph visualization. But I haven't given too much thoughts to that.