[yosys] 13/38: Added "select -read"

Ruben Undheim rubund-guest at moszumanska.debian.org
Mon Feb 9 19:36:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to tag upstream/0.5.0
in repository yosys.

commit d5e30978e97f6e23eacad91766d862a7b8ea8879
Author: Clifford Wolf <clifford at clifford.at>
Date:   Fri Feb 6 10:01:22 2015 +0100

    Added "select -read"
---
 passes/cmds/select.cc | 44 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 5 deletions(-)

diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc
index 35be45c..187db2a 100644
--- a/passes/cmds/select.cc
+++ b/passes/cmds/select.cc
@@ -832,8 +832,8 @@ struct SelectPass : public Pass {
 	{
 		//   |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
 		log("\n");
-		log("    select [ -add | -del | -set <name> ] <selection>\n");
-		log("    select [ -assert-none | -assert-any ] <selection>\n");
+		log("    select [ -add | -del | -set <name> ] {-read <filename> | <selection>}\n");
+		log("    select [ -assert-none | -assert-any ] {-read <filename> | <selection>}\n");
 		log("    select [ -list | -write <filename> | -count | -clear ]\n");
 		log("    select -module <modname>\n");
 		log("\n");
@@ -875,6 +875,9 @@ struct SelectPass : public Pass {
 		log("    -write <filename>\n");
 		log("        like -list but write the output to the specified file\n");
 		log("\n");
+		log("    -read <filename>\n");
+		log("        read the specified file (written by -write)\n");
+		log("\n");
 		log("    -count\n");
 		log("        count all objects in the current selection\n");
 		log("\n");
@@ -1034,9 +1037,8 @@ struct SelectPass : public Pass {
 		bool assert_none = false;
 		bool assert_any = false;
 		int assert_count = -1;
-		std::string write_file;
-		std::string set_name;
-		std::string sel_str;
+		std::string write_file, read_file;
+		std::string set_name, sel_str;
 
 		work_stack.clear();
 
@@ -1080,6 +1082,10 @@ struct SelectPass : public Pass {
 				write_file = args[++argidx];
 				continue;
 			}
+			if (arg == "-read" && argidx+1 < args.size()) {
+				read_file = args[++argidx];
+				continue;
+			}
 			if (arg == "-count") {
 				count_mode = true;
 				continue;
@@ -1102,6 +1108,34 @@ struct SelectPass : public Pass {
 			sel_str += " " + arg;
 		}
 
+		if (!read_file.empty())
+		{
+			if (!sel_str.empty())
+				log_cmd_error("Option -read can not be combined with a selection expression.\n");
+
+			std::ifstream f(read_file);
+			if (f.fail())
+				log_error("Can't open '%s' for reading: %s\n", read_file.c_str(), strerror(errno));
+
+			RTLIL::Selection sel(false);
+			string line;
+
+			while (std::getline(f, line)) {
+				size_t slash_pos = line.find('/');
+				if (slash_pos == string::npos) {
+					log_warning("Ignoring line without slash in 'select -read': %s\n", line.c_str());
+					continue;
+				}
+				IdString mod_name = RTLIL::escape_id(line.substr(0, slash_pos));
+				IdString obj_name = RTLIL::escape_id(line.substr(slash_pos+1));
+				sel.selected_members[mod_name].insert(obj_name);
+			}
+
+			select_filter_active_mod(design, sel);
+			sel.optimize(design);
+			work_stack.push_back(sel);
+		}
+
 		if (clear_mode && args.size() != 2)
 			log_cmd_error("Option -clear can not be combined with any other options.\n");
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/yosys.git



More information about the debian-science-commits mailing list