From 331f8b8d0ba2c11aac89f15622b23a0284c538d7 Mon Sep 17 00:00:00 2001
From: Clifford Wolf <clifford@clifford.at>
Date: Wed, 25 Feb 2015 23:01:42 +0100
Subject: [PATCH] Bugfix in iopadmap

---
 passes/techmap/iopadmap.cc | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/passes/techmap/iopadmap.cc b/passes/techmap/iopadmap.cc
index 75d02c828..3fba0e618 100644
--- a/passes/techmap/iopadmap.cc
+++ b/passes/techmap/iopadmap.cc
@@ -114,18 +114,11 @@ struct IopadmapPass : public Pass {
 		}
 		extra_args(args, argidx, design);
 
-		for (auto &it : design->modules_)
+		for (auto module : design->selected_modules())
 		{
-			RTLIL::Module *module = it.second;
-
-			if (!design->selected(module) || module->get_bool_attribute("\\blackbox"))
-				continue;
-
-			for (auto &it2 : module->wires_)
+			for (auto wire : module->selected_wires())
 			{
-				RTLIL::Wire *wire = it2.second;
-
-				if (!wire->port_id || !design->selected(module, wire))
+				if (!wire->port_id)
 					continue;
 
 				std::string celltype, portname, portname2;