在我的 VLAB python 脚本中,我反复为 time_unit 和阻塞输入相同的参数:
# nothing for a while
write_port("pwm_0.period", 0)
run(200, "ns", blocking=True)
# start a waveform
write_port("pwm_0.period", 100)
# see it operate for 2 cycle)
run(230, "ns", blocking=True)
# change duty cycle
write_port("pwm_0.duty", 10)
run(200, "ns", blocking=True)
# change period
write_port("pwm_0.period", 50)
run(200, "ns", blocking=True)
有什么方法可以避免打字
"ns", blocking=True
每次打电话run()
?