xschem simulate sets the Simulate button color. removed redundant proc simulate_button
This commit is contained in:
parent
bd43be9be6
commit
7022fbf073
|
|
@ -149,9 +149,9 @@ const char *expandlabel(const char *s, int *m)
|
|||
Lexical analyzer
|
||||
*/
|
||||
|
||||
%x index
|
||||
%x trailer
|
||||
%x mult
|
||||
%x parse_index
|
||||
%x parse_trailer
|
||||
%x parse_mult
|
||||
|
||||
SP [ \t\n]*
|
||||
NOTSP [^ \t\n]
|
||||
|
|
@ -181,13 +181,13 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
%%
|
||||
/* this action resets initial condition at start of line. This is extremely useful if previously lexer
|
||||
* bailed out in the middle of some non INITIAL start condition due to yyparse() syntax errors */
|
||||
<mult,index>^. {
|
||||
<parse_mult,parse_index>^. {
|
||||
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): matched: ^[^*] |%s|, push back\n",yytext);
|
||||
yyless(0); /* push entire token back to input */
|
||||
BEGIN(INITIAL); /* reset parser */
|
||||
}
|
||||
|
||||
<mult>{
|
||||
<parse_mult>{
|
||||
/* postfix multiplier */
|
||||
{INT} {
|
||||
sscanf(yytext, "%d",&yylval.val);
|
||||
|
|
@ -195,11 +195,11 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
BEGIN(INITIAL);
|
||||
return B_NUM;
|
||||
}
|
||||
} /* end <mult> */
|
||||
} /* end <parse_mult> */
|
||||
|
||||
|
||||
|
||||
<trailer>{
|
||||
<parse_trailer>{
|
||||
/* recognize characters after a bus label: AA[33:31]_xx --> _xx */
|
||||
{IDX_ID_N} {
|
||||
yylval.ptr.str=NULL;/*19102004 */
|
||||
|
|
@ -211,7 +211,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
}
|
||||
|
||||
/* node indexes: "3:2" "5:1:2" "5..1" "7..1..2" "b:a" "c:b:a" .... */
|
||||
<index>{
|
||||
<parse_index>{
|
||||
{INT} {
|
||||
sscanf(yytext, "%d",&yylval.val);
|
||||
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_IDXNUM: |%s|\n", yytext);
|
||||
|
|
@ -226,7 +226,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
\]/[^*,)] {
|
||||
|
||||
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): close bracket2: %s\n", yytext);
|
||||
BEGIN(trailer);
|
||||
BEGIN(parse_trailer);
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME1: |%s|\n", yytext);
|
||||
return B_NAME;
|
||||
}
|
||||
} /* end <index> */
|
||||
} /* end <parse_index> */
|
||||
|
||||
/* a comment, return as LINE token */
|
||||
^\*.* {
|
||||
|
|
@ -309,7 +309,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
/* start vector node index: "aa[" */
|
||||
\[ {
|
||||
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): open bracket: %s\n", yytext);
|
||||
BEGIN(index);
|
||||
BEGIN(parse_index);
|
||||
return yytext[0];
|
||||
}
|
||||
/* "*(aa,bb,cc)" or "*aaa" prefix multiplication*/
|
||||
|
|
@ -321,7 +321,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
|
|||
/* "*16" postfix multiplication */
|
||||
{MULTIP}/{INT} {
|
||||
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): post *: |%s|\n", yytext);
|
||||
BEGIN(mult);
|
||||
BEGIN(parse_mult);
|
||||
return '*';
|
||||
}
|
||||
{NOTSP} {
|
||||
|
|
|
|||
|
|
@ -700,6 +700,7 @@ void hash_names(int inst, int action)
|
|||
* (name = old_basename + q + bracket)
|
||||
* or -1 if only testing for unique 'name'.
|
||||
*/
|
||||
|
||||
static int name_is_used(char *name, const char *old_basename, const char *brkt, int q)
|
||||
{
|
||||
int xmult, used = -1;
|
||||
|
|
|
|||
|
|
@ -267,7 +267,9 @@ proc execute_fileevent {id} {
|
|||
if {$report} {viewdata "Completed: $execute(cmd,$id)\ndata:\n$execute(data,$id)"}
|
||||
}
|
||||
if {[info exists execute(callback,$id)] && $execute(callback,$id) ne {}} {
|
||||
uplevel #0 "eval $execute(callback,$id)"
|
||||
puts $execute(callback,$id)
|
||||
uplevel #0 eval $execute(callback,$id)
|
||||
|
||||
}
|
||||
catch {unset execute(callback,$id)}
|
||||
set execute(cmd,last) $execute(cmd,$id)
|
||||
|
|
@ -604,6 +606,9 @@ proc ev {s} {
|
|||
return $s
|
||||
}
|
||||
}
|
||||
|
||||
# should not be called directly by user
|
||||
# does netlist post processing, called from global_(spice|vhdl|verilog)_netlist()
|
||||
proc netlist {source_file show netlist_file} {
|
||||
global XSCHEM_SHAREDIR flat_netlist netlist_dir
|
||||
global verilog_2001 debug_var OS verilog_bitblast
|
||||
|
|
@ -1685,6 +1690,7 @@ proc simulate {{callback {}}} {
|
|||
global netlist_dir terminal sim env
|
||||
global execute XSCHEM_SHAREDIR has_x OS
|
||||
|
||||
set button_path [xschem get top_path].menubar.simulate
|
||||
simuldir
|
||||
set_sim_defaults
|
||||
set netlist_type [xschem get netlist_type]
|
||||
|
|
@ -1720,16 +1726,24 @@ proc simulate {{callback {}}} {
|
|||
set cmd [subst -nobackslashes $sim($tool,$def,cmd)]
|
||||
set save [pwd]
|
||||
cd $netlist_dir
|
||||
$button_path configure -bg red
|
||||
set tctx::[xschem get current_win_path]_simulate 1
|
||||
if {$OS == "Windows"} {
|
||||
# $cmd cannot be surrounded by {} as exec will change forward slash to backward slash
|
||||
clear_simulate_button $button_path tctx::[xschem get current_win_path]_simulate
|
||||
if { $callback ne {} } {
|
||||
uplevel #0 "eval $callback"
|
||||
uplevel #0 {
|
||||
eval $callback
|
||||
}
|
||||
}
|
||||
#eval exec {cmd /V /C "cd $netlist_dir&&$cmd}
|
||||
eval exec $cmd &
|
||||
set id 0
|
||||
} else {
|
||||
set execute(callback) $callback
|
||||
set execute(callback) "
|
||||
clear_simulate_button $button_path tctx::[xschem get current_win_path]_simulate
|
||||
$callback
|
||||
"
|
||||
# puts $cmd
|
||||
set id [eval $fg $st $cmd]
|
||||
puts "Simulation started: execution ID: $id"
|
||||
|
|
@ -6308,25 +6322,6 @@ proc housekeeping_ctx {} {
|
|||
.statusbar.7 configure -text $netlist_type
|
||||
}
|
||||
|
||||
proc simulate_button {button_path} {
|
||||
global simulate_bg
|
||||
if { ![info exists tctx::[xschem get current_win_path]_simulate] } {
|
||||
set tctx::[xschem get current_win_path]_simulate 1
|
||||
$button_path configure -bg red
|
||||
if {[catch {
|
||||
simulate "clear_simulate_button $button_path tctx::[xschem get current_win_path]_simulate"
|
||||
} err ]} {
|
||||
puts {Error running simulation procedure}
|
||||
alert_ {Error running simulation procedure}
|
||||
clear_simulate_button $button_path tctx::[xschem get current_win_path]_simulate
|
||||
}
|
||||
if {$err == -1} {
|
||||
puts {Error: simulate procedure returned error code -1}
|
||||
alert_ {Error: simulate procedure returned error code -1}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc clear_simulate_button {button_path simvar} {
|
||||
global simulate_bg
|
||||
if { "tctx::[xschem get current_win_path]_simulate" eq $simvar } {
|
||||
|
|
@ -6774,13 +6769,16 @@ proc build_widgets { {topwin {} } } {
|
|||
toolbar_add EditPushSym "xschem descend_symbol" "Push symbol" $topwin
|
||||
$topwin.menubar.edit.menu add command -label "Pop" -command "xschem go_back" -accelerator Ctrl+E
|
||||
toolbar_add EditPop "xschem go_back" "Pop" $topwin
|
||||
|
||||
# eval is needed here to expand $bbg before evaluating 'button'
|
||||
eval button $topwin.menubar.waves -text "Waves" -activebackground red -takefocus 0 \
|
||||
-padx 2 -pady 0 -command waves $bbg
|
||||
eval button $topwin.menubar.simulate -text "Simulate" -activebackground red -takefocus 0 \
|
||||
-padx 2 -pady 0 -command \{simulate_button $topwin.menubar.simulate\} $bbg
|
||||
-padx 2 -pady 0 -command simulate $bbg
|
||||
set simulate_bg [$topwin.menubar.simulate cget -bg]
|
||||
eval button $topwin.menubar.netlist -text "Netlist" -activebackground red -takefocus 0 \
|
||||
-padx 2 -pady 0 -command \{xschem netlist -erc\} $bbg
|
||||
|
||||
# create $topwin.menubar.layers.menu
|
||||
create_layers_menu $topwin
|
||||
$topwin.menubar.view.menu add command -label "Redraw" -command "xschem redraw" -accelerator Esc
|
||||
|
|
@ -7096,7 +7094,7 @@ tclcommand=\"xschem raw_read \$netlist_dir/[file tail [file rootname [xschem get
|
|||
-command {xschem redraw}
|
||||
|
||||
toolbar_add Netlist { xschem netlist -erc } "Create netlist" $topwin
|
||||
toolbar_add Simulate "simulate_button $topwin.menubar.simulate" "Run simulation" $topwin
|
||||
toolbar_add Simulate "simulate" "Run simulation" $topwin
|
||||
toolbar_add Waves { waves } "View results" $topwin
|
||||
|
||||
pack $topwin.menubar.file -side left
|
||||
|
|
|
|||
Loading…
Reference in New Issue