Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,7 @@ MK_TEST_DIRS += tests/arch/xilinx
MK_TEST_DIRS += tests/bugpoint
MK_TEST_DIRS += tests/opt
MK_TEST_DIRS += tests/sat
MK_TEST_DIRS += tests/sdc
MK_TEST_DIRS += tests/sim
MK_TEST_DIRS += tests/svtypes
MK_TEST_DIRS += tests/techmap
Expand Down
4 changes: 2 additions & 2 deletions kernel/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ extern char yosys_path[PATH_MAX];
#endif
#ifdef YOSYS_ENABLE_TCL
namespace Yosys {
extern int yosys_tcl_iterp_init(Tcl_Interp *interp);
extern int yosys_tcl_interp_init(Tcl_Interp *interp);
extern void yosys_tcl_activate_repl();
};
#endif
Expand Down Expand Up @@ -605,7 +605,7 @@ int main(int argc, char **argv)
if (run_tcl_shell) {
#ifdef YOSYS_ENABLE_TCL
yosys_tcl_activate_repl();
Tcl_Main(argc, argv, yosys_tcl_iterp_init);
Tcl_Main(argc, argv, yosys_tcl_interp_init);
#else
log_error("Can't exectue TCL shell: this version of yosys is not built with TCL support enabled.\n");
#endif
Expand Down
2 changes: 1 addition & 1 deletion kernel/tclapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ static int tcl_set_param(ClientData, Tcl_Interp *interp, int objc, Tcl_Obj *cons
return TCL_OK;
}

int yosys_tcl_iterp_init(Tcl_Interp *interp)
int yosys_tcl_interp_init(Tcl_Interp *interp)
{
if (Tcl_Init(interp)!=TCL_OK)
log_warning("Tcl_Init() call failed - %s\n",Tcl_ErrnoMsg(Tcl_GetErrno()));
Expand Down
7 changes: 5 additions & 2 deletions kernel/yosys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ CellTypes yosys_celltypes;

#ifdef YOSYS_ENABLE_TCL
Tcl_Interp *yosys_tcl_interp = NULL;
Tcl_Interp *yosys_sdc_interp = NULL;
#endif

std::set<std::string> yosys_input_files, yosys_output_files;
Expand Down Expand Up @@ -368,17 +369,18 @@ void rewrite_filename(std::string &filename)
#ifdef YOSYS_ENABLE_TCL

// defined in tclapi.cc
extern int yosys_tcl_iterp_init(Tcl_Interp *interp);
extern int yosys_tcl_interp_init(Tcl_Interp *interp);

extern Tcl_Interp *yosys_get_tcl_interp()
{
if (yosys_tcl_interp == NULL) {
yosys_tcl_interp = Tcl_CreateInterp();
yosys_tcl_iterp_init(yosys_tcl_interp);
yosys_tcl_interp_init(yosys_tcl_interp);
}
return yosys_tcl_interp;
}

// Also see SdcPass
struct TclPass : public Pass {
TclPass() : Pass("tcl", "execute a TCL script file") { }
void help() override {
Expand Down Expand Up @@ -421,6 +423,7 @@ struct TclPass : public Pass {
Tcl_Release(interp);
}
} TclPass;

#endif

#if defined(__linux__) || defined(__CYGWIN__)
Expand Down
2 changes: 2 additions & 0 deletions passes/cmds/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ OBJS += passes/cmds/abstract.o
OBJS += passes/cmds/test_select.o
OBJS += passes/cmds/timeest.o
OBJS += passes/cmds/linecoverage.o

include $(YOSYS_SRC)/passes/cmds/sdc/Makefile.inc
3 changes: 3 additions & 0 deletions passes/cmds/sdc/Makefile.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OBJS += passes/cmds/sdc/sdc.o

$(eval $(call add_share_file,share/sdc,passes/cmds/sdc/graph-stubs.sdc))
42 changes: 42 additions & 0 deletions passes/cmds/sdc/graph-stubs.sdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
proc unknown {args} {
# Check if it's a getter
if {[llength $args] > 0} {
set first_arg [lindex $args 0]
if {[string match "get_*" $first_arg]} {
# It's a getter, has it been redirected from specialized C++ code?
if {[llength $args] > 1} {
set second_arg [lindex $args 1]
if {$second_arg ne "-getter-validated"} {
error "Unknown getter: $first_arg"
}
} else {
error "Unknown getter: $first_arg"
}
}
}
# TODO this safety feature could be optional via a global

global sdc_call_index
global sdc_calls
if {![info exists sdc_call_index]} {
set sdc_call_index 0
}
if {![info exists sdc_calls]} {
set sdc_calls {}
}
set ret "YOSYS_SDC_MAGIC_NODE_$sdc_call_index"
incr sdc_call_index
lappend sdc_calls $args
# puts "unknown $args, returning YOSYS_SDC_MAGIC_NODE_$sdc_call_index"
return $ret
}
proc list {args} {
return [unknown "list" {*}$args]
}
proc get_clocks {args} {
# get_clocks isn't a design object getter
# because clocks aren't design objects, just aliases
# so the referred to clock pin already are being tracked
# as arguments of uninterpreted create_clock command or similar
return [unknown "get_clocks" "-getter-validated" {*}$args]
}
Loading
Loading