File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -57,3 +57,4 @@ OBJS += passes/cmds/abstract.o
5757OBJS += passes/cmds/test_select.o
5858OBJS += passes/cmds/timeest.o
5959OBJS += passes/cmds/linecoverage.o
60+ OBJS += passes/cmds/publish.o
Original file line number Diff line number Diff line change 1+ #include " kernel/register.h"
2+ #include " kernel/rtlil.h"
3+ #include " kernel/log.h"
4+
5+ USING_YOSYS_NAMESPACE
6+ PRIVATE_NAMESPACE_BEGIN
7+
8+ struct PublishPass : public Pass {
9+ private:
10+ static void publish (RTLIL::IdString& id) {
11+ if (id.begins_with (" $" )) {
12+ log_debug (" publishing %s\n " , id.c_str ());
13+ id = " \\ " + id.str ();
14+ log_debug (" published %s\n " , id.c_str ());
15+ }
16+ }
17+ public:
18+ PublishPass () : Pass(" publish" , " publish private cell types" ) { }
19+ void help () override
20+ {
21+ // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
22+ log (" \n " );
23+ log (" publish\n " );
24+ log (" Makes all module names and cell types public by prefixing\n " );
25+ log (" %% with \\ .\n " );
26+ }
27+ void execute (std::vector<std::string> args, RTLIL::Design *design) override
28+ {
29+ log_header (design, " Executing PUBLISH pass. (make cell types public)\n " );
30+ extra_args (args, 1 , design);
31+ for (auto & [name, mod] : design->modules_ ) {
32+ publish (name);
33+ publish (mod->name );
34+ for (auto * cell : mod->cells ())
35+ publish (cell->type );
36+ }
37+ }
38+ } PublishPass;
39+
40+ PRIVATE_NAMESPACE_END
You can’t perform that action at this time.
0 commit comments