Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow gowin family aliases to be specified #1245

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions gowin/family_aliases.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef FAMILY_ALIASES_H
#define FAMILY_ALIASES_H

#include <map>
#include <string>

const std::map<const std::string, const std::string> gowin_family_aliases = {
{"GW1N-1", "GW1N-1"}, {"GW1N-1S", "GW1N-1S"}, {"GW1N-1P5", "GW1N-2"}, {"GW1N-1P5B", "GW1N-2"},
{"GW1N-2", "GW1N-2"}, {"GW1N-2B", "GW1N-2"}, {"GW1N-4B", "GW1N-4"}, {"GW1N-4", "GW1N-4"},
{"GW1N-4D", "GW1N-4"}, {"GW1N-9", "GW1N-9"}, {"GW1N-9C", "GW1N-9C"}, {"GW1NZ-1", "GW1NZ-1"},
{"GW1NZ-1C", "GW1NZ-1"}, {"GW1NR-2", "GW1N-2"}, {"GW1NR-2B", "GW1N-2"}, {"GW1NS-2", "GW1NS-2"},
{"GW1NS-2C", "GW1NS-2"}, {"GW1NS-4", "GW1NS-4"}, {"GW1NSR-2", "GW1NS-2"}, {"GW1NSR-2C", "GW1NS-2"},
{"GW1NSE-2C", "GW1NS-2"}, {"GW1NSR-4", "GW1NS-4"}, {"GW1NSR-4C", "GW1NS-4"}, {"GW1NR-1", "GW1N-1"},
{"GW1NR-4B", "GW1N-4"}, {"GW1NR-4", "GW1N-4"}, {"GW1NR-4D", "GW1N-4"}, {"GW1NR-9", "GW1N-9"},
{"GW1NR-9C", "GW1N-9C"}, {"GW1NRF-4B", "GW1N-4"}, {"GW2A-55", "GW2A-55"}, {"GW2A-18", "GW2A-18"},
{"GW2AR-18", "GW2A-18"}, {"GW2A-55C", "GW2A-55"}, {"GW2A-18C", "GW2A-18C"}, {"GW2AR-18C", "GW2A-18C"},
{"GW1NSER-4C", "GW1NS-4"}, {"GW1NS-4C", "GW1NS-4"}, {"GW2AN-9X", "GW2AN-4X"}, {"GW2AN-18X", "GW2AN-4X"},
{"GW2AN-55C", "GW2A-55"}, {"GW2ANR-18C", "GW2A-18C"}, {"GW1NZR-2", "GW1N-2"}, {"GW2AN-4X", "GW2AN-4X"}};

#endif
5 changes: 5 additions & 0 deletions gowin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <regex>
#include "command.h"
#include "design_utils.h"
#include "family_aliases.h"
#include "log.h"
#include "timing.h"

Expand Down Expand Up @@ -87,6 +88,10 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
chipArgs.family = "GW2A-18";
}
}
if (gowin_family_aliases.count(chipArgs.family)) {
chipArgs.family = gowin_family_aliases.at(chipArgs.family);
}

if (!GW2) {
chipArgs.partnumber = match[0];
} else {
Expand Down
20 changes: 20 additions & 0 deletions himbaechel/uarch/gowin/family_aliases.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef FAMILY_ALIASES_H
#define FAMILY_ALIASES_H

#include <map>
#include <string>

const std::map<const std::string, const std::string> gowin_family_aliases = {
{"GW1N-1", "GW1N-1"}, {"GW1N-1S", "GW1N-1S"}, {"GW1N-1P5", "GW1N-2"}, {"GW1N-1P5B", "GW1N-2"},
{"GW1N-2", "GW1N-2"}, {"GW1N-2B", "GW1N-2"}, {"GW1N-4B", "GW1N-4"}, {"GW1N-4", "GW1N-4"},
{"GW1N-4D", "GW1N-4"}, {"GW1N-9", "GW1N-9"}, {"GW1N-9C", "GW1N-9C"}, {"GW1NZ-1", "GW1NZ-1"},
{"GW1NZ-1C", "GW1NZ-1"}, {"GW1NR-2", "GW1N-2"}, {"GW1NR-2B", "GW1N-2"}, {"GW1NS-2", "GW1NS-2"},
{"GW1NS-2C", "GW1NS-2"}, {"GW1NS-4", "GW1NS-4"}, {"GW1NSR-2", "GW1NS-2"}, {"GW1NSR-2C", "GW1NS-2"},
{"GW1NSE-2C", "GW1NS-2"}, {"GW1NSR-4", "GW1NS-4"}, {"GW1NSR-4C", "GW1NS-4"}, {"GW1NR-1", "GW1N-1"},
{"GW1NR-4B", "GW1N-4"}, {"GW1NR-4", "GW1N-4"}, {"GW1NR-4D", "GW1N-4"}, {"GW1NR-9", "GW1N-9"},
{"GW1NR-9C", "GW1N-9C"}, {"GW1NRF-4B", "GW1N-4"}, {"GW2A-55", "GW2A-55"}, {"GW2A-18", "GW2A-18"},
{"GW2AR-18", "GW2A-18"}, {"GW2A-55C", "GW2A-55"}, {"GW2A-18C", "GW2A-18C"}, {"GW2AR-18C", "GW2A-18C"},
{"GW1NSER-4C", "GW1NS-4"}, {"GW1NS-4C", "GW1NS-4"}, {"GW2AN-9X", "GW2AN-4X"}, {"GW2AN-18X", "GW2AN-4X"},
{"GW2AN-55C", "GW2A-55"}, {"GW2ANR-18C", "GW2A-18C"}, {"GW1NZR-2", "GW1N-2"}, {"GW2AN-4X", "GW2AN-4X"}};

#endif
4 changes: 4 additions & 0 deletions himbaechel/uarch/gowin/gowin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "gowin.h"
#include "gowin_utils.h"
#include "pack.h"
#include "family_aliases.h"

NEXTPNR_NAMESPACE_BEGIN

Expand Down Expand Up @@ -97,6 +98,9 @@ void GowinImpl::init_database(Arch *arch)
}
}

if (gowin_family_aliases.count(family)) {
family = gowin_family_aliases.at(family);
}
arch->load_chipdb(stringf("gowin/chipdb-%s.bin", family.c_str()));

// These fields go in the header of the output JSON file and can help
Expand Down