uCsim, Copyright (C)  Daniel Drotos.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
# Test vcd operations
# Note that with the default clock settings on the STM8 we have
# a tick of 125 ns.
set hw vcd output "out/test.vcd"
set hw vcd add rom[0x100]
set hw vcd start
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000000000000000 s
  Pause time: 
  Simul time: 0.000000000000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)

# For ticks (500 ns) of changing data
set mem rom[0x100] 0
0x00100                      00 .
tick
set mem rom[0x100] 1
0x00100                      01 .
tick
set mem rom[0x100] 2
0x00100                      02 .
tick
set mem rom[0x100] 3
0x00100                      03 .
tick

# Now pause for 8 ticks (1000 ns).
# Pause duration is not limited so all the following ticks are
# recorded but not values.
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000000000000000 s
  Pause time: 
  Simul time: 0.000000500000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)
set hw vcd pause
Paused
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     YES
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000000500000000 s
  Pause time: 
  Simul time: 0.000000500000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)
set mem rom[0x100] 4
0x00100                      04 .
tick
set mem rom[0x100] 5
0x00100                      05 .
tick
set mem rom[0x100] 6
0x00100                      06 .
tick
set mem rom[0x100] 7
0x00100                      07 .
tick
set mem rom[0x100] 8
0x00100                      08 .
tick
set mem rom[0x100] 9
0x00100                      09 .
tick
set mem rom[0x100] 10
0x00100                      0a .
tick
set mem rom[0x100] 11
0x00100                      0b .
tick

# Resume. States are updated to current values and recording resumes.
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     YES
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000000500000000 s
  Pause time: 
  Simul time: 0.000001500000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)
set hw vcd restart
Unpaused
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000001500000000 s
  Pause time: 
  Simul time: 0.000001500000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)
set mem rom[0x100] 12
0x00100                      0c .
tick
set mem rom[0x100] 13
0x00100                      0d .
tick
set mem rom[0x100] 14
0x00100                      0e .
tick
set mem rom[0x100] 15
0x00100                      0f .
tick

# Pause again for 8 ticks (1000 ns) but this time limit the pause duration
# to 300 ns. Note that since we are limited by tick granularity we will
# record the first 3 ticks (375 ns) then ignore the rest.
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000001500000000 s
  Pause time: 
  Simul time: 0.000002000000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)
set hw vcd pausetime 300 ns
set hw vcd pause
Paused (pause limit 0.000000300000000 s)
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     YES
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000002000000000 s
  Pause time: 0.000000300000000 s
  Simul time: 0.000002000000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000001 . Turn ticking of this peripheral on/off (bool, RW)
# vcd[0] should be clocked (on) until we have exceeded the pause limit.
conf
Type of microcontroller: STM8 S,AF 208
Controller has 24 hardware element(s).
   on cpu[0]
   on simif[0]
   on vcd[0]
   on dreg[0]
   on dport[0]
   on clk[0]
   on uart[1]
   on uart[3]
   on itc[0]
   on pa[0]
   on pb[0]
   on pc[0]
   on pd[0]
   on pe[0]
   on pf[0]
   on pg[0]
   on ph[0]
   on pi[0]
  off rst[0]
   on tim1[1]
   on tim2[2]
   on tim3[3]
   on tim4[4]
   on flash[0]
set mem rom[0x100] 16
0x00100                      10 .
tick
conf
Type of microcontroller: STM8 S,AF 208
Controller has 24 hardware element(s).
   on cpu[0]
   on simif[0]
   on vcd[0]
   on dreg[0]
   on dport[0]
   on clk[0]
   on uart[1]
   on uart[3]
   on itc[0]
   on pa[0]
   on pb[0]
   on pc[0]
   on pd[0]
   on pe[0]
   on pf[0]
   on pg[0]
   on ph[0]
   on pi[0]
  off rst[0]
   on tim1[1]
   on tim2[2]
   on tim3[3]
   on tim4[4]
   on flash[0]
set mem rom[0x100] 17
0x00100                      11 .
tick
conf
Type of microcontroller: STM8 S,AF 208
Controller has 24 hardware element(s).
   on cpu[0]
   on simif[0]
   on vcd[0]
   on dreg[0]
   on dport[0]
   on clk[0]
   on uart[1]
   on uart[3]
   on itc[0]
   on pa[0]
   on pb[0]
   on pc[0]
   on pd[0]
   on pe[0]
   on pf[0]
   on pg[0]
   on ph[0]
   on pi[0]
  off rst[0]
   on tim1[1]
   on tim2[2]
   on tim3[3]
   on tim4[4]
   on flash[0]
set mem rom[0x100] 18
0x00100                      12 .
tick
conf
Type of microcontroller: STM8 S,AF 208
Controller has 24 hardware element(s).
   on cpu[0]
   on simif[0]
   on vcd[0]
   on dreg[0]
   on dport[0]
   on clk[0]
   on uart[1]
   on uart[3]
   on itc[0]
   on pa[0]
   on pb[0]
   on pc[0]
   on pd[0]
   on pe[0]
   on pf[0]
   on pg[0]
   on ph[0]
   on pi[0]
  off rst[0]
   on tim1[1]
   on tim2[2]
   on tim3[3]
   on tim4[4]
   on flash[0]
set mem rom[0x100] 19
0x00100                      13 .
tick
conf
Type of microcontroller: STM8 S,AF 208
Controller has 24 hardware element(s).
   on cpu[0]
   on simif[0]
   on vcd[0]
   on dreg[0]
   on dport[0]
   on clk[0]
   on uart[1]
   on uart[3]
   on itc[0]
   on pa[0]
   on pb[0]
   on pc[0]
   on pd[0]
   on pe[0]
   on pf[0]
   on pg[0]
   on ph[0]
   on pi[0]
  off rst[0]
   on tim1[1]
   on tim2[2]
   on tim3[3]
   on tim4[4]
   on flash[0]
set mem rom[0x100] 20
0x00100                      14 .
tick
set mem rom[0x100] 21
0x00100                      15 .
tick
set mem rom[0x100] 22
0x00100                      16 .
tick
set mem rom[0x100] 23
0x00100                      17 .
tick

# Resume again. The recorded gap is limited by the pausetime. Sadly there
# is no way to skip time in  VCD so the skipped interval is simply lost
# and the x (time) axis is as if it never happened. There are comments
# placed in the VCD but it's up to the viewer whether they are shown at all.
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     YES
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000002000000000 s
  Pause time: 0.000000300000000 s
  Simul time: 0.000003000000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000001 . Turn ticking of this peripheral on/off (bool, RW)
set hw vcd restart
Unpaused
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000700000000 s
  Last event: 0.000003000000000 s
  Pause time: 0.000000300000000 s
  Simul time: 0.000003000000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000001 . Turn ticking of this peripheral on/off (bool, RW)
set mem rom[0x100] 24
0x00100                      18 .
tick
set mem rom[0x100] 25
0x00100                      19 .
tick
set mem rom[0x100] 26
0x00100                      1a .
tick

# That's all folks!
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    YES
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000700000000 s
  Last event: 0.000003000000000 s
  Pause time: 0.000000300000000 s
  Simul time: 0.000003375000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000001 . Turn ticking of this peripheral on/off (bool, RW)
set hw vcd stop
info hw vcd
vcd[0] value change dump
  Module:      ucsim_vcd_0
  Started:    no
  Paused:     no
  Mode:       output
  Time scale: 1 ns
  Start time: 0.000000000000000 s
  Last event: 0.000000000000000 s
  Pause time: 0.000000300000000 s
  Simul time: 0.000003375000000 s
  Variables:
    Address           Symbol
    rom[0x00100]      
Configuration memory of vcd
0x00 00000000 . Turn ticking of this peripheral on/off (bool, RW)
