From f245185da82e529cdac9cce564d517a0362f567d Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 15 Oct 2025 15:38:35 +0200 Subject: [PATCH] clangformat --- machxo2/bitstream.cc | 18 +++++++++--------- machxo2/pio.cc | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/machxo2/bitstream.cc b/machxo2/bitstream.cc index 329596c4..6966c455 100644 --- a/machxo2/bitstream.cc +++ b/machxo2/bitstream.cc @@ -28,8 +28,8 @@ #include #include "config.h" #include "log.h" -#include "util.h" #include "pio.h" +#include "util.h" #define fmt_str(x) (static_cast(std::ostringstream() << x).str()) @@ -426,28 +426,28 @@ struct MachXO2Bitgen std::string pic_tile = get_pic_tile(bel); cc.tiles[pic_tile].add_enum(pio + ".BASE_TYPE", dir + "_" + iotype); bool is_opendrain = false; - + if (ci->attrs.count(id_OPENDRAIN)) { if (opendrain_capable(io_type, dir)) { cc.tiles[pic_tile].add_enum(pio + ".OPENDRAIN", str_or_default(ci->attrs, id_OPENDRAIN, "OFF")); is_opendrain = true; - } - else + } else log_error("IO of type %s and direction %s cannot be set to opendrain\n", iotype.c_str(), dir.c_str()); } - + if (ci->attrs.count(id_SLEWRATE) && !is_differential(io_type) && dir != "INPUT") cc.tiles[pic_tile].add_enum(pio + ".SLEWRATE", str_or_default(ci->attrs, id_SLEWRATE, "SLOW")); if (ci->attrs.count(id_DIFFRESISTOR)) cc.tiles[pic_tile].add_enum(pio + ".DIFFRESISTOR", str_or_default(ci->attrs, id_DIFFRESISTOR, "OFF")); - + if (!is_opendrain) { if (ci->attrs.count(id_CLAMP)) cc.tiles[pic_tile].add_enum(pio + ".CLAMP", str_or_default(ci->attrs, id_CLAMP, "OFF")); if (ci->attrs.count(id_PULLMODE) || dir == "INPUT") - cc.tiles[pic_tile].add_enum(pio + ".PULLMODE", str_or_default(ci->attrs, id_PULLMODE, is_lvcmos(io_type) ? "DOWN" : "NONE")); + cc.tiles[pic_tile].add_enum(pio + ".PULLMODE", str_or_default(ci->attrs, id_PULLMODE, + is_lvcmos(io_type) ? "DOWN" : "NONE")); } - + if (ci->attrs.count(id_DRIVE) && !is_differential(io_type) && dir != "INPUT") { std::string drive = str_or_default(ci->attrs, id_DRIVE, "8"); if (is_drive_ok(io_type, drive)) @@ -455,7 +455,7 @@ struct MachXO2Bitgen else log_error("DRIVE %s cannot be set for IO type %s\n", drive.c_str(), iotype.c_str()); } - + if ((dir == "INPUT" || dir == "BIDIR") && !is_differential(ioType_from_str(iotype)) && !is_referenced(ioType_from_str(iotype)) && ci->attrs.count(id_HYSTERESIS)) { cc.tiles[pic_tile].add_enum(pio + ".HYSTERESIS", str_or_default(ci->attrs, id_HYSTERESIS, "SMALL")); diff --git a/machxo2/pio.cc b/machxo2/pio.cc index e0eae193..96905588 100644 --- a/machxo2/pio.cc +++ b/machxo2/pio.cc @@ -209,7 +209,7 @@ bool opendrain_capable(IOType type, std::string dir) { if (dir != "OUTPUT" && dir != "BIDIR") return false; - + return is_lvcmos(type); }