kernel/sdc: WIP command parsing for set_false_path

This commit is contained in:
Rowan Goemans 2024-08-12 15:32:22 +02:00
parent 3e263f223c
commit 7425635934

View File

@ -233,6 +233,8 @@ struct SDCParser
return cmd_get_pins(arguments);
else if (cmd == "create_clock")
return cmd_create_clock(arguments);
else if (cmd == "set_false_path")
return cmd_set_false_path(arguments);
else
log_error("Unsupported SDC command '%s'\n", cmd.c_str());
}
@ -372,6 +374,44 @@ struct SDCParser
return std::string{};
}
TclValue cmd_set_false_path(const std::vector<TclValue> &arguments)
{
std::optional<TclValue &> from, to;
for (int i = 1; i < int(arguments.size()); i++) {
auto &arg = arguments.at(i);
if (arg.is_string) {
std::string s = arg.str;
auto &target = from;
if (s == "-to") {
target = to;
} else if (s != "-from") {
log_error("expecting either -to or -from to set_false_path(line %d)\n", lineno);
}
i++;
auto &val = arguments.at(i);
if (val.is_string) {
log_error("expecting TclValue argument to -from (line %d)\n", lineno);
}
for (const auto &ety : val.list) {
NetInfo *net = nullptr;
if (ety.type == TclEntity::ENTITY_PIN)
net = ety.get_net(ctx);
else if (ety.type == TclEntity::ENTITY_NET)
net = ctx->nets.at(ety.name).get();
else if (ety.type == TclEntity::ENTITY_PORT)
net = ctx->ports.at(ety.name).net;
else
log_error("set_false_path applies only to cells, cell pins, or IO ports (line %d)\n", lineno);
}
}
}
return std::string{};
}
void operator()()
{
while (!eof()) {