From b94db546645e624b752203a4c4d2395dc84dff0c Mon Sep 17 00:00:00 2001
From: Eddie Hung <eddieh@ece.ubc.ca>
Date: Mon, 18 Mar 2019 13:35:54 -0700
Subject: [PATCH] shiftx NULL pointer check

---
 passes/techmap/shregmap.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/passes/techmap/shregmap.cc b/passes/techmap/shregmap.cc
index 179a331fd..f3153b400 100644
--- a/passes/techmap/shregmap.cc
+++ b/passes/techmap/shregmap.cc
@@ -165,15 +165,17 @@ struct ShregmapTechXilinx7 : ShregmapTech
 			}
 		}
 
-		// Cannot implement variable-length shift registers
-		// greater than 128 since Q31 cannot be output onto
-		// fabric
-		if (shiftx && GetSize(taps) > 128)
-			return false;
+		if (shiftx) {
+			// Cannot implement variable-length shift registers
+			// greater than 128 since Q31 cannot be output onto
+			// fabric
+			if (GetSize(taps) > 128)
+				return false;
 
-		// Only map if $shiftx exclusively covers the shift register
-		if (GetSize(taps) != shiftx->getParam("\\A_WIDTH").as_int())
-			return false;
+			// Only map if $shiftx exclusively covers the shift register
+			if (GetSize(taps) != shiftx->getParam("\\A_WIDTH").as_int())
+				return false;
+		}
 
 		return true;
 	}