[lib] developing the support on forcing pin direction from a specific column in pin table .csv
This commit is contained in:
parent
8b00bfdff9
commit
dbbabbc098
|
@ -18,6 +18,14 @@
|
|||
/* Begin namespace openfpga */
|
||||
namespace openfpga {
|
||||
|
||||
/* Constants for io pin table csv parser */
|
||||
constexpr const int ROW_INDEX_INTERNAL_PIN = 4;
|
||||
constexpr const int ROW_INDEX_EXTERNAL_PIN = 5;
|
||||
constexpr const int ROW_INDEX_DIRECTION = 6;
|
||||
constexpr const int ROW_INDEX_SIDE = 0;
|
||||
constexpr const char* DIRECTION_INPUT = "in";
|
||||
constexpr const char* DIRECTION_OUTPUT = "out";
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes about <pin_constraints> to an object of PinConstraints
|
||||
*******************************************************************/
|
||||
|
@ -40,13 +48,13 @@ IoPinTable read_csv_io_pin_table(const char* fname) {
|
|||
std::vector<std::string> row_vec = doc.GetRow<std::string>(irow);
|
||||
IoPinTableId pin_id = io_pin_table.create_pin();
|
||||
/* Fill pin-level information */
|
||||
PortParser internal_pin_parser(row_vec.at(4));
|
||||
PortParser internal_pin_parser(row_vec.at(ROW_INDEX_INTERNAL_PIN));
|
||||
io_pin_table.set_internal_pin(pin_id, internal_pin_parser.port());
|
||||
|
||||
PortParser external_pin_parser(row_vec.at(5));
|
||||
PortParser external_pin_parser(row_vec.at(ROW_INDEX_EXTERNAL_PIN));
|
||||
io_pin_table.set_external_pin(pin_id, external_pin_parser.port());
|
||||
|
||||
std::string pin_side_str = row_vec.at(0);
|
||||
std::string pin_side_str = row_vec.at(ROW_INDEX_SIDE);
|
||||
if (side_str_map.end() == side_str_map.find(pin_side_str)) {
|
||||
VTR_LOG(
|
||||
"Invalid side defintion (='%s')! Expect [TOP|RIGHT|LEFT|BOTTOM]\n",
|
||||
|
@ -69,6 +77,18 @@ IoPinTable read_csv_io_pin_table(const char* fname) {
|
|||
"Invalid direction defintion! Expect [A2F|F2A] in the pin name\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Parse pin direction from a specific column, this has a higher priority than inferring from pin names */
|
||||
std::string port_dir_str = row_vec.at(ROW_INDEX_DIRECTION);
|
||||
if (port_dir_str == std::string(DIRECTION_INPUT)) {
|
||||
io_pin_table.set_pin_direction(pin_id, IoPinTable::INPUT);
|
||||
} else if (port_dir_str == std::string(DIRECTION_OUTPUT)) {
|
||||
io_pin_table.set_pin_direction(pin_id, IoPinTable::OUTPUT);
|
||||
} else {
|
||||
VTR_LOG(
|
||||
"Invalid direction defintion! Expect [%s|%s] in the GPIO direction\n", DIRECTION_INPUT, DIRECTION_OUTPUT);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return io_pin_table;
|
||||
|
|
Loading…
Reference in New Issue