From afef3e059fdbb48b62f6329b9ab6914563ee889a Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Tue, 12 Jan 2021 22:07:27 +0100 Subject: [PATCH] better handle simulation interruption --- src/hilight.c | 1 - xschem_library/xschem_simulator/logic_test.sch | 3 ++- xschem_library/xschem_simulator/simulate_ff.sch | 3 ++- xschem_library/xschem_simulator/switch_level_sim.sch | 9 +++------ 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/hilight.c b/src/hilight.c index 74b05ed1..7b658966 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -1231,7 +1231,6 @@ void logic_set(int value, int num) static int map[] = {LOGIC_0, LOGIC_1, LOGIC_X, LOGIC_Z}; struct hilight_hashentry *entry; - tclsetvar("tclstop", "0"); prepare_netlist_structs(0); if(!xctx->simdata.valid) create_simdata(); rebuild_selected_array(); diff --git a/xschem_library/xschem_simulator/logic_test.sch b/xschem_library/xschem_simulator/logic_test.sch index 54a0719b..5e306a6c 100644 --- a/xschem_library/xschem_simulator/logic_test.sch +++ b/xschem_library/xschem_simulator/logic_test.sch @@ -525,7 +525,8 @@ descr="START SIMULATION" comment=" This launcher Starts a simple interactive simulation of the LFSR " -tclcommand=" set count 0 +tclcommand=" set tclstop 0 ;# clear stop flag + set count 0 xschem select instance l23 ;# VSS xschem select instance p11 ;# CLEAR xschem select instance p8 ;# CLOCK diff --git a/xschem_library/xschem_simulator/simulate_ff.sch b/xschem_library/xschem_simulator/simulate_ff.sch index 646d24d6..7bb41809 100644 --- a/xschem_library/xschem_simulator/simulate_ff.sch +++ b/xschem_library/xschem_simulator/simulate_ff.sch @@ -334,7 +334,8 @@ descr="START SIMULATION" comment=" This launcher Starts a simple interactive simulation of the LFSR " -tclcommand=" set count 0 +tclcommand=" set tclstop 0 ;# clear stop flag + set count 0 set duration 1000 xschem select instance p8 ;# CLEAR_ xschem select instance p9 ;# CLK diff --git a/xschem_library/xschem_simulator/switch_level_sim.sch b/xschem_library/xschem_simulator/switch_level_sim.sch index f625dd85..1cd83853 100644 --- a/xschem_library/xschem_simulator/switch_level_sim.sch +++ b/xschem_library/xschem_simulator/switch_level_sim.sch @@ -339,7 +339,9 @@ descr="START SIMULATION" comment=" This launcher Starts a simple interactive simulation " -tclcommand=" set count 0 +tclcommand=" + set tclstop 0 ;# clear stop flag + set count 0 set duration 400 xschem select instance p20 ;# A xschem select instance p19 ;# B @@ -363,30 +365,25 @@ tclcommand=" set count 0 xschem select instance p20 clear after $duration - if \{$count>100 || $tclstop == 1\} break xschem select instance p19 xschem logic_set [expr int(rand()*2.)] xschem select instance p19 clear after $duration - if \{$count>100 || $tclstop == 1\} break xschem select instance p5 xschem logic_set [expr int(rand()*2.)] xschem select instance p5 clear after $duration - if \{$count>100 || $tclstop == 1\} break xschem select instance p69 xschem logic_set [expr int(rand()*2.)] xschem select instance p69 clear after $duration - if \{$count>100 || $tclstop == 1\} break xschem select instance p72 xschem logic_set [expr int(0.8 + rand()*1.2)] xschem select instance p72 clear after $duration - \} "