nextpnr/himbaechel/uarch/gatemate/gatemate.h

72 lines
2.5 KiB
C
Raw Normal View History

2024-12-10 22:48:07 +08:00
/*
* nextpnr -- Next Generation Place and Route
*
* Copyright (C) 2024 The Project Peppercorn Authors.
*
* 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.
*
*/
#ifndef HIMBAECHEL_GATEMATE_H
#define HIMBAECHEL_GATEMATE_H
#include "extra_data.h"
#include "himbaechel_api.h"
#include "log.h"
#include "nextpnr.h"
#include "util.h"
#include "himbaechel_helpers.h"
NEXTPNR_NAMESPACE_BEGIN
struct GateMateImpl : HimbaechelAPI
{
~GateMateImpl();
void init_database(Arch *arch) override;
void init(Context *ctx) override;
void setupArchContext() override;
2024-12-10 22:48:07 +08:00
2024-12-16 18:19:56 +08:00
void pack() override;
2025-01-09 21:27:21 +08:00
void postPlace() override;
2024-12-16 18:19:56 +08:00
void postRoute() override;
2024-12-25 22:48:09 +08:00
bool isBelLocationValid(BelId bel, bool explain_invalid = false) const override;
2024-12-16 18:19:56 +08:00
delay_t estimateDelay(WireId src, WireId dst) const override;
2024-12-10 22:48:07 +08:00
void drawBel(std::vector<GraphicElement> &g, GraphicElement::style_t style, IdString bel_type, Loc loc) override;
2024-12-18 15:56:54 +08:00
void write_bitstream(const std::string &device, const std::string &filename);
bool read_bitstream(const std::string &device, const std::string &filename);
2025-01-09 21:27:21 +08:00
bool checkPipAvail(PipId pip) const override { return blocked_pips.count(pip) == 0; }
bool checkPipAvailForNet(PipId pip, const NetInfo *net) const override { return checkPipAvail(pip); };
2024-12-17 17:52:19 +08:00
void parse_ccf(const std::string &filename);
2024-12-20 16:38:14 +08:00
IdString getBelBucketForCellType(IdString cell_type) const;
bool isValidBelForCellType(IdString cell_type, BelId bel) const;
bool isPipInverting(PipId pip) const override {
const auto &extra_data = *reinterpret_cast<const GateMatePipExtraDataPOD*>(chip_pip_info(ctx->chip_info, pip).extra_data.get());
return extra_data.type == PipExtra::PIP_EXTRA_MUX && (extra_data.flags & MUX_INVERT);
}
2025-01-09 21:27:21 +08:00
pool<PipId> blocked_pips;
2024-12-10 22:48:07 +08:00
};
NEXTPNR_NAMESPACE_END
#endif