From 21492914a29a8cbd9ccae6ad275c9ee2f1d98957 Mon Sep 17 00:00:00 2001
From: Sahand Kashani <sahand.kashani@gmail.com>
Date: Sat, 21 Mar 2020 15:57:53 +0100
Subject: [PATCH] Strip quotes around fileinfo strings

Yosys puts quotes around the string that represents the fileinfo whereas
firrtl does not. So when firrtl sees quotes, it escapes them with an extra
backslash which makes it hard to read afterwards.
---
 backends/firrtl/firrtl.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/backends/firrtl/firrtl.cc b/backends/firrtl/firrtl.cc
index 7d2da7b00..a6cb9cfbe 100644
--- a/backends/firrtl/firrtl.cc
+++ b/backends/firrtl/firrtl.cc
@@ -106,7 +106,11 @@ std::string getFileinfo(dict<RTLIL::IdString, RTLIL::Const> attributes)
 			fileinfo << "]";
 		}
 	}
-	return fileinfo.str();
+
+  std::string fileinfo_str = fileinfo.str();
+  fileinfo_str.erase(std::remove(fileinfo_str.begin(), fileinfo_str.end(), '\"'), fileinfo_str.end());
+
+  return fileinfo_str;
 }
 
 // Get a port direction with respect to a specific module.