From a9b6543361ba35202cbe6c6c16860c3e8a388bc4 Mon Sep 17 00:00:00 2001
From: Clifford Wolf <clifford@clifford.at>
Date: Wed, 8 Aug 2018 00:06:03 +0200
Subject: Add Region struct

Signed-off-by: Clifford Wolf <clifford@clifford.at>
---
 common/nextpnr.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/common/nextpnr.h b/common/nextpnr.h
index e588f47b..28c144ac 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -216,6 +216,13 @@ struct BelPin
 
 struct CellInfo;
 
+struct Region
+{
+    IdString name;
+    std::unordered_set<BelId> bels;
+    std::unordered_set<WireId> wires;
+};
+
 enum PlaceStrength
 {
     STRENGTH_NONE = 0,
@@ -250,6 +257,8 @@ struct NetInfo : ArchNetInfo
 
     // wire -> uphill_pip
     std::unordered_map<WireId, PipMap> wires;
+
+    Region *region = nullptr;
 };
 
 enum PortType
@@ -289,6 +298,8 @@ struct CellInfo : ArchCellInfo
     int constr_z = UNCONSTR;   // this.z - parent.z
     bool constr_abs_z = false; // parent.z := 0
     // parent.[xyz] := 0 when (constr_parent == nullptr)
+
+    Region *region = nullptr;
 };
 
 enum TimingPortClass
@@ -391,6 +402,9 @@ struct BaseCtx
     std::unordered_map<IdString, std::unique_ptr<NetInfo>> nets;
     std::unordered_map<IdString, std::unique_ptr<CellInfo>> cells;
 
+    // Floorplanning regions
+    std::unordered_map<IdString, std::unique_ptr<Region>> region;
+
     BaseCtx()
     {
         idstring_str_to_idx = new std::unordered_map<std::string, int>;
-- 
cgit v1.2.3


From 5ddde5c49ffaf6c2f827e9805caac0b7dd43f4a0 Mon Sep 17 00:00:00 2001
From: Clifford Wolf <clifford@clifford.at>
Date: Wed, 8 Aug 2018 10:27:08 +0200
Subject: Add pip locations

Signed-off-by: Clifford Wolf <clifford@clifford.at>
---
 common/archcheck.cc    |  4 ++--
 common/nextpnr.h       |  6 ++++++
 common/place_common.cc |  4 ++--
 docs/archapi.md        | 19 ++++++++++++++-----
 generic/arch.cc        | 25 +++++++++++++++++++------
 generic/arch.h         | 10 +++++++---
 ice40/arch.h           | 12 +++++++++++-
 7 files changed, 61 insertions(+), 19 deletions(-)

diff --git a/common/archcheck.cc b/common/archcheck.cc
index 5059066d..3d9e4e76 100644
--- a/common/archcheck.cc
+++ b/common/archcheck.cc
@@ -75,7 +75,7 @@ void archcheck_locs(const Context *ctx)
         log_assert(0 <= loc.z);
         log_assert(loc.x < ctx->getGridDimX());
         log_assert(loc.y < ctx->getGridDimY());
-        log_assert(loc.z < ctx->getTileDimZ(loc.x, loc.y));
+        log_assert(loc.z < ctx->getTileBelDimZ(loc.x, loc.y));
 
         BelId bel2 = ctx->getBelByLocation(loc);
         dbg("   ... %s\n", ctx->getBelName(bel2).c_str(ctx));
@@ -88,7 +88,7 @@ void archcheck_locs(const Context *ctx)
             dbg("> %d %d\n", x, y);
             std::unordered_set<int> usedz;
 
-            for (int z = 0; z < ctx->getTileDimZ(x, y); z++) {
+            for (int z = 0; z < ctx->getTileBelDimZ(x, y); z++) {
                 BelId bel = ctx->getBelByLocation(Loc(x, y, z));
                 if (bel == BelId())
                     continue;
diff --git a/common/nextpnr.h b/common/nextpnr.h
index 28c144ac..29a85a10 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -219,8 +219,14 @@ struct CellInfo;
 struct Region
 {
     IdString name;
+
+    bool constr_bels = false;
+    bool constr_wires = false;
+    bool constr_pips = false;
+
     std::unordered_set<BelId> bels;
     std::unordered_set<WireId> wires;
+    std::unordered_set<Loc> piplocs;
 };
 
 enum PlaceStrength
diff --git a/common/place_common.cc b/common/place_common.cc
index f9867057..5cdb96ef 100644
--- a/common/place_common.cc
+++ b/common/place_common.cc
@@ -251,7 +251,7 @@ class ConstraintLegaliseWorker
                 ySearch = IncreasingDiameterSearch(loc.y + child->constr_y);
             }
             if (child->constr_z == child->UNCONSTR) {
-                zSearch = IncreasingDiameterSearch(loc.z, 0, ctx->getTileDimZ(loc.x, loc.y));
+                zSearch = IncreasingDiameterSearch(loc.z, 0, ctx->getTileBelDimZ(loc.x, loc.y));
             } else {
                 if (child->constr_abs_z) {
                     zSearch = IncreasingDiameterSearch(child->constr_z);
@@ -329,7 +329,7 @@ class ConstraintLegaliseWorker
                 yRootSearch = IncreasingDiameterSearch(cell->constr_y);
 
             if (cell->constr_z == cell->UNCONSTR)
-                zRootSearch = IncreasingDiameterSearch(currentLoc.z, 0, ctx->getTileDimZ(currentLoc.x, currentLoc.y));
+                zRootSearch = IncreasingDiameterSearch(currentLoc.z, 0, ctx->getTileBelDimZ(currentLoc.x, currentLoc.y));
             else
                 zRootSearch = IncreasingDiameterSearch(cell->constr_z);
             while (!xRootSearch.done()) {
diff --git a/docs/archapi.md b/docs/archapi.md
index df2bc468..473cdd2e 100644
--- a/docs/archapi.md
+++ b/docs/archapi.md
@@ -74,15 +74,19 @@ Return a string representation of the ArchArgs that was used to construct this o
 
 ### int getGridDimX() const
 
-Get grid X dimension. All bels must have Y coordinates in the range `0 .. getGridDimX()-1` (inclusive).
+Get grid X dimension. All bels and pips must have Y coordinates in the range `0 .. getGridDimX()-1` (inclusive).
 
 ### int getGridDimY() const
 
-Get grid Y dimension. All bels must have Y coordinates in the range `0 .. getGridDimY()-1` (inclusive).
+Get grid Y dimension. All bels and pips must have Y coordinates in the range `0 .. getGridDimY()-1` (inclusive).
 
-### int getTileDimZ(int x, int y) const
+### int getTileBelDimZ(int x, int y) const
 
-Get Z dimension for the specified tile. All bels with the specified X and Y coordinates must have a Z coordinate in the range `0 .. getTileDimZ(X,Y)-1` (inclusive).
+Get Z dimension for the specified tile for bels. All bels with at specified X and Y coordinates must have a Z coordinate in the range `0 .. getTileDimZ(X,Y)-1` (inclusive).
+
+### int getTilePipDimZ(int x, int y) const
+
+Get Z dimension for the specified tile for pips. All pips with at specified X and Y coordinates must have a Z coordinate in the range `0 .. getTileDimZ(X,Y)-1` (inclusive).
 
 Bel Methods
 -----------
@@ -97,7 +101,7 @@ Get the name for a bel. (Bel names must be unique.)
 
 ### Loc getBelLocation(BelId bel) const
 
-Get the X/Y/Z location of a given bel.
+Get the X/Y/Z location of a given bel. Each bel must have a unique X/Y/Z location.
 
 ### BelId getBelByLocation(Loc loc) const
 
@@ -238,6 +242,11 @@ Get the name for a pip. (Pip names must be unique.)
 Get the type of a pip. Pip types are purely informal and
 implementations may simply return `IdString()`.
 
+### Loc getPipLocation(PipId pip) const
+
+Get the X/Y/Z location of a given pip. Pip locations do not need to be unique, and in most cases they aren't. So
+for pips a X/Y/Z location refers to a group of pips, not an individual pip.
+
 ### uint32\_t getPipChecksum(PipId pip) const
 
 Return a (preferably unique) number that represents this pip. This is used in design state checksum calculations.
diff --git a/generic/arch.cc b/generic/arch.cc
index 4e25b2c8..d306a9ec 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -36,7 +36,7 @@ void Arch::addWire(IdString name, IdString type, int x, int y)
     wire_ids.push_back(name);
 }
 
-void Arch::addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay)
+void Arch::addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay, Loc loc)
 {
     NPNR_ASSERT(pips.count(name) == 0);
     PipInfo &pi = pips[name];
@@ -45,10 +45,21 @@ void Arch::addPip(IdString name, IdString type, IdString srcWire, IdString dstWi
     pi.srcWire = srcWire;
     pi.dstWire = dstWire;
     pi.delay = delay;
+    pi.loc = loc;
 
     wires.at(srcWire).downhill.push_back(name);
     wires.at(dstWire).uphill.push_back(name);
     pip_ids.push_back(name);
+
+    if (int(tilePipDimZ.size()) <= loc.x)
+        tilePipDimZ.resize(loc.x + 1);
+
+    if (int(tilePipDimZ[loc.x].size()) <= loc.y)
+        tilePipDimZ[loc.x].resize(loc.y + 1);
+
+    gridDimX = std::max(gridDimX, loc.x + 1);
+    gridDimY = std::max(gridDimY, loc.x + 1);
+    tilePipDimZ[loc.x][loc.y] = std::max(tilePipDimZ[loc.x][loc.y], loc.z + 1);
 }
 
 void Arch::addAlias(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay)
@@ -88,15 +99,15 @@ void Arch::addBel(IdString name, IdString type, Loc loc, bool gb)
 
     bels_by_tile[loc.x][loc.y].push_back(name);
 
-    if (int(tileDimZ.size()) <= loc.x)
-        tileDimZ.resize(loc.x + 1);
+    if (int(tileBelDimZ.size()) <= loc.x)
+        tileBelDimZ.resize(loc.x + 1);
 
-    if (int(tileDimZ[loc.x].size()) <= loc.y)
-        tileDimZ[loc.x].resize(loc.y + 1);
+    if (int(tileBelDimZ[loc.x].size()) <= loc.y)
+        tileBelDimZ[loc.x].resize(loc.y + 1);
 
     gridDimX = std::max(gridDimX, loc.x + 1);
     gridDimY = std::max(gridDimY, loc.x + 1);
-    tileDimZ[loc.x][loc.y] = std::max(tileDimZ[loc.x][loc.y], loc.z + 1);
+    tileBelDimZ[loc.x][loc.y] = std::max(tileBelDimZ[loc.x][loc.y], loc.z + 1);
 }
 
 void Arch::addBelInput(IdString bel, IdString name, IdString wire)
@@ -352,6 +363,8 @@ NetInfo *Arch::getConflictingPipNet(PipId pip) const { return pips.at(pip).bound
 
 const std::vector<PipId> &Arch::getPips() const { return pip_ids; }
 
+Loc Arch::getPipLocation(PipId pip) const { return pips.at(pip).loc; }
+
 WireId Arch::getPipSrcWire(PipId pip) const { return pips.at(pip).srcWire; }
 
 WireId Arch::getPipDstWire(PipId pip) const { return pips.at(pip).dstWire; }
diff --git a/generic/arch.h b/generic/arch.h
index ee7d0403..7549a75b 100644
--- a/generic/arch.h
+++ b/generic/arch.h
@@ -36,6 +36,7 @@ struct PipInfo
     WireId srcWire, dstWire;
     DelayInfo delay;
     DecalXY decalxy;
+    Loc loc;
 };
 
 struct WireInfo
@@ -94,12 +95,13 @@ struct Arch : BaseCtx
     std::unordered_map<DecalId, std::vector<GraphicElement>> decal_graphics;
 
     int gridDimX, gridDimY;
-    std::vector<std::vector<int>> tileDimZ;
+    std::vector<std::vector<int>> tileBelDimZ;
+    std::vector<std::vector<int>> tilePipDimZ;
 
     float grid_distance_to_delay;
 
     void addWire(IdString name, IdString type, int x, int y);
-    void addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay);
+    void addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay, Loc loc);
     void addAlias(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayInfo delay);
 
     void addBel(IdString name, IdString type, Loc loc, bool gb);
@@ -132,7 +134,8 @@ struct Arch : BaseCtx
 
     int getGridDimX() const { return gridDimX; }
     int getGridDimY() const { return gridDimY; }
-    int getTileDimZ(int x, int y) const { return tileDimZ[x][y]; }
+    int getTileBelDimZ(int x, int y) const { return tileBelDimZ[x][y]; }
+    int getTilePipDimZ(int x, int y) const { return tilePipDimZ[x][y]; }
 
     BelId getBelByName(IdString name) const;
     IdString getBelName(BelId bel) const;
@@ -175,6 +178,7 @@ struct Arch : BaseCtx
     NetInfo *getBoundPipNet(PipId pip) const;
     NetInfo *getConflictingPipNet(PipId pip) const;
     const std::vector<PipId> &getPips() const;
+    Loc getPipLocation(PipId pip) const;
     WireId getPipSrcWire(PipId pip) const;
     WireId getPipDstWire(PipId pip) const;
     DelayInfo getPipDelay(PipId pip) const;
diff --git a/ice40/arch.h b/ice40/arch.h
index 561d75c3..4c093ef9 100644
--- a/ice40/arch.h
+++ b/ice40/arch.h
@@ -418,7 +418,8 @@ struct Arch : BaseCtx
 
     int getGridDimX() const { return 34; }
     int getGridDimY() const { return 34; }
-    int getTileDimZ(int, int) const { return 8; }
+    int getTileBelDimZ(int, int) const { return 8; }
+    int getTilePipDimZ(int, int) const { return 1; }
 
     // -------------------------------------------------
 
@@ -680,6 +681,15 @@ struct Arch : BaseCtx
         return range;
     }
 
+    Loc getPipLocation(PipId pip) const
+    {
+        Loc loc;
+        loc.x = chip_info->pip_data[pip.index].x;
+        loc.y = chip_info->pip_data[pip.index].y;
+        loc.z = 0;
+        return loc;
+    }
+
     IdString getPipName(PipId pip) const;
 
     IdString getPipType(PipId pip) const { return IdString(); }
-- 
cgit v1.2.3


From 834f7e4bfdbfaa8fbb3b51cef18c734176215c83 Mon Sep 17 00:00:00 2001
From: David Shah <davey1576@gmail.com>
Date: Thu, 9 Aug 2018 10:39:40 +0200
Subject: ecp5: Implement getPipLocation and related API

Signed-off-by: David Shah <davey1576@gmail.com>
---
 ecp5/arch.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ecp5/arch.h b/ecp5/arch.h
index 3e2f203b..36792625 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -421,7 +421,8 @@ struct Arch : BaseCtx
 
     int getGridDimX() const { return chip_info->width; };
     int getGridDimY() const { return chip_info->height; };
-    int getTileDimZ(int, int) const { return 4; };
+    int getTileBelDimZ(int, int) const { return 4; };
+    int getTilePipDimZ(int, int) const { return 1; };
 
     // -------------------------------------------------
 
@@ -774,6 +775,15 @@ struct Arch : BaseCtx
         return chip_info->tiletype_names[locInfo(pip)->pip_data[pip.index].tile_type].get();
     }
 
+    Loc getPipLocation(PipId pip) const
+    {
+        Loc loc;
+        loc.x = pip.location.x;
+        loc.y = pip.location.y;
+        loc.z = 0;
+        return loc;
+    }
+
     int8_t getPipClass(PipId pip) const { return locInfo(pip)->pip_data[pip.index].pip_type; }
 
     BelId getPackagePinBel(const std::string &pin) const;
-- 
cgit v1.2.3


From 8420cb4c80521d100d5f92155b6295f342dae3e3 Mon Sep 17 00:00:00 2001
From: Miodrag Milanovic <mmicko@gmail.com>
Date: Thu, 9 Aug 2018 11:00:24 +0200
Subject: Fix MSVC compile

---
 common/timing.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/timing.cc b/common/timing.cc
index aadd8381..5e45f8a2 100644
--- a/common/timing.cc
+++ b/common/timing.cc
@@ -21,6 +21,7 @@
 #include "timing.h"
 #include <algorithm>
 #include <boost/range/adaptor/reversed.hpp>
+#include <deque>
 #include <unordered_map>
 #include <utility>
 #include "log.h"
-- 
cgit v1.2.3


From 6b6a0c6d3c0d39afecd3c0c6bd0e0a4c006adc5f Mon Sep 17 00:00:00 2001
From: Miodrag Milanovic <mmicko@gmail.com>
Date: Thu, 9 Aug 2018 13:28:21 +0200
Subject: Added quiet mode for logging

---
 common/command.cc |  5 +++++
 common/log.cc     | 32 +++++++++++++++++++++++---------
 common/log.h      |  6 ------
 3 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/common/command.cc b/common/command.cc
index 54111130..d5639e9a 100644
--- a/common/command.cc
+++ b/common/command.cc
@@ -84,6 +84,7 @@ po::options_description CommandHandler::getGeneralOptions()
     po::options_description general("General options");
     general.add_options()("help,h", "show help");
     general.add_options()("verbose,v", "verbose output");
+    general.add_options()("quiet,q", "quiet mode, only errors displayed");
     general.add_options()("debug", "debug output");
     general.add_options()("force,f", "keep running after errors");
 #ifndef NO_GUI
@@ -119,6 +120,10 @@ void CommandHandler::setupContext(Context *ctx)
         ctx->debug = true;
     }
 
+    if (vm.count("quiet")) {
+        log_quiet_warnings = true;
+    }
+
     if (vm.count("force")) {
         ctx->force = true;
     }
diff --git a/common/log.cc b/common/log.cc
index 2625be05..c3e798b6 100644
--- a/common/log.cc
+++ b/common/log.cc
@@ -30,6 +30,8 @@
 
 NEXTPNR_NAMESPACE_BEGIN
 
+void log_internal(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
+
 std::vector<FILE *> log_files;
 std::vector<std::ostream *> log_streams;
 FILE *log_errfile = NULL;
@@ -38,7 +40,6 @@ log_write_type log_write_function = nullptr;
 bool log_error_stderr = false;
 bool log_cmd_error_throw = false;
 bool log_quiet_warnings = false;
-int log_verbose_level;
 std::string log_last_error;
 void (*log_error_atexit)() = NULL;
 
@@ -80,7 +81,7 @@ void logv(const char *format, va_list ap)
     //
     // Trim newlines from the beginning
     while (format[0] == '\n' && format[1] != 0) {
-        log("\n");
+        log_internal("\n");
         format++;
     }
 
@@ -108,7 +109,7 @@ void logv_info(const char *format, va_list ap)
 {
     std::string message = vstringf(format, ap);
 
-    log("Info: %s", message.c_str());
+    log_internal("Info: %s", message.c_str());
     log_flush();
 }
 
@@ -116,7 +117,7 @@ void logv_warning(const char *format, va_list ap)
 {
     std::string message = vstringf(format, ap);
 
-    log("Warning: %s", message.c_str());
+    log_internal("Warning: %s", message.c_str());
     log_flush();
 }
 
@@ -124,7 +125,7 @@ void logv_warning_noprefix(const char *format, va_list ap)
 {
     std::string message = vstringf(format, ap);
 
-    log("%s", message.c_str());
+    log_internal("%s", message.c_str());
 }
 
 void logv_error(const char *format, va_list ap)
@@ -142,7 +143,7 @@ void logv_error(const char *format, va_list ap)
                 f = stderr;
 
     log_last_error = vstringf(format, ap);
-    log("ERROR: %s", log_last_error.c_str());
+    log_internal("ERROR: %s", log_last_error.c_str());
     log_flush();
 
     if (log_error_atexit)
@@ -154,8 +155,17 @@ void logv_error(const char *format, va_list ap)
     throw log_execution_error_exception();
 }
 
+void log_internal(const char *format, ...)
+{
+    va_list ap;
+    va_start(ap, format);
+    logv(format, ap);
+    va_end(ap);
+}
+
 void log(const char *format, ...)
 {
+    if (log_quiet_warnings) return;
     va_list ap;
     va_start(ap, format);
     logv(format, ap);
@@ -164,6 +174,7 @@ void log(const char *format, ...)
 
 void log_info(const char *format, ...)
 {
+    if (log_quiet_warnings) return;
     va_list ap;
     va_start(ap, format);
     logv_info(format, ap);
@@ -172,6 +183,7 @@ void log_info(const char *format, ...)
 
 void log_warning(const char *format, ...)
 {
+    if (log_quiet_warnings) return;
     va_list ap;
     va_start(ap, format);
     logv_warning(format, ap);
@@ -180,6 +192,7 @@ void log_warning(const char *format, ...)
 
 void log_warning_noprefix(const char *format, ...)
 {
+    if (log_quiet_warnings) return;
     va_list ap;
     va_start(ap, format);
     logv_warning_noprefix(format, ap);
@@ -200,7 +213,7 @@ void log_cmd_error(const char *format, ...)
 
     if (log_cmd_error_throw) {
         log_last_error = vstringf(format, ap);
-        log("ERROR: %s", log_last_error.c_str());
+        log_internal("ERROR: %s", log_last_error.c_str());
         log_flush();
         throw log_cmd_error_exception();
     }
@@ -210,10 +223,11 @@ void log_cmd_error(const char *format, ...)
 
 void log_break()
 {
+    if (log_quiet_warnings) return;
     if (log_newline_count < 2)
-        log("\n");
+        log_internal("\n");
     if (log_newline_count < 2)
-        log("\n");
+        log_internal("\n");
 }
 
 void log_flush()
diff --git a/common/log.h b/common/log.h
index 35450311..10de3c7c 100644
--- a/common/log.h
+++ b/common/log.h
@@ -48,15 +48,9 @@ extern FILE *log_errfile;
 extern log_write_type log_write_function;
 
 extern bool log_quiet_warnings;
-extern int log_verbose_level;
 extern std::string log_last_error;
 extern void (*log_error_atexit)();
 
-void logv(const char *format, va_list ap);
-void logv_warning(const char *format, va_list ap);
-void logv_warning_noprefix(const char *format, va_list ap);
-NPNR_NORETURN void logv_error(const char *format, va_list ap) NPNR_ATTRIBUTE(noreturn);
-
 extern std::ostream clog;
 void log(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
 void log_header(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
-- 
cgit v1.2.3


From 0696d623588a82a94966e04a61529b6b86be5f1f Mon Sep 17 00:00:00 2001
From: Miodrag Milanovic <mmicko@gmail.com>
Date: Thu, 9 Aug 2018 13:35:18 +0200
Subject: Expose log_always that will be displayed disregarding quite flag

---
 common/log.cc | 20 +++++++++-----------
 common/log.h  |  2 +-
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/common/log.cc b/common/log.cc
index c3e798b6..9f1c5748 100644
--- a/common/log.cc
+++ b/common/log.cc
@@ -30,8 +30,6 @@
 
 NEXTPNR_NAMESPACE_BEGIN
 
-void log_internal(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
-
 std::vector<FILE *> log_files;
 std::vector<std::ostream *> log_streams;
 FILE *log_errfile = NULL;
@@ -81,7 +79,7 @@ void logv(const char *format, va_list ap)
     //
     // Trim newlines from the beginning
     while (format[0] == '\n' && format[1] != 0) {
-        log_internal("\n");
+        log_always("\n");
         format++;
     }
 
@@ -109,7 +107,7 @@ void logv_info(const char *format, va_list ap)
 {
     std::string message = vstringf(format, ap);
 
-    log_internal("Info: %s", message.c_str());
+    log_always("Info: %s", message.c_str());
     log_flush();
 }
 
@@ -117,7 +115,7 @@ void logv_warning(const char *format, va_list ap)
 {
     std::string message = vstringf(format, ap);
 
-    log_internal("Warning: %s", message.c_str());
+    log_always("Warning: %s", message.c_str());
     log_flush();
 }
 
@@ -125,7 +123,7 @@ void logv_warning_noprefix(const char *format, va_list ap)
 {
     std::string message = vstringf(format, ap);
 
-    log_internal("%s", message.c_str());
+    log_always("%s", message.c_str());
 }
 
 void logv_error(const char *format, va_list ap)
@@ -143,7 +141,7 @@ void logv_error(const char *format, va_list ap)
                 f = stderr;
 
     log_last_error = vstringf(format, ap);
-    log_internal("ERROR: %s", log_last_error.c_str());
+    log_always("ERROR: %s", log_last_error.c_str());
     log_flush();
 
     if (log_error_atexit)
@@ -155,7 +153,7 @@ void logv_error(const char *format, va_list ap)
     throw log_execution_error_exception();
 }
 
-void log_internal(const char *format, ...)
+void log_always(const char *format, ...)
 {
     va_list ap;
     va_start(ap, format);
@@ -213,7 +211,7 @@ void log_cmd_error(const char *format, ...)
 
     if (log_cmd_error_throw) {
         log_last_error = vstringf(format, ap);
-        log_internal("ERROR: %s", log_last_error.c_str());
+        log_always("ERROR: %s", log_last_error.c_str());
         log_flush();
         throw log_cmd_error_exception();
     }
@@ -225,9 +223,9 @@ void log_break()
 {
     if (log_quiet_warnings) return;
     if (log_newline_count < 2)
-        log_internal("\n");
+        log_always("\n");
     if (log_newline_count < 2)
-        log_internal("\n");
+        log_always("\n");
 }
 
 void log_flush()
diff --git a/common/log.h b/common/log.h
index 10de3c7c..74b9f0f5 100644
--- a/common/log.h
+++ b/common/log.h
@@ -53,7 +53,7 @@ extern void (*log_error_atexit)();
 
 extern std::ostream clog;
 void log(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
-void log_header(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
+void log_always(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
 void log_info(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
 void log_warning(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
 void log_warning_noprefix(const char *format, ...) NPNR_ATTRIBUTE(format(printf, 1, 2));
-- 
cgit v1.2.3


From 8b04a646291bec7fb65b3580a08c266268acf010 Mon Sep 17 00:00:00 2001
From: Miodrag Milanovic <mmicko@gmail.com>
Date: Thu, 9 Aug 2018 17:34:57 +0200
Subject: Fix compile warning

---
 common/log.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/log.cc b/common/log.cc
index 9f1c5748..df5430bb 100644
--- a/common/log.cc
+++ b/common/log.cc
@@ -30,6 +30,8 @@
 
 NEXTPNR_NAMESPACE_BEGIN
 
+NPNR_NORETURN void logv_error(const char *format, va_list ap) NPNR_ATTRIBUTE(noreturn);
+
 std::vector<FILE *> log_files;
 std::vector<std::ostream *> log_streams;
 FILE *log_errfile = NULL;
-- 
cgit v1.2.3