OpenChams:
symmetry becomes orientation and now supports symmetries AND rotations. There are 8 possible orientations: ID (identity) R1 (rotate 90° Counter Clock wise) R2 (symX and symY) R3 (rotate 90° Clock Wise) MX (symX) XR (symX then rotate 90° Counter Clock Wise) MY (symY) YR (symY then rotate 90° Counter Clock Wise) These orientations exactly copy Hurricane::Transformation::Orientation
This commit is contained in:
parent
9f8de0144d
commit
d89ebe3b4e
|
@ -44,10 +44,10 @@
|
|||
</nets>
|
||||
</netlist>
|
||||
<schematic>
|
||||
<instance name="inv1" x="2490" y="2600" sym="ID"/>
|
||||
<instance name="inv2" x="2490" y="2300" sym="ID"/>
|
||||
<instance name="inv1" x="2490" y="2600" orient="ID"/>
|
||||
<instance name="inv2" x="2490" y="2300" orient="ID"/>
|
||||
<net name="in">
|
||||
<port type="inV" idx="0" x="2415" y="2700" sym="MY"/>
|
||||
<port type="inV" idx="0" x="2415" y="2700" orient="MY"/>
|
||||
<wire>
|
||||
<connector name="inv1" plug="in"/>
|
||||
<connector idx="0"/>
|
||||
|
@ -60,14 +60,14 @@
|
|||
</wire>
|
||||
</net>
|
||||
<net name="out">
|
||||
<port type="outV" idx="0" x="2415" y="2200" sym="MY"/>
|
||||
<port type="outV" idx="0" x="2415" y="2200" orient="MY"/>
|
||||
<wire>
|
||||
<connector name="inv2" plug="out"/>
|
||||
<connector idx="0"/>
|
||||
</wire>
|
||||
</net>
|
||||
<net name="vdd">
|
||||
<port type="inH" idx="0" x="2200" y="2500" sym="ID"/>
|
||||
<port type="inH" idx="0" x="2200" y="2500" orient="ID"/>
|
||||
<wire>
|
||||
<connector idx="0"/>
|
||||
<connector name="inv2" plug="vdd"/>
|
||||
|
@ -78,7 +78,7 @@
|
|||
</wire>
|
||||
</net>
|
||||
<net name="vss">
|
||||
<port type="inH" idx="0" x="2700" y="2500" sym="MX"/>
|
||||
<port type="inH" idx="0" x="2700" y="2500" orient="MX"/>
|
||||
<wire>
|
||||
<connector idx="0"/>
|
||||
<connector name="inv2" plug="vss"/>
|
||||
|
|
|
@ -99,7 +99,7 @@ int main(int argc, char * argv[]) {
|
|||
cerr << " + schematic" << endl;
|
||||
for (map<OpenChams::Name, OpenChams::Schematic::Infos*>::const_iterator sit = schematic->getInstances().begin() ; sit != schematic->getInstances().end() ; ++sit) {
|
||||
OpenChams::Schematic::Infos* inf = (*sit).second;
|
||||
cerr << " | + instance: name: " << ((*sit).first).getString() << " - x: " << inf->getX() << " - y: " << inf->getY() << " - symmetry: " << inf->getSymmetry().getString() << endl;
|
||||
cerr << " | + instance: name: " << ((*sit).first).getString() << " - x: " << inf->getX() << " - y: " << inf->getY() << " - orientation: " << inf->getOrientation().getString() << endl;
|
||||
}
|
||||
if (schematicNet) {
|
||||
for (size_t i = 0 ; i < netlist->getNets().size() ; i++) {
|
||||
|
@ -108,7 +108,7 @@ int main(int argc, char * argv[]) {
|
|||
if (!net->hasNoPorts()) {
|
||||
for (size_t j = 0 ; j < net->getPorts().size() ; j++) {
|
||||
OpenChams::Port* port = net->getPorts()[j];
|
||||
cerr << " | | + port type: " << port->getType().getString() << " - idx: " << port->getIndex() << " - x: " << port->getX() << " - y: " << port->getY() << " - sym: " << port->getSymmetry().getString() << endl;
|
||||
cerr << " | | + port type: " << port->getType().getString() << " - idx: " << port->getIndex() << " - x: " << port->getX() << " - y: " << port->getY() << " - orientation: " << port->getOrientation().getString() << endl;
|
||||
}
|
||||
}
|
||||
if (!net->hasNoWires()) {
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
</nets>
|
||||
</netlist>
|
||||
<schematic>
|
||||
<instance name="nmos1" x="2490" y="2600" sym="ID"/>
|
||||
<instance name="pmos1" x="2490" y="2490" sym="ID"/>
|
||||
<instance name="nmos1" x="2490" y="2600" orient="ID"/>
|
||||
<instance name="pmos1" x="2490" y="2490" orient="ID"/>
|
||||
<net name="vdd">
|
||||
<port type="inV" idx="0" x="2525" y="2430" sym="ID"/>
|
||||
<port type="inV" idx="0" x="2525" y="2430" orient="ID"/>
|
||||
<wire>
|
||||
<connector name="pmos1" plug="S"/>
|
||||
<!--point x="" y=""/-->
|
||||
|
@ -65,14 +65,14 @@
|
|||
</wire>
|
||||
</net>
|
||||
<net name="vss">
|
||||
<port type="inV" idx="0" x="2525" y="2740" sym="MY"/>
|
||||
<port type="inV" idx="0" x="2525" y="2740" orient="MY"/>
|
||||
<wire>
|
||||
<connector name="nmos1" plug="S"/>
|
||||
<connector idx="0"/>
|
||||
</wire>
|
||||
</net>
|
||||
<net name="in">
|
||||
<port type="inH" idx="0" x="2415" y="2520" sym="ID"/>
|
||||
<port type="inH" idx="0" x="2415" y="2520" orient="ID"/>
|
||||
<wire>
|
||||
<connector name="pmos1" plug="G"/>
|
||||
<connector name="nmos1" plug="G"/>
|
||||
|
@ -83,7 +83,7 @@
|
|||
</wire>
|
||||
</net>
|
||||
<net name="out">
|
||||
<port type="outH" idx="0" x="2570" y="2590" sym="ID"/>
|
||||
<port type="outH" idx="0" x="2570" y="2590" orient="ID"/>
|
||||
<wire>
|
||||
<connector name="pmos1" plug="D"/>
|
||||
<connector name="nmos1" plug="D"/>
|
||||
|
|
|
@ -40,14 +40,14 @@ def printContents(circuit):
|
|||
if (circuit.schematic):
|
||||
print " + schematic"
|
||||
for instance in circuit.schematic.getInstances():
|
||||
print " | + instance name:", instance.key, "- x:", instance.value.x, "- y:", instance.value.y, "- symmetry:", instance.value.symmetry
|
||||
print " | + instance name:", instance.key, "- x:", instance.value.x, "- y:", instance.value.y, "- orientation:", instance.value.orientation
|
||||
if schematicNet:
|
||||
for net in circuit.netlist.getNets():
|
||||
if net.hasNoPorts() and net.hasNoWires():
|
||||
continue
|
||||
print " | + net name:", net.name
|
||||
for port in net.getPorts():
|
||||
print " | | + port type:", port.type, "- idx:", port.index, "- x:", port.x, "- y:", port.y, "- sym:", port.symmetry
|
||||
print " | | + port type:", port.type, "- idx:", port.index, "- x:", port.x, "- y:", port.y, "- orientation:", port.orientation
|
||||
for wire in net.getWires():
|
||||
if isinstance(wire.startPoint, InstancePoint):
|
||||
print " | | + wire <" + wire.startPoint.name.getString() + "," + wire.startPoint.plug.getString() +">"
|
||||
|
|
|
@ -564,18 +564,18 @@ void Circuit::readInstanceSchematic(xmlNode* node, Schematic* schematic) {
|
|||
xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name");
|
||||
xmlChar* xC = xmlGetProp(node, (xmlChar*)"x");
|
||||
xmlChar* yC = xmlGetProp(node, (xmlChar*)"y");
|
||||
xmlChar* symC = xmlGetProp(node, (xmlChar*)"sym");
|
||||
if (nameC && xC && yC && symC) {
|
||||
xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient");
|
||||
if (nameC && xC && yC && orientC) {
|
||||
Name iName((const char*)nameC);
|
||||
double x = ::getValue<double>(xC);
|
||||
double y = ::getValue<double>(yC);
|
||||
string symStr((const char*)symC);
|
||||
string symComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"};
|
||||
vector<string> symComps (symComp, symComp+8);
|
||||
check_uppercase(symStr, symComps, "[ERROR] In 'schematic'.'instance', 'sym' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'.");
|
||||
schematic->addInstance(iName, x, y, Name(symStr));
|
||||
string orientStr((const char*)orientC);
|
||||
string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"};
|
||||
vector<string> orientComps (orientComp, orientComp+8);
|
||||
check_uppercase(orientStr, orientComps, "[ERROR] In 'schematic'.'instance', 'orient' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'.");
|
||||
schematic->addInstance(iName, x, y, Name(orientStr));
|
||||
} else {
|
||||
throw OpenChamsException("[ERROR] 'instance' node in 'schematic' must have 'name', 'x', 'y' and 'sym' properties.");
|
||||
throw OpenChamsException("[ERROR] 'instance' node in 'schematic' must have 'name', 'x', 'y' and 'orient' properties.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,19 +612,19 @@ void Circuit::readPortSchematic(xmlNode* node, Net* net) {
|
|||
xmlChar* idxC = xmlGetProp(node, (xmlChar*)"idx");
|
||||
xmlChar* xC = xmlGetProp(node, (xmlChar*)"x");
|
||||
xmlChar* yC = xmlGetProp(node, (xmlChar*)"y");
|
||||
xmlChar* symC = xmlGetProp(node, (xmlChar*)"sym");
|
||||
if (typeC && idxC && xC && yC && symC) {
|
||||
xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient");
|
||||
if (typeC && idxC && xC && yC && orientC) {
|
||||
Name pType((const char*)typeC);
|
||||
unsigned idx = ::getValue<unsigned>(idxC);
|
||||
double x = ::getValue<double>(xC);
|
||||
double y = ::getValue<double>(yC);
|
||||
string symStr((const char*)symC);
|
||||
string symComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"};
|
||||
vector<string> symComps (symComp, symComp+8);
|
||||
check_uppercase(symStr, symComps, "[ERROR] In 'schematic'.'port', 'sym' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'.");
|
||||
net->addPort(pType, idx, x, y, Name(symStr));
|
||||
string orientStr((const char*)orientC);
|
||||
string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"};
|
||||
vector<string> orientComps (orientComp, orientComp+8);
|
||||
check_uppercase(orientStr, orientComps, "[ERROR] In 'schematic'.'port', 'orient' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'.");
|
||||
net->addPort(pType, idx, x, y, Name(orientStr));
|
||||
} else {
|
||||
throw OpenChamsException("[ERROR] 'schematic'.'port' must have 'type', 'idx', 'x', 'y' and 'sym properties.");
|
||||
throw OpenChamsException("[ERROR] 'schematic'.'port' must have 'type', 'idx', 'x', 'y' and 'orient' properties.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ bool Circuit::writeToFile(string filePath) {
|
|||
file << " <schematic>" << endl;
|
||||
for (map<Name, Schematic::Infos*>::const_iterator it = _schematic->getInstances().begin() ; it != _schematic->getInstances().end(); ++it ) {
|
||||
Schematic::Infos* infos = (*it).second;
|
||||
file << " <instance name=\"" << ((*it).first).getString() << "\" x=\"" << infos->getX() << "\" y=\"" << infos->getY() << "\" sym=\"" << infos->getSymmetry().getString() << "\"/>" << endl;
|
||||
file << " <instance name=\"" << ((*it).first).getString() << "\" x=\"" << infos->getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation().getString() << "\"/>" << endl;
|
||||
}
|
||||
if (schematicNets) {
|
||||
for (size_t i = 0 ; i < nets.size() ; i++) {
|
||||
|
@ -1079,7 +1079,7 @@ bool Circuit::writeToFile(string filePath) {
|
|||
Port* port = net->getPorts()[j];
|
||||
if (!port)
|
||||
continue;
|
||||
file << " <port type=\"" << port->getType().getString() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" sym=\"" << port->getSymmetry().getString() << "\"/>" << endl;
|
||||
file << " <port type=\"" << port->getType().getString() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation().getString() << "\"/>" << endl;
|
||||
}
|
||||
for (size_t j = 0 ; j < net->getWires().size() ; j++) {
|
||||
Wire* wire = net->getWires()[j];
|
||||
|
|
|
@ -42,12 +42,12 @@ void Net::connectTo(Name instanceName, Name connectorName) {
|
|||
}
|
||||
}
|
||||
|
||||
Port* Net::addPort(Name type, unsigned idx, double x, double y, Name sym) {
|
||||
Port* Net::addPort(Name type, unsigned idx, double x, double y, Name orient) {
|
||||
while (_ports.size() <= idx)
|
||||
_ports.push_back(NULL);
|
||||
if (_ports[idx])
|
||||
throw OpenChamsException("[ERROR] Net::addPort: cannot add port since another one with the same id already exists.");
|
||||
_ports[idx] = new Port(type, idx, x, y, sym);
|
||||
_ports[idx] = new Port(type, idx, x, y, orient);
|
||||
|
||||
return _ports[idx];
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
|
|||
.add_property("index" , &Port::getIndex )
|
||||
.add_property("x" , &Port::getX )
|
||||
.add_property("y" , &Port::getY )
|
||||
.add_property("symmetry", &Port::getSymmetry)
|
||||
.add_property("orientation", &Port::getOrientation)
|
||||
;
|
||||
|
||||
// class OpenChams::WirePoint
|
||||
|
@ -266,7 +266,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
|
|||
class_<Schematic::Infos, Schematic::Infos*>("Infos", init<double, double, Name>())
|
||||
.add_property("x" , &Schematic::Infos::getX )
|
||||
.add_property("y" , &Schematic::Infos::getY )
|
||||
.add_property("symmetry", &Schematic::Infos::getSymmetry)
|
||||
.add_property("orientation", &Schematic::Infos::getOrientation)
|
||||
;
|
||||
} // end schematicScope
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace std;
|
|||
namespace OpenChams {
|
||||
Schematic::Schematic(Circuit* circuit): _circuit(circuit) {}
|
||||
|
||||
void Schematic::addInstance(Name instanceName, double x, double y, Name sym) {
|
||||
void Schematic::addInstance(Name instanceName, double x, double y, Name orient) {
|
||||
map<Name, Schematic::Infos*>::iterator it = _instances.find(instanceName);
|
||||
if (it != _instances.end()) {
|
||||
string error("[ERROR] Cannot set same instance twice in 'schematic' (");
|
||||
|
@ -23,11 +23,11 @@ void Schematic::addInstance(Name instanceName, double x, double y, Name sym) {
|
|||
error += ").";
|
||||
throw OpenChamsException(error);
|
||||
}
|
||||
_instances[instanceName] = new Schematic::Infos(x, y, sym);
|
||||
_instances[instanceName] = new Schematic::Infos(x, y, orient);
|
||||
}
|
||||
|
||||
Schematic::Infos::Infos(double x, double y, Name sym)
|
||||
Schematic::Infos::Infos(double x, double y, Name orient)
|
||||
: _x(x)
|
||||
, _y(y)
|
||||
, _sym(sym) {}
|
||||
, _orient(orient) {}
|
||||
} // namespace
|
||||
|
|
|
@ -47,7 +47,7 @@ class Net {
|
|||
inline const std::vector<Net::Connection*>& getConnections();
|
||||
|
||||
// schematic relative methods
|
||||
Port* addPort(Name type, unsigned idx, double x, double y, Name sym);
|
||||
Port* addPort(Name type, unsigned idx, double x, double y, Name orient);
|
||||
Wire* addWire();
|
||||
inline bool hasNoPorts();
|
||||
inline const std::vector<Port*>& getPorts();
|
||||
|
|
|
@ -15,28 +15,28 @@
|
|||
namespace OpenChams {
|
||||
class Port {
|
||||
public:
|
||||
Port(Name type, unsigned idx , double x, double y, Name sym): _type(type), _idx(idx), _x(x), _y(y), _sym(sym) {}
|
||||
Port(Name type, unsigned idx , double x, double y, Name orient): _type(type), _idx(idx), _x(x), _y(y), _orient(orient) {}
|
||||
~Port() {}
|
||||
|
||||
inline Name getType() const;
|
||||
inline unsigned getIndex() const;
|
||||
inline double getX() const;
|
||||
inline double getY() const;
|
||||
inline Name getSymmetry() const;
|
||||
inline Name getOrientation() const;
|
||||
|
||||
private:
|
||||
Name _type;
|
||||
unsigned _idx;
|
||||
double _x;
|
||||
double _y;
|
||||
Name _sym;
|
||||
Name _orient;
|
||||
};
|
||||
|
||||
inline Name Port::getType() const { return _type; }
|
||||
inline unsigned Port::getIndex() const { return _idx; }
|
||||
inline double Port::getX() const { return _x; }
|
||||
inline double Port::getY() const { return _y; }
|
||||
inline Name Port::getSymmetry() const { return _sym; }
|
||||
inline Name Port::getOrientation() const { return _orient; }
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
|
|
@ -21,21 +21,21 @@ class Schematic {
|
|||
public:
|
||||
class Infos {
|
||||
public:
|
||||
Infos(double x, double y, Name sym);
|
||||
Infos(double x, double y, Name orient);
|
||||
|
||||
inline double getX();
|
||||
inline double getY();
|
||||
inline Name getSymmetry();
|
||||
inline Name getOrientation();
|
||||
|
||||
private:
|
||||
double _x;
|
||||
double _y;
|
||||
Name _sym;
|
||||
Name _orient;
|
||||
};
|
||||
public:
|
||||
Schematic(Circuit*);
|
||||
|
||||
void addInstance(Name instanceName, double x, double y, Name sym );
|
||||
void addInstance(Name instanceName, double x, double y, Name orient );
|
||||
|
||||
inline bool hasNoInstances();
|
||||
inline const std::map<Name, Infos*>& getInstances();
|
||||
|
@ -50,7 +50,7 @@ inline const std::map<Name, Schematic::Infos*>& Schematic::getInstances() { retu
|
|||
|
||||
inline double Schematic::Infos::getX() { return _x; };
|
||||
inline double Schematic::Infos::getY() { return _y; };
|
||||
inline Name Schematic::Infos::getSymmetry() { return _sym; };
|
||||
inline Name Schematic::Infos::getOrientation() { return _orient; };
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue