From df3866a80033feb2ba3cd01f14f8830e1f49cb1a Mon Sep 17 00:00:00 2001
From: David Shah <dave@ds0.me>
Date: Mon, 12 Oct 2020 13:40:24 +0100
Subject: nexus: Add IO packing

Signed-off-by: David Shah <dave@ds0.me>
---
 nexus/arch.cc | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

(limited to 'nexus/arch.cc')

diff --git a/nexus/arch.cc b/nexus/arch.cc
index f309c872..352f789a 100644
--- a/nexus/arch.cc
+++ b/nexus/arch.cc
@@ -459,7 +459,7 @@ bool Arch::route()
 
 // -----------------------------------------------------------------------
 
-CellPinMux Arch::get_cell_pinmux(CellInfo *cell, IdString pin) const
+CellPinMux Arch::get_cell_pinmux(const CellInfo *cell, IdString pin) const
 {
     IdString param = id(stringf("%sMUX", pin.c_str(this)));
     auto fnd_param = cell->params.find(param);
@@ -503,7 +503,7 @@ void Arch::set_cell_pinmux(CellInfo *cell, IdString pin, CellPinMux state)
 
 // -----------------------------------------------------------------------
 
-const PadInfoPOD *Arch::get_pin_data(const std::string &pin) const
+const PadInfoPOD *Arch::get_pkg_pin_data(const std::string &pin) const
 {
     for (size_t i = 0; i < chip_info->num_pads; i++) {
         const PadInfoPOD *pad = &(chip_info->pads[i]);
@@ -537,9 +537,8 @@ Loc Arch::get_pad_loc(const PadInfoPOD *pad) const
     return loc;
 }
 
-BelId Arch::get_pin_bel(const std::string &pin) const
+BelId Arch::get_pad_pio_bel(const PadInfoPOD *pad) const
 {
-    const PadInfoPOD *pad = get_pin_data(pin);
     if (pad == nullptr)
         return BelId();
     return getBelByLocation(get_pad_loc(pad));
@@ -574,6 +573,17 @@ const PadInfoPOD *Arch::get_bel_pad(BelId bel) const
     return nullptr;
 }
 
+std::string Arch::get_pad_functions(const PadInfoPOD *pad) const
+{
+    std::string s;
+    for (size_t i = 0; i < pad->num_funcs; i++) {
+        if (!s.empty())
+            s += '/';
+        s += IdString(pad->func_strs[i]).str(this);
+    }
+    return s;
+}
+
 // -----------------------------------------------------------------------
 
 #ifdef WITH_HEAP
-- 
cgit v1.2.3