* .setbus / .sigbus: drive a whole bus from a list of values
.setbus cfg q2 q1 q0
.sigbus cfg    vhi=1 vlo=0 trise=1n tfall=1n thold=20n tdelay=10n base=bin pattern 000 111 010
.sigbus d<3:0> vhi=1 vlo=0 trise=1n tfall=1n thold=20n tdelay=10n base=hex pattern 0x0 0x7 0x5
rq2 q2 0 1k
rq1 q1 0 1k
rq0 q0 0 1k
rd3 d<3> 0 1k
rd2 d<2> 0 1k
rd1 d<1> 0 1k
rd0 d<0> 0 1k
.tran 20p 120n
.control
  run
  meas tran q2r  when 'v(q2)'=0.5 rise=1      $ 30n = tdelay + 1*thold
  meas tran q2f  when 'v(q2)'=0.5 fall=1      $ 50n
  let d3max = maximum('v(d<3>)')              $ 0: d<3> is the MSB, never set
  meas tran d1f  when 'v(d<1>)'=0.5 fall=1    $ 50n: 0x7 -> 0x5 clears bit 1
  print d3max
.endc
.end
