From 200c57f475f549774184608580b4d80290aac21c Mon Sep 17 00:00:00 2001 From: Greg Davill Date: Sat, 14 Aug 2021 19:26:58 +0930 Subject: ecp5: Enable OPENDRAIN on differential outputs --- ecp5/bitstream.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ecp5/bitstream.cc') diff --git a/ecp5/bitstream.cc b/ecp5/bitstream.cc index a544f2b7..a86f4678 100644 --- a/ecp5/bitstream.cc +++ b/ecp5/bitstream.cc @@ -975,8 +975,20 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex iovoltage_to_str(vccio).c_str(), ci->name.c_str(ctx)); } } - if (ci->attrs.count(ctx->id("OPENDRAIN"))) + if (ci->attrs.count(ctx->id("OPENDRAIN"))) { cc.tiles[pio_tile].add_enum(pio + ".OPENDRAIN", str_or_default(ci->attrs, ctx->id("OPENDRAIN"), "OFF")); + if (is_differential(ioType_from_str(iotype))) { + std::string other; + if (pio == "PIOA") + other = "PIOB"; + else if (pio == "PIOC") + other = "PIOD"; + else + log_error("cannot set OPENDRAIN on differential IO at location %s\n", pio.c_str()); + cc.tiles[pio_tile].add_enum(other + ".OPENDRAIN", str_or_default(ci->attrs, ctx->id("OPENDRAIN"), "OFF")); + } + } + std::string datamux_oddr = str_or_default(ci->params, ctx->id("DATAMUX_ODDR"), "PADDO"); if (datamux_oddr != "PADDO") cc.tiles[pic_tile].add_enum(pio + ".DATAMUX_ODDR", datamux_oddr); -- cgit v1.2.3