/* * nextpnr -- Next Generation Place and Route * * Copyright (C) 2018 Clifford Wolf * Copyright (C) 2018 Serge Bazanski * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef NEXTPNR_H #define NEXTPNR_H #ifdef NEXTPNR_NAMESPACE #define NEXTPNR_NAMESPACE_PREFIX NEXTPNR_NAMESPACE:: #define NEXTPNR_NAMESPACE_BEGIN namespace NEXTPNR_NAMESPACE { #define NEXTPNR_NAMESPACE_END } #define USING_NEXTPNR_NAMESPACE using namespace NEXTPNR_NAMESPACE; #else #define NEXTPNR_NAMESPACE_PREFIX #define NEXTPNR_NAMESPACE_BEGIN #define NEXTPNR_NAMESPACE_END #define USING_NEXTPNR_NAMESPACE #endif #if defined(__GNUC__) || defined(__clang__) #define NPNR_ATTRIBUTE(...) __attribute__((__VA_ARGS__)) #define NPNR_NORETURN __attribute__((noreturn)) #define NPNR_DEPRECATED __attribute__((deprecated)) #define NPNR_PACKED_STRUCT(...) __VA_ARGS__ __attribute__((packed)) #elif defined(_MSC_VER) #define NPNR_ATTRIBUTE(...) #define NPNR_NORETURN __declspec(noreturn) #define NPNR_DEPRECATED __declspec(deprecated) #define NPNR_PACKED_STRUCT(...) __pragma(pack(push, 1)) __VA_ARGS__ __pragma(pack(pop)) #else #define NPNR_ATTRIBUTE(...) #define NPNR_NORETURN #define NPNR_DEPRECATED #define NPNR_PACKED_STRUCT(...) __VA_ARGS__ #endif NEXTPNR_NAMESPACE_BEGIN class assertion_failure : public std::runtime_error { public: assertion_failure(std::string msg, std::string expr_str, std::string filename, int line); std::string msg; std::string expr_str; std::string filename; int line; }; NPNR_NORETURN inline void assert_fail_impl(const char *message, const char *expr_str, const char *filename, int line) { throw assertion_failure(message, expr_str, filename, line); } NPNR_NORETURN inline void assert_fail_impl_str(std::string message, const char *expr_str, const char *filename, int line) { throw assertion_failure(message, expr_str, filename, line); } #define NPNR_ASSERT(cond) (!(cond) ? assert_fail_impl(#cond, #cond, __FILE__, __LINE__) : (void)true) #define NPNR_ASSERT_MSG(cond, msg) (!(cond) ? assert_fail_impl(msg, #cond, __FILE__, __LINE__) : (void)true) #define NPNR_ASSERT_FALSE(msg) (assert_fail_impl(msg, "false", __FILE__, __LINE__)) #define NPNR_ASSERT_FALSE_STR(msg) (assert_fail_impl_str(msg, "false", __FILE__, __LINE__)) struct BaseCtx; struct Context; struct IdString { int index = 0; static void initialize_arch(const BaseCtx
- command-line: _-R_ http[s]://hostname[:port]
- mitmproxy shortcut: _R_

In reverse proxy mode, mitmproxy acts as a standard HTTP server and forwards
all requests to the specified upstream server. Note that the displayed URL for
flows in this mode will use the value of the __Host__ header field from the
request, not the reverse proxy server.
ase. mutable std::unordered_map *idstring_str_to_idx; mutable std::vector *idstring_idx_to_str; // Placed nets and cells. std::unordered_map> nets; std::unordered_map> cells; BaseCtx() { idstring_str_to_idx = new std::unordered_map; idstring_idx_to_str = new std::vector; IdString::initialize_add(this, "", 0); IdString::initialize_arch(this); } ~BaseCtx() { delete idstring_str_to_idx; delete idstring_idx_to_str; } // Must be called before performing any mutating changes on the Ctx/Arch. void lock(void) { mutex.lock(); mutex_owner = std::this_thread::get_id(); } void unlock(void) { NPNR_ASSERT(std::this_thread::get_id() == mutex_owner); mutex.unlock(); } // Must be called by the UI before rendering data. This lock will be // prioritized when processing code calls yield(). void lock_ui(void) { ui_mutex.lock(); mutex.lock(); } void unlock_ui(void) { mutex.unlock(); ui_mutex.unlock(); } // Yield to UI by unlocking the main mutex, flashing the UI mutex and // relocking the main mutex. Call this when you're performing a // long-standing action while holding a lock to let the UI show // visualization updates. // Must be called with the main lock taken. void yield(void) { unlock(); ui_mutex.lock(); ui_mutex.unlock(); lock(); } IdString id(const std::string &s) const { return IdString(this, s); } IdString id(const char *s) const { return IdString(this, s); } Context *getCtx() { return reinterpret_cast(this); } const Context *getCtx() const { return reinterpret_cast(this); } // -------------------------------------------------------------- bool allUiReload = true; bool frameUiReload = false; std::unordered_set belUiReload; std::unordered_set wireUiReload; std::unordered_set pipUiReload; std::unordered_set groupUiReload; void refreshUi() { allUiReload = true; } void refreshUiFrame() { frameUiReload = true; } void refreshUiBel(BelId bel) { belUiReload.insert(bel); } void refreshUiWire(WireId wire) { wireUiReload.insert(wire); } void refreshUiPip(PipId pip) { pipUiReload.insert(pip); } void refreshUiGroup(GroupId group) { groupUiReload.insert(group); } }; NEXTPNR_NAMESPACE_END #include "arch.h" NEXTPNR_NAMESPACE_BEGIN struct Context : Arch, DeterministicRNG { bool verbose = false; bool debug = false; bool force = false; bool timing_driven = true; float target_freq = 12e6; bool user_freq = false; int slack_redist_iter = 0; Context(ArchArgs args) : Arch(args) {} // -------------------------------------------------------------- WireId getNetinfoSourceWire(const NetInfo *net_info) const; WireId getNetinfoSinkWire(const NetInfo *net_info, const PortRef &sink) const; delay_t getNetinfoRouteDelay(const NetInfo *net_info, const PortRef &sink) const; // provided by router1.cc bool getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay); // -------------------------------------------------------------- uint32_t checksum() const; void check() const; void archcheck() const; }; NEXTPNR_NAMESPACE_END #endif