[Lib] Fixed all the syntax errors
This commit is contained in:
parent
27627bf5b4
commit
4b3f906f11
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "bus_group.h"
|
||||
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
/************************************************************************
|
||||
* Member functions for class BusGroup
|
||||
***********************************************************************/
|
||||
|
@ -56,8 +58,7 @@ bool BusGroup::empty() const {
|
|||
void BusGroup::reserve_buses(const size_t& num_buses) {
|
||||
bus_ids_.reserve(num_buses);
|
||||
bus_ports_.reserve(num_buses);
|
||||
bus_pin_indices_.reserve(num_buses);
|
||||
bus_pin_names_.reserve(num_buses);
|
||||
bus_pin_ids_.reserve(num_buses);
|
||||
}
|
||||
|
||||
void BusGroup::reserve_pins(const size_t& num_pins) {
|
||||
|
@ -71,14 +72,13 @@ BusGroupId BusGroup::create_bus(const openfpga::BasicPort& bus_port) {
|
|||
BusGroupId bus_id = BusGroupId(bus_ids_.size());
|
||||
|
||||
bus_ids_.push_back(bus_id);
|
||||
bus_ports.push_back(bus_port);
|
||||
bus_pin_indices_.emplace_back();
|
||||
bus_pin_names_.emplace_back();
|
||||
bus_ports_.push_back(bus_port);
|
||||
bus_pin_ids_.emplace_back();
|
||||
|
||||
return bus_id;
|
||||
}
|
||||
|
||||
BusPinId BasicGroup::create_pin(const BusGroupId& bus_id) {
|
||||
BusPinId BusGroup::create_pin(const BusGroupId& bus_id) {
|
||||
/* Create a new id */
|
||||
BusPinId pin_id = BusPinId(pin_ids_.size());
|
||||
|
||||
|
@ -91,7 +91,7 @@ BusPinId BasicGroup::create_pin(const BusGroupId& bus_id) {
|
|||
VTR_ASSERT(valid_bus_id(bus_id));
|
||||
bus_pin_ids_[bus_id].push_back(pin_id);
|
||||
|
||||
return bus_id;
|
||||
return pin_id;
|
||||
}
|
||||
|
||||
void BusGroup::set_pin_index(const BusPinId& pin_id, const int& index) {
|
||||
|
@ -115,3 +115,4 @@ bool BusGroup::valid_pin_id(const BusPinId& pin_id) const {
|
|||
return ( size_t(pin_id) < pin_ids_.size() ) && ( pin_id == pin_ids_[pin_id] );
|
||||
}
|
||||
|
||||
} // End of namespace openfpga
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "bus_group_fwd.h"
|
||||
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
/********************************************************************
|
||||
* A data structure to describe the bus-to-pin mapping
|
||||
* This data structure may include a number of buses
|
||||
|
@ -46,7 +48,7 @@ class BusGroup {
|
|||
bus_group_range buses() const;
|
||||
public: /* Public Accessors: Basic data query */
|
||||
/** Get port information of a bus with a given id */
|
||||
openfpga::BasicPort BusGroup::bus_port(const BusGroupId& bus_id) const;
|
||||
BasicPort bus_port(const BusGroupId& bus_id) const;
|
||||
|
||||
/* Get the pins under a specific bus */
|
||||
std::vector<BusPinId> bus_pins(const BusGroupId& bus_id) const;
|
||||
|
@ -77,7 +79,7 @@ class BusGroup {
|
|||
void set_pin_index(const BusPinId& pin_id, const int& index);
|
||||
|
||||
/* Set the name for a pin */
|
||||
void set_pin_index(const BusPinId& pin_id, const std::string& name);
|
||||
void set_pin_name(const BusPinId& pin_id, const std::string& name);
|
||||
|
||||
public: /* Public invalidators/validators */
|
||||
/* Show if the bus id is a valid for data queries */
|
||||
|
@ -91,7 +93,7 @@ class BusGroup {
|
|||
vtr::vector<BusGroupId, BusGroupId> bus_ids_;
|
||||
|
||||
/* Port information of each bus */
|
||||
vtr::vector<BusGroupId, openfpga::BasicPort> bus_ports_;
|
||||
vtr::vector<BusGroupId, BasicPort> bus_ports_;
|
||||
|
||||
/* Indices of each pin under each bus */
|
||||
vtr::vector<BusGroupId, std::vector<BusPinId>> bus_pin_ids_;
|
||||
|
@ -106,4 +108,5 @@ class BusGroup {
|
|||
vtr::vector<BusPinId, std::string> pin_names_;
|
||||
};
|
||||
|
||||
} // End of namespace openfpga
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include "vtr_strong_id.h"
|
||||
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
struct bus_group_id_tag;
|
||||
struct bus_pin_id_tag;
|
||||
|
||||
|
@ -21,4 +23,6 @@ typedef vtr::StrongId<bus_pin_id_tag> BusPinId;
|
|||
/* Short declaration of class */
|
||||
class BusGroup;
|
||||
|
||||
} // End of namespace openfpga
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
/* Constants required by XML parser */
|
||||
|
||||
constexpr char* XML_BUS_GROUP_NODE_NAME = "bus_group"
|
||||
constexpr char* XML_BUS_NODE_NAME = "bus"
|
||||
constexpr char* XML_BUS_PORT_ATTRIBUTE_NAME = "name"
|
||||
constexpr char* XML_PIN_NODE_NAME = "pin"
|
||||
constexpr char* XML_PIN_INDEX_ATTRIBUTE_NAME = "id"
|
||||
constexpr char* XML_PIN_NAME_ATTRIBUTE_NAME = "name"
|
||||
constexpr char* XML_BUS_GROUP_NODE_NAME = "bus_group";
|
||||
constexpr char* XML_BUS_NODE_NAME = "bus";
|
||||
constexpr char* XML_BUS_PORT_ATTRIBUTE_NAME = "name";
|
||||
constexpr char* XML_PIN_NODE_NAME = "pin";
|
||||
constexpr char* XML_PIN_INDEX_ATTRIBUTE_NAME = "id";
|
||||
constexpr char* XML_PIN_NAME_ATTRIBUTE_NAME = "name";
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "bus_group_xml_constants.h"
|
||||
#include "read_xml_bus_group.h"
|
||||
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes of a <pin> to an object of BusGroup
|
||||
*******************************************************************/
|
||||
|
@ -71,14 +73,14 @@ void read_xml_bus(pugi::xml_node& xml_bus,
|
|||
|
||||
/* Ensure the bus port is valid */
|
||||
if (!bus_group.bus_port(bus_id).is_valid()) {
|
||||
archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_pin),
|
||||
archfpga_throw(loc_data.filename_c_str(), loc_data.line(xml_bus),
|
||||
"Bus port is invalid, check LSB and MSB!\n");
|
||||
}
|
||||
|
||||
for (pugi::xml_node xml_pin : xml_bus.children()) {
|
||||
/* Error out if the XML child has an invalid name! */
|
||||
if (xml_pin.name() != std::string(XML_PIN_NODE_NAME)) {
|
||||
bad_tag(xml_pin, loc_data, xml_root, {XML_PIN_NODE_NAME});
|
||||
bad_tag(xml_pin, loc_data, xml_bus, {XML_PIN_NODE_NAME});
|
||||
}
|
||||
read_xml_pin(xml_pin, loc_data, bus_group, bus_id);
|
||||
}
|
||||
|
@ -130,3 +132,4 @@ BusGroup read_xml_bus_group(const char* fname) {
|
|||
return bus_group;
|
||||
}
|
||||
|
||||
} // End of namespace openfpga
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
/********************************************************************
|
||||
* Function declaration
|
||||
*******************************************************************/
|
||||
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
BusGroup read_xml_bus_group(const char* fname);
|
||||
|
||||
} // End of namespace openfpga
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "bus_group_xml_constants.h"
|
||||
#include "write_xml_bus_group.h"
|
||||
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
/********************************************************************
|
||||
* A writer to output a bus to XML format
|
||||
*
|
||||
|
@ -106,3 +108,5 @@ int write_xml_bus_group(const char* fname,
|
|||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
} // End of namespace openfpga
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
/********************************************************************
|
||||
* Function declaration
|
||||
*******************************************************************/
|
||||
namespace openfpga { // Begin namespace openfpga
|
||||
|
||||
int write_xml_bus_group(const char* fname,
|
||||
const BusGroup& bus_group);
|
||||
|
||||
} // End of namespace openfpga
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, const char** argv) {
|
|||
VTR_ASSERT((2 == argc) || (3 == argc));
|
||||
|
||||
/* Parse the circuit library from an XML file */
|
||||
const openfpga::BusGroup& bus_group = read_xml_bus_group(argv[1]);
|
||||
const openfpga::BusGroup& bus_group = openfpga::read_xml_bus_group(argv[1]);
|
||||
VTR_LOG("Parsed %lu bus(es) from XML into bus group.\n",
|
||||
bus_group.buses().size());
|
||||
|
||||
|
@ -24,7 +24,7 @@ int main(int argc, const char** argv) {
|
|||
* This is optional only used when there is a second argument
|
||||
*/
|
||||
if (3 <= argc) {
|
||||
write_xml_bus_group(argv[2], bus_group);
|
||||
openfpga::write_xml_bus_group(argv[2], bus_group);
|
||||
VTR_LOG("Write the bus group to an XML file: %s.\n",
|
||||
argv[2]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue