Skip to content

Commit 8179ba1

Browse files
committed
icell_liberty: refactor and add help
1 parent b2ed772 commit 8179ba1

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

passes/cmds/icell_liberty.cc

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ struct LibertyStubber {
112112
auto next_state = ffType.has_ce ? "D & EN" : "D";
113113
i.item("next_state", next_state);
114114
f << "\t\t}\n";
115-
116-
117-
// bool has_aload;
118-
// bool has_srst;
119-
// bool has_arst;
120-
// bool has_sr;
121115
f << "\t}\n";
122116
}
123117
void liberty_cell(Module* base, Module* derived, std::ostream& f)
@@ -157,8 +151,11 @@ struct IcellLiberty : Pass {
157151
{
158152
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
159153
log("\n");
160-
log(" icell_liberty <liberty_file>\n"); // TODO
154+
log(" icell_liberty <liberty_file>\n");
161155
log("\n");
156+
log("Write Liberty files modeling the interfaces of used internal cells.\n");
157+
log("\n");
158+
log("Models are not guaranteed to be logically sound.\n");
162159
log("\n");
163160
}
164161
void execute(std::vector<std::string> args, RTLIL::Design *d) override
@@ -168,23 +165,20 @@ struct IcellLiberty : Pass {
168165
size_t argidx;
169166
IdString naming_attr;
170167
std::string liberty_filename;
171-
std::ofstream* liberty_file = new std::ofstream;
168+
auto liberty_file = std::make_unique<std::ofstream>();
172169

173170
for (argidx = 1; argidx < args.size(); argidx++) {
174171
break;
175172
}
176173
if (argidx < args.size())
177174
liberty_filename = args[argidx++];
178175
else
179-
log_error("no Liberty filename specified\n");
180-
181-
// extra_args(args, argidx, d);
176+
log_cmd_error("no Liberty filename specified\n");
182177

183178
if (liberty_filename.size()) {
184179
liberty_file->open(liberty_filename.c_str());
185180
if (liberty_file->fail()) {
186-
delete liberty_file;
187-
log_error("Can't open file `%s' for writing: %s\n", liberty_filename.c_str(), strerror(errno));
181+
log_cmd_error("Can't open file `%s' for writing: %s\n", liberty_filename.c_str(), strerror(errno));
188182
}
189183
}
190184

@@ -209,7 +203,6 @@ struct IcellLiberty : Pass {
209203

210204
if (liberty_file) {
211205
stubber.liberty_suffix(*liberty_file);
212-
delete liberty_file;
213206
}
214207
}
215208
} IcellLiberty;

0 commit comments

Comments
 (0)