|
degate 0.1.1
|
This class represents the logic model. More...
#include <LogicModel.h>
Public Types | |
| typedef std::map< object_id_t, PlacedLogicModelObject_shptr > | object_collection |
| typedef std::map< object_id_t, Net_shptr > | net_collection |
| typedef std::map< object_id_t, Annotation_shptr > | annotation_collection |
| typedef std::map< object_id_t, Via_shptr > | via_collection |
| typedef std::vector< Layer_shptr > | layer_collection |
| typedef std::map< object_id_t, Gate_shptr > | gate_collection |
Public Member Functions | |
| LogicModel (unsigned int width, unsigned int height, unsigned int layers=0) | |
| The constructor for the logic model. | |
| virtual | ~LogicModel () |
| The destructor. | |
| unsigned int | get_width () const |
| Get the width of logic model. | |
| unsigned int | get_height () const |
| Get the height of logic model. | |
| object_id_t | get_new_object_id () |
| Get a new unique logic model object ID. | |
| PlacedLogicModelObject_shptr | get_object (object_id_t object_id) |
| Lookup an object from the logic model for a given object ID. | |
| void | add_object (int layer_pos, PlacedLogicModelObject_shptr o) |
| Add a generic logic model object into the logic model. | |
| void | add_object (Layer_shptr layer, PlacedLogicModelObject_shptr o) |
| void | remove_object (PlacedLogicModelObject_shptr o) |
| Remove a generic logic model object from the logic model. | |
| void | remove_remote_object (object_id_t remote_id) |
| Remove a remote object. | |
| void | add_gate_template (GateTemplate_shptr tmpl) |
| Add a gate template to the gate library and update the logic model. | |
| void | remove_gate_template (GateTemplate_shptr tmpl) |
| Remove a gate template from the gate library and all placed gates that refer to the template. | |
| void | remove_template_references (GateTemplate_shptr tmpl) |
| Remove the reference to a certain gate template from all gates. | |
| void | remove_gates_by_template_type (GateTemplate_shptr tmpl) |
| Remove all gates, that reference a template. | |
| void | add_template_port_to_gate_template (GateTemplate_shptr gate_template, GateTemplatePort_shptr template_port) |
| Add a template port to a gate template and make relevant updates in the logic model. | |
| void | remove_template_port_from_gate_template (GateTemplate_shptr gate_template, GateTemplatePort_shptr template_port) |
| Remove a template port from a gate template and make relevant updates in the logic model. | |
| void | add_layer (layer_position_t pos, Layer_shptr new_layer) |
| Add an empty layer. | |
| void | add_layer (layer_position_t pos) |
| Add an empty layer. | |
| Layer_shptr | get_layer (layer_position_t pos) |
| Get a layer by its posiion index. | |
| Layer_shptr | get_layer_by_id (layer_id_t lid) |
| Get a layer by its ID. | |
| void | remove_layer (layer_position_t pos) |
| Remove a layer. | |
| void | set_layers (layer_collection layers) |
| Set layers. | |
| void | remove_layer (Layer_shptr layer) |
| Remove a layer from the logic model. | |
| void | set_current_layer (layer_position_t pos) |
| Set the current layer you are working on. | |
| Layer_shptr | get_current_layer () |
| Get the current layer. | |
| GateLibrary_shptr | get_gate_library () |
| Get the current gate library for this logic model. | |
| void | set_gate_library (GateLibrary_shptr new_gate_lib) |
| Set the gate library. | |
| void | add_net (Net_shptr net) |
| Add a net to the logic model. | |
| Net_shptr | get_net (object_id_t net_id) |
| Get a net from the logic model. | |
| void | remove_net (Net_shptr net) |
| Remove a net from the logic model. | |
| object_collection::iterator | objects_begin () |
| Get a iterator to iterate over all placeable objects. | |
| object_collection::iterator | objects_end () |
| Get an end iterator for the iteration over all placeable objects. | |
| gate_collection::iterator | gates_begin () |
| Get a iterator to iterate over all gates. | |
| gate_collection::iterator | gates_end () |
| Get an end iterator for the iteration over all gates. | |
| via_collection::iterator | vias_begin () |
| Get a iterator to iterate over all vias. | |
| via_collection::iterator | vias_end () |
| Get an end iterator for the iteration over all vias. | |
| layer_collection::iterator | layers_begin () |
| Get a iterator to iterate over all placeable objects. | |
| layer_collection::iterator | layers_end () |
| Get an end iterator for the iteration over all placeable objects. | |
| net_collection::iterator | nets_begin () |
| Get a iterator to iterate over all nets. | |
| net_collection::iterator | nets_end () |
| Get an end iterator for the iteration over all nets. | |
| annotation_collection::iterator | annotations_begin () |
| Get a iterator to iterate over all annotations. | |
| annotation_collection::iterator | annotations_end () |
| Get an end iterator for the iteration over all annotations. | |
| void | print (std::ostream &os=std::cout) |
| Print the content of the logic model into an ostream. | |
| unsigned int | get_num_layers () const |
| Get number of layers. | |
| void | update_ports (Gate_shptr gate) |
| Compare ports of a gate with template ports of its associated template and update them. | |
| void | update_ports (GateTemplate_shptr gate_template) |
| Compare ports of all gates that reference a given template and update them. | |
| Module_shptr | get_main_module () const |
| Get the main module. | |
| void | set_main_module (Module_shptr main_module) |
| Set main module. | |
| void | reset_removed_remote_objetcs_list () |
| std::list< object_id_t > const & | get_removed_remote_objetcs_list () |
| void | update_roid_mapping (object_id_t remote_oid, object_id_t local_oid) |
| object_id_t | get_local_oid_for_roid (object_id_t remote_oid) |
| void | set_default_gate_port_diameter (diameter_t port_diameter) |
| Set default gate port diameter. | |
Private Types | |
| typedef std::map< object_id_t, object_id_t > | roid_mapping_t |
Private Member Functions | |
| Layer_shptr | get_create_layer (layer_position_t pos) |
| Get a layer. | |
| void | add_wire (int layer_pos, Wire_shptr o) |
| Add a wire into the logic model. | |
| void | add_via (int layer_pos, Via_shptr o) |
| Add a via into the logic model. | |
| void | add_emarker (int layer_pos, EMarker_shptr o) |
| Add an emarker into the logic model. | |
| void | add_annotation (int layer_pos, Annotation_shptr o) |
| Add an annotation into the logic model. | |
| void | add_gate (int layer_pos, Gate_shptr o) |
| Add a gate into the logic model. | |
| void | remove_gate_ports (Gate_shptr o) |
| Remove all ports from the logic model for a given gate. | |
| void | remove_gate (Gate_shptr o) |
| Remove a gate from the logic model. | |
| void | remove_wire (Wire_shptr o) |
| Remove a wire from the logic model. | |
| void | remove_via (Via_shptr o) |
| Remove a via from the logic model. | |
| void | remove_emarker (EMarker_shptr o) |
| Remove an emarker from the logic model. | |
| void | remove_annotation (Annotation_shptr o) |
| Remove an annotation from the logic model. | |
| void | remove_object (PlacedLogicModelObject_shptr o, bool add_to_remove_list) |
| Remove an onject from the logic model and control if the operation should be remembered in delete log. | |
| layer_id_t | get_new_layer_id () |
| Create a new layer ID. | |
| bool | exists_layer_id (layer_collection const &layers, layer_id_t lid) const |
Private Attributes | |
| BoundingBox | bounding_box |
| layer_collection | layers |
| Layer_shptr | current_layer |
| std::tr1::shared_ptr< GateLibrary > | gate_library |
| gate_collection | gates |
| std::map< object_id_t, Wire_shptr > | wires |
| via_collection | vias |
| std::map< object_id_t, EMarker_shptr > | emarkers |
| annotation_collection | annotations |
| net_collection | nets |
| Module_shptr | main_module |
| object_collection | objects |
| Contains any placeable object. | |
| object_id_t | object_id_counter |
| Counter to generate new object IDs. | |
| std::list< object_id_t > | removed_remote_oids |
| List of remote objects, that were deleted from the logic model. | |
| roid_mapping_t | roid_mapping |
| Mapping from remote OIDs to local OIDs. | |
| diameter_t | port_diameter |
This class represents the logic model.
Note: This class is central in degate. So it tends to be somehow bloated. Convinient methods should go into LogicModelHelper.h
Definition at line 60 of file LogicModel.h.
| typedef std::map<object_id_t, Annotation_shptr> degate::LogicModel::annotation_collection |
Definition at line 66 of file LogicModel.h.
| typedef std::map<object_id_t, Gate_shptr > degate::LogicModel::gate_collection |
Definition at line 70 of file LogicModel.h.
| typedef std::vector<Layer_shptr> degate::LogicModel::layer_collection |
Definition at line 69 of file LogicModel.h.
| typedef std::map<object_id_t, Net_shptr> degate::LogicModel::net_collection |
Definition at line 65 of file LogicModel.h.
| typedef std::map<object_id_t, PlacedLogicModelObject_shptr> degate::LogicModel::object_collection |
Definition at line 64 of file LogicModel.h.
typedef std::map<object_id_t, object_id_t> degate::LogicModel::roid_mapping_t [private] |
Definition at line 106 of file LogicModel.h.
| typedef std::map<object_id_t, Via_shptr > degate::LogicModel::via_collection |
Definition at line 67 of file LogicModel.h.
| LogicModel::LogicModel | ( | unsigned int | width, |
| unsigned int | height, | ||
| unsigned int | layers = 0 |
||
| ) |
The constructor for the logic model.
Definition at line 111 of file LogicModel.cc.
References gate_library, get_create_layer(), layers, and set_current_layer().
: bounding_box(width, height), main_module(new Module("main_module", "", true)), object_id_counter(0) { gate_library = GateLibrary_shptr(new GateLibrary()); for(unsigned int i = 0; i < layers; i++) get_create_layer(i); if(layers > 0) set_current_layer(0); }

| LogicModel::~LogicModel | ( | ) | [virtual] |
| void LogicModel::add_annotation | ( | int | layer_pos, |
| Annotation_shptr | o | ||
| ) | [private] |
Add an annotation into the logic model.
If the layer doesn't exists, the layer is created implicitly. If the annotation has no object ID, a new object ID for the via is generated.
| layer_pos | The layer position (starting at 0). |
| o | A shared pointer to the object. |
Definition at line 172 of file LogicModel.cc.
References annotations, and get_new_object_id().
Referenced by add_object().
{
if(o == NULL) throw InvalidPointerException();
if(!o->has_valid_object_id()) o->set_object_id(get_new_object_id());
annotations[o->get_object_id()] = o;
}


| void LogicModel::add_emarker | ( | int | layer_pos, |
| EMarker_shptr | o | ||
| ) | [private] |
Add an emarker into the logic model.
If the layer doesn't exists, the layer is created implicitly. If the emarker has no object ID, a new object ID for the emarker is generated.
| layer_pos | The layer position (starting at 0). |
| o | A shared pointer to the object. |
Definition at line 165 of file LogicModel.cc.
References emarkers, and get_new_object_id().
Referenced by add_object().
{
if(o == NULL) throw InvalidPointerException(); //
if(!o->has_valid_object_id()) o->set_object_id(get_new_object_id());
emarkers[o->get_object_id()] = o;
}


| void LogicModel::add_gate | ( | int | layer_pos, |
| Gate_shptr | o | ||
| ) | [private] |
Add a gate into the logic model.
If the layer doesn't exists, the layer is created implicitly. If the gate has no object ID, a new object ID for the gate is generated. Port are implicitly added, too.
| layer_pos | The layer position (starting at 0). |
| o | A shared pointer to the object. |
Definition at line 178 of file LogicModel.cc.
References add_object(), gates, get_new_object_id(), and main_module.
Referenced by add_object().
{
if(o == NULL) throw InvalidPointerException();
if(!o->has_valid_object_id()) o->set_object_id(get_new_object_id());
gates[o->get_object_id()] = o;
assert(main_module != NULL);
main_module->add_gate(o);
// iterate over ports and add them into the lookup table
for(Gate::port_iterator iter = o->ports_begin(); iter != o->ports_end(); ++iter) {
assert(*iter != NULL);
assert((*iter)->has_valid_object_id() == true);
add_object(layer_pos, std::tr1::dynamic_pointer_cast<PlacedLogicModelObject>(*iter));
}
}


| void LogicModel::add_gate_template | ( | GateTemplate_shptr | tmpl | ) |
Add a gate template to the gate library and update the logic model.
All placed gates that already reference this gate template via an ID become updated. If the template has no object ID defined, a new object ID for the template is set.
| DegateLogicException | Is thrown if there is no gate library. |
Implement update.
should call add_object() for the port
Definition at line 362 of file LogicModel.cc.
References gate_library, and get_new_object_id().
{
if(gate_library != NULL) {
if(!tmpl->has_valid_object_id()) tmpl->set_object_id(get_new_object_id());
gate_library->add_template(tmpl);
//update_gate_ports(tmpl);
// XXX iterate over gates and check tmpl-id -> update
}
else {
throw DegateLogicException("You can't add a gate template, if there is no gate library.");
}
}

| void LogicModel::add_layer | ( | layer_position_t | pos, |
| Layer_shptr | new_layer | ||
| ) |
Add an empty layer.
| DegateLogicException | Throws an exception, if you add a layer on a position where another layer object is already stored. If the layer that should be added already contains logic model objects, this exception is thrown, too. |
Definition at line 545 of file LogicModel.cc.
References current_layer, get_layer(), get_new_layer_id(), and layers.
Referenced by add_layer().
{
if(layers.size() <= pos) layers.resize(pos + 1);
if(layers[pos] != NULL)
throw DegateLogicException("There is already a layer for this layer number.");
else {
if(!new_layer->is_empty()) throw DegateLogicException("You must add an empty layer.");
if(!new_layer->has_valid_layer_id()) new_layer->set_layer_id(get_new_layer_id());
layers[pos] = new_layer;
new_layer->set_layer_pos(pos);
}
if(current_layer == NULL) current_layer = get_layer(0);
if(current_layer == NULL) current_layer = new_layer;
}


| void LogicModel::add_layer | ( | layer_position_t | pos | ) |
Add an empty layer.
Definition at line 563 of file LogicModel.cc.
References add_layer(), and bounding_box.
{
Layer_shptr new_layer(new Layer(bounding_box));
add_layer(pos, new_layer);
}

| void LogicModel::add_net | ( | Net_shptr | net | ) |
Add a net to the logic model.
If the net object has no object ID, a new object ID is set to the net.
| InvalidPointerException | Is thrown, if an invalid pointer was passed as argument. |
Definition at line 653 of file LogicModel.cc.
References get_new_object_id(), and nets.
{
if(net == NULL) throw InvalidPointerException();
if(!net->has_valid_object_id()) net->set_object_id(get_new_object_id());
if(nets.find(net->get_object_id()) != nets.end()) {
boost::format f("Error in add_net(). Net with ID %1% already exists");
f % net->get_object_id();
throw DegateRuntimeException(f.str());
}
nets[net->get_object_id()] = net;
}

| void LogicModel::add_object | ( | int | layer_pos, |
| PlacedLogicModelObject_shptr | o | ||
| ) |
Add a generic logic model object into the logic model.
If the layer doesn't exists, the layer is created implicitly. If the object has no object ID, a new object ID is generated.
This method will set a reference to the layer, where the object is placed, into the object, such that each placed object knows, where on which layer it is placed.
| layer_pos | The layer position (starting at 0). |
| o | A shared pointer to the object. |
| DegateLogicException | This exception is thrown, if an object with the same object ID is already in the logic model. |
Definition at line 240 of file LogicModel.cc.
References add_annotation(), add_emarker(), add_gate(), add_via(), add_wire(), get_create_layer(), get_new_object_id(), objects, and update_roid_mapping().
Referenced by add_gate(), add_object(), and update_ports().
{
if(o == NULL) throw InvalidPointerException();
if(!o->has_valid_object_id()) o->set_object_id(get_new_object_id());
object_id_t object_id = o->get_object_id();
if(Gate_shptr gate = std::tr1::dynamic_pointer_cast<Gate>(o))
add_gate(layer_pos, gate);
else if(Wire_shptr wire = std::tr1::dynamic_pointer_cast<Wire>(o))
add_wire(layer_pos, wire);
else if(Via_shptr via = std::tr1::dynamic_pointer_cast<Via>(o))
add_via(layer_pos, via);
else if(EMarker_shptr via = std::tr1::dynamic_pointer_cast<EMarker>(o))
add_emarker(layer_pos, via);
else if(Annotation_shptr annotation = std::tr1::dynamic_pointer_cast<Annotation>(o))
add_annotation(layer_pos, annotation);
// if it is a RemoteObject, update remote-to-local-id mapping
if(RemoteObject_shptr ro = std::tr1::dynamic_pointer_cast<RemoteObject>(o)) {
update_roid_mapping(ro->get_remote_object_id(), o->get_object_id());
}
if(objects.find(object_id) != objects.end()) {
std::ostringstream stm;
stm << "Logic model object with id " << object_id << " is already stored in the logic model.";
std::cout << stm.str() << std::endl;
throw DegateLogicException(stm.str());
}
else {
objects[object_id] = o;
Layer_shptr layer = get_create_layer(layer_pos);
assert(layer != NULL);
o->set_layer(layer);
layer->add_object(o);
}
assert(objects.find(object_id) != objects.end());
}


| void degate::LogicModel::add_object | ( | Layer_shptr | layer, |
| PlacedLogicModelObject_shptr | o | ||
| ) | [inline] |
Definition at line 292 of file LogicModel.h.
References add_object().
{
add_object(layer->get_layer_pos(), o);
}

| void LogicModel::add_template_port_to_gate_template | ( | GateTemplate_shptr | gate_template, |
| GateTemplatePort_shptr | template_port | ||
| ) |
Add a template port to a gate template and make relevant updates in the logic model.
If you add or remove ports from a gate template, the "real" gates of that type must be updated. The corresponding ports must be added to or removed from the "real" gates.
Definition at line 420 of file LogicModel.cc.
References update_ports().
{
gate_template->add_template_port(template_port);
update_ports(gate_template);
}

| void LogicModel::add_via | ( | int | layer_pos, |
| Via_shptr | o | ||
| ) | [private] |
Add a via into the logic model.
If the layer doesn't exists, the layer is created implicitly. If the via has no object ID, a new object ID for the via is generated.
| layer_pos | The layer position (starting at 0). |
| o | A shared pointer to the object. |
Definition at line 158 of file LogicModel.cc.
References get_new_object_id(), and vias.
Referenced by add_object().
{
if(o == NULL) throw InvalidPointerException(); //
if(!o->has_valid_object_id()) o->set_object_id(get_new_object_id());
vias[o->get_object_id()] = o;
}


| void LogicModel::add_wire | ( | int | layer_pos, |
| Wire_shptr | o | ||
| ) | [private] |
Add a wire into the logic model.
If the layer doesn't exists, the layer is created implicitly. If the wire has no object ID, a new object ID for the wire is generated.
| layer_pos | The layer position (starting at 0). |
| o | A shared pointer to the object. |
Definition at line 151 of file LogicModel.cc.
References get_new_object_id(), and wires.
Referenced by add_object().
{
if(o == NULL) throw InvalidPointerException();
if(!o->has_valid_object_id()) o->set_object_id(get_new_object_id());
wires[o->get_object_id()] = o;
}


| LogicModel::annotation_collection::iterator LogicModel::annotations_begin | ( | ) |
Get a iterator to iterate over all annotations.
Definition at line 753 of file LogicModel.cc.
References annotations.
{
return annotations.begin();
}
| LogicModel::annotation_collection::iterator LogicModel::annotations_end | ( | ) |
Get an end iterator for the iteration over all annotations.
Definition at line 757 of file LogicModel.cc.
References annotations.
{
return annotations.end();
}
| bool LogicModel::exists_layer_id | ( | layer_collection const & | layers, |
| layer_id_t | lid | ||
| ) | const [private] |
Definition at line 91 of file LogicModel.cc.
{
BOOST_FOREACH(Layer_shptr l, layers) {
if(l != NULL && l->has_valid_layer_id() && l->get_layer_id() == lid)
return true;
}
return false;
}
| LogicModel::gate_collection::iterator LogicModel::gates_begin | ( | ) |
Get a iterator to iterate over all gates.
Definition at line 721 of file LogicModel.cc.
References gates.
Referenced by remove_gates_by_template_type(), and remove_template_references().
{
return gates.begin();
}

| LogicModel::gate_collection::iterator LogicModel::gates_end | ( | ) |
Get an end iterator for the iteration over all gates.
Definition at line 725 of file LogicModel.cc.
References gates.
Referenced by remove_gates_by_template_type().
{
return gates.end();
}

| std::tr1::shared_ptr< Layer > LogicModel::get_create_layer | ( | layer_position_t | pos | ) | [private] |
Get a layer.
Create the layer if it doesn't exists.
Definition at line 42 of file LogicModel.cc.
Referenced by add_object(), and LogicModel().

| Layer_shptr LogicModel::get_current_layer | ( | ) |
Get the current layer.
Definition at line 638 of file LogicModel.cc.
References current_layer.
{
return current_layer;
}
| GateLibrary_shptr LogicModel::get_gate_library | ( | ) |
Get the current gate library for this logic model.
Definition at line 642 of file LogicModel.cc.
References gate_library.
{
return gate_library;
}
| unsigned int LogicModel::get_height | ( | ) | const |
Get the height of logic model.
Definition at line 133 of file LogicModel.cc.
References bounding_box, and degate::BoundingBox::get_height().
{
return bounding_box.get_height();
}

| Layer_shptr LogicModel::get_layer | ( | layer_position_t | pos | ) |
Get a layer by its posiion index.
Definition at line 568 of file LogicModel.cc.
References layers.
Referenced by add_layer().
{
return layers.at(pos);
}

| Layer_shptr LogicModel::get_layer_by_id | ( | layer_id_t | lid | ) |
Get a layer by its ID.
| CollectionLookupException | This exception is thrown, if there is no matching layer. |
Definition at line 572 of file LogicModel.cc.
References layers.
{
BOOST_FOREACH(Layer_shptr l, layers) {
if(l->has_valid_layer_id() && l->get_layer_id() == lid)
return l;
}
throw CollectionLookupException("Can't find a matching layer.");
}
| object_id_t LogicModel::get_local_oid_for_roid | ( | object_id_t | remote_oid | ) |
Definition at line 787 of file LogicModel.cc.
References roid_mapping.
{
roid_mapping_t::const_iterator found = roid_mapping.find(remote_oid);
if(found == roid_mapping.end())
return 0;
else {
assert(found->second != 0);
return found->second;
}
}
| Module_shptr LogicModel::get_main_module | ( | ) | const |
Get the main module.
Definition at line 766 of file LogicModel.cc.
References main_module.
{
return main_module;
}
| Net_shptr LogicModel::get_net | ( | object_id_t | net_id | ) |
Get a net from the logic model.
| CollectionLookupException | Is thrown if there is no logic model object with that object ID. |
Definition at line 666 of file LogicModel.cc.
References nets.
{
if(nets.find(net_id) == nets.end()) {
boost::format f("Failed to get net with OID %1%, because it is not registered in the set of nets.");
f % net_id;
throw CollectionLookupException(f.str());
}
return nets[net_id];
}
| layer_id_t LogicModel::get_new_layer_id | ( | ) | [private] |
Create a new layer ID.
Definition at line 541 of file LogicModel.cc.
References get_new_object_id().
Referenced by add_layer().
{
return get_new_object_id();
}


| object_id_t LogicModel::get_new_object_id | ( | ) |
Get a new unique logic model object ID.
Definition at line 99 of file LogicModel.cc.
Referenced by add_annotation(), add_emarker(), add_gate(), add_gate_template(), add_net(), add_object(), add_via(), add_wire(), get_new_layer_id(), and update_ports().
{
object_id_t new_id = ++object_id_counter;
while(objects.find(new_id) != objects.end() ||
(gate_library != NULL && (gate_library->exists_template(new_id) || gate_library->exists_template_port(new_id))) ||
nets.find(new_id) != nets.end() ||
exists_layer_id(layers, new_id) ) {
new_id = ++object_id_counter;
}
return new_id;
}

| unsigned int LogicModel::get_num_layers | ( | ) | const |
Get number of layers.
Definition at line 762 of file LogicModel.cc.
References layers.
{
return layers.size();
}
| PlacedLogicModelObject_shptr LogicModel::get_object | ( | object_id_t | object_id | ) |
Lookup an object from the logic model for a given object ID.
| CollectionLookupException | Is thrown if there is no logic model object with that object ID. |
Definition at line 137 of file LogicModel.cc.
References objects.
Referenced by remove_gate_ports().
{
object_collection::iterator found = objects.find(object_id);
if(found == objects.end()) {
std::ostringstream stm;
stm << "Can't find object with id " << object_id << " in logic model.";
throw CollectionLookupException(stm.str());
}
else {
return found->second;
}
}

| std::list< object_id_t > const & LogicModel::get_removed_remote_objetcs_list | ( | ) |
Definition at line 779 of file LogicModel.cc.
References removed_remote_oids.
{
return removed_remote_oids;
}
| unsigned int LogicModel::get_width | ( | ) | const |
Get the width of logic model.
Definition at line 129 of file LogicModel.cc.
References bounding_box, and degate::BoundingBox::get_width().
{
return bounding_box.get_width();
}

| LogicModel::layer_collection::iterator LogicModel::layers_begin | ( | ) |
Get a iterator to iterate over all placeable objects.
Definition at line 737 of file LogicModel.cc.
References layers.
{
return layers.begin();
}
| LogicModel::layer_collection::iterator LogicModel::layers_end | ( | ) |
Get an end iterator for the iteration over all placeable objects.
Definition at line 741 of file LogicModel.cc.
References layers.
{
return layers.end();
}
| LogicModel::net_collection::iterator LogicModel::nets_begin | ( | ) |
Get a iterator to iterate over all nets.
Definition at line 745 of file LogicModel.cc.
References nets.
{
return nets.begin();
}
| LogicModel::net_collection::iterator LogicModel::nets_end | ( | ) |
Get an end iterator for the iteration over all nets.
Definition at line 749 of file LogicModel.cc.
References nets.
{
return nets.end();
}
| LogicModel::object_collection::iterator LogicModel::objects_begin | ( | ) |
Get a iterator to iterate over all placeable objects.
Definition at line 713 of file LogicModel.cc.
References objects.
{
return objects.begin();
}
| LogicModel::object_collection::iterator LogicModel::objects_end | ( | ) |
Get an end iterator for the iteration over all placeable objects.
Definition at line 717 of file LogicModel.cc.
References objects.
{
return objects.end();
}
| void LogicModel::print | ( | std::ostream & | os = std::cout | ) |
Print the content of the logic model into an ostream.
Definition at line 51 of file LogicModel.cc.
{
os
<< endl
<< "--------------------------------[ Logic model ]--------------------------------" << endl;
for(object_collection::iterator iter = objects.begin(); iter != objects.end(); ++iter) {
os << "\t+ Object: "
<< (*iter).second->get_object_type_name() << " "
<< (*iter).second->get_object_id() << endl;
// XXX dynamic cast and print
}
os << endl;
os
<< endl
<< "--------------------------------[ Gate library ]--------------------------------" << endl;
// print gate library
if(gate_library) gate_library->print(os);
os
<< endl
<< "--------------------------------[ Layers ]--------------------------------" << endl;
// iterate over layers and print them
for(layer_collection::iterator iter = layers.begin();
iter != layers.end(); ++iter) {
Layer_shptr layer = *iter;
layer->print(os);
}
}
| void LogicModel::remove_annotation | ( | Annotation_shptr | o | ) | [private] |
Remove an annotation from the logic model.
| o | A shared pointer to the object. |
Definition at line 232 of file LogicModel.cc.
References annotations.
Referenced by remove_object().
{
if(o == NULL) throw InvalidPointerException();
annotations.erase(o->get_object_id());
}

| void LogicModel::remove_emarker | ( | EMarker_shptr | o | ) | [private] |
Remove an emarker from the logic model.
| o | A shared pointer to the object. |
Definition at line 227 of file LogicModel.cc.
References emarkers.
Referenced by remove_object().
{
if(o == NULL) throw InvalidPointerException();
emarkers.erase(o->get_object_id());
}

| void LogicModel::remove_gate | ( | Gate_shptr | o | ) | [private] |
Remove a gate from the logic model.
This effects the module hierarchy, too.
| o | A shared pointer to the object. |
Definition at line 206 of file LogicModel.cc.
References debug(), gates, main_module, remove_gate_ports(), and TM.
Referenced by remove_object().
{
if(o == NULL) throw InvalidPointerException();
remove_gate_ports(o);
debug(TM, "remove gate");
gates.erase(o->get_object_id());
main_module->remove_gate(o);
}


| void LogicModel::remove_gate_ports | ( | Gate_shptr | o | ) | [private] |
Remove all ports from the logic model for a given gate.
| o | A shared pointer to the object. |
Definition at line 197 of file LogicModel.cc.
References get_object(), and remove_object().
Referenced by remove_gate(), and remove_template_references().
{
if(o == NULL) throw InvalidPointerException();
// iterate over ports and remove them from the lookup table
for(Gate::port_iterator iter = o->ports_begin(); iter != o->ports_end(); ++iter) {
object_id_t port_id = (*iter)->get_object_id();
remove_object(get_object(port_id));
}
}


| void LogicModel::remove_gate_template | ( | GateTemplate_shptr | tmpl | ) |
Remove a gate template from the gate library and all placed gates that refer to the template.
This will destroy gate ports as well.
| DegateLogicException | Is thrown, if there is no gate library. |
should call remove_object() for the port
The method name does not express, that the gates are removed as well. The method should be named remove_template_and_gates() and remove_gate_template() should only unreference and destroy the template.
Definition at line 376 of file LogicModel.cc.
References gate_library, and remove_gates_by_template_type().
{
if(gate_library == NULL)
throw DegateLogicException("You can't remove a gate template, if there is no gate library.");
else {
remove_gates_by_template_type(tmpl);
gate_library->remove_template(tmpl);
}
}

| void LogicModel::remove_gates_by_template_type | ( | GateTemplate_shptr | tmpl | ) |
Remove all gates, that reference a template.
The template is preserved. It will remove the gate ports as well.
Definition at line 400 of file LogicModel.cc.
References gates_begin(), gates_end(), and remove_object().
Referenced by remove_gate_template().
{
if(tmpl == NULL) throw InvalidPointerException("The gate template pointer is invalid.");
std::list<Gate_shptr> gates_to_remove;
for(gate_collection::iterator iter = gates_begin();
iter != gates_end(); ++iter) {
Gate_shptr gate = (*iter).second;
if(gate->get_gate_template() == tmpl)
gates_to_remove.push_back(gate);
}
while(!gates_to_remove.empty()) {
remove_object(gates_to_remove.front());
gates_to_remove.pop_front();
}
}


| void LogicModel::remove_layer | ( | layer_position_t | pos | ) |
Remove a layer.
Definition at line 610 of file LogicModel.cc.
References layers.
Referenced by set_layers().
{
remove_layer(layers.at(pos));
}

| void LogicModel::remove_layer | ( | Layer_shptr | layer | ) |
Remove a layer from the logic model.
A layer contains logical objects. These object are referred in other parts of the logic model. References in other parts must be cleaned as well.
Definition at line 614 of file LogicModel.cc.
References layers, and remove_object().
{
// Iterate over layer objects and place them in a remove list.
std::list<PlacedLogicModelObject_shptr> remove_list;
for(Layer::object_iterator i = layer->objects_begin();
i != layer->objects_end(); ++i) remove_list.push_back(*i);
// Remove objects from logic model.
BOOST_FOREACH(PlacedLogicModelObject_shptr o, remove_list) remove_object(o);
// Unset background image. It will remove the image files, too.
layer->unset_image();
// Remove layer container.
layers.erase(remove(layers.begin(), layers.end(), layer),
layers.end());
}

| void LogicModel::remove_net | ( | Net_shptr | net | ) |
Remove a net from the logic model.
| InvalidPointerException | Is thrown, if an invalid pointer was passed as argument. |
| CollectionLookupException | Is thrown if there is no logic model object with that object ID. |
Definition at line 675 of file LogicModel.cc.
Referenced by remove_object().
{
if(!net->has_valid_object_id())
throw InvalidObjectIDException("The net object has no object ID.");
else if(nets.find(net->get_object_id()) == nets.end()) {
boost::format f("Failed to remove net with OID %1%, because it is not registered in the set of nets.");
f % net->get_object_id();
throw CollectionLookupException(f.str());
}
else {
while(net->size() > 0) {
// get an object ID from the net
object_id_t oid = *(net->begin());
// logic check: this object should be known
if(objects.find(oid) == objects.end()) throw CollectionLookupException();
// the logic model object should be connectable
if(ConnectedLogicModelObject_shptr o =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(objects[oid])) {
// unconnect object from net and net from object
o->remove_net();
}
else
throw DegateLogicException("Can't dynamic cast to a shared ptr of "
"ConnectedLogicModelObject, but the object "
"must be of that type, because it is "
"referenced from a net.");
}
// remove the net
//nets[net->get_object_id()].reset();
size_t n = nets.erase(net->get_object_id());
assert(n == 1);
}
}

| void LogicModel::remove_object | ( | PlacedLogicModelObject_shptr | o | ) |
Remove a generic logic model object from the logic model.
| o | A shared pointer to the object. |
Definition at line 357 of file LogicModel.cc.
References remove_object().
{
remove_object(o, true);
}

| void LogicModel::remove_object | ( | PlacedLogicModelObject_shptr | o, |
| bool | add_to_remove_list | ||
| ) | [private] |
Remove an onject from the logic model and control if the operation should be remembered in delete log.
Definition at line 316 of file LogicModel.cc.
References debug(), objects, remove_annotation(), remove_emarker(), remove_gate(), remove_net(), remove_via(), remove_wire(), removed_remote_oids, roid_mapping, and TM.
Referenced by remove_gate_ports(), remove_gates_by_template_type(), remove_layer(), remove_object(), remove_remote_object(), and update_ports().
{
if(o == NULL) throw InvalidPointerException();
Layer_shptr layer = o->get_layer();
if(layer == NULL) {
debug(TM, "warning: object has no layer");
}
else {
if(ConnectedLogicModelObject_shptr clmo =
std::tr1::dynamic_pointer_cast<ConnectedLogicModelObject>(o)) {
Net_shptr net = clmo->get_net();
clmo->remove_net();
if(net != NULL && net->size()==0) remove_net(net);
}
if(Gate_shptr gate = std::tr1::dynamic_pointer_cast<Gate>(o))
remove_gate(gate);
else if(Wire_shptr wire = std::tr1::dynamic_pointer_cast<Wire>(o))
remove_wire(wire);
else if(Via_shptr via = std::tr1::dynamic_pointer_cast<Via>(o))
remove_via(via);
else if(EMarker_shptr emarker = std::tr1::dynamic_pointer_cast<EMarker>(o))
remove_emarker(emarker);
else if(Annotation_shptr annotation = std::tr1::dynamic_pointer_cast<Annotation>(o))
remove_annotation(annotation);
if(RemoteObject_shptr ro = std::tr1::dynamic_pointer_cast<RemoteObject>(o)) {
// remember to send a was-removed-message to the collaboration server
if(add_to_remove_list) removed_remote_oids.push_back(ro->get_remote_object_id());
// remove entry from remote-to-local-id mapping
roid_mapping.erase(ro->get_remote_object_id());
}
layer->remove_object(o);
}
objects.erase(o->get_object_id());
}


| void LogicModel::remove_remote_object | ( | object_id_t | remote_id | ) |
Remove a remote object.
| InvalidObjectIDException | This exception is thrown, if remote_id is invalid. |
Definition at line 281 of file LogicModel.cc.
References debug(), objects, remove_object(), and TM.
{
debug(TM, "Should remove object with remote ID %d from lmodel.", remote_id);
if(remote_id == 0)
throw InvalidObjectIDException("Parameter passed to remove_remote_object() is invalid.");
debug(TM, "Should remove object with remote ID %d from lmodel - 2.", remote_id);
BOOST_FOREACH(object_collection::value_type const& p, objects) {
PlacedLogicModelObject_shptr plo = p.second;
RemoteObject_shptr ro;
if(ro = std::tr1::dynamic_pointer_cast<RemoteObject>(plo)) {
object_id_t local_id = plo->get_object_id();
debug(TM, "found remote object with remote ID %d and local ID = %d.",
ro->get_remote_object_id(), local_id);
if(ro->get_remote_object_id() == remote_id) {
debug(TM, "Removed object with remote ID %d and local ID = %d from lmodel.",
remote_id, local_id);
remove_object(plo, false);
object_collection::iterator found = objects.find(local_id);
assert(found == objects.end());
return;
}
}
}
}

| void LogicModel::remove_template_port_from_gate_template | ( | GateTemplate_shptr | gate_template, |
| GateTemplatePort_shptr | template_port | ||
| ) |
Remove a template port from a gate template and make relevant updates in the logic model.
If you add or remove ports from a gate template, the "real" gates of that type must be updated. The corresponding ports must be added to or removed from the "real" gates. This method does this.
Definition at line 427 of file LogicModel.cc.
References update_ports().
{
gate_template->remove_template_port(template_port);
update_ports(gate_template);
}

| void LogicModel::remove_template_references | ( | GateTemplate_shptr | tmpl | ) |
Remove the reference to a certain gate template from all gates.
This will destroy gate ports as well.
| DegateLogicException | Is thrown, if there is no gate library. |
Definition at line 385 of file LogicModel.cc.
References gate_library, gates, gates_begin(), and remove_gate_ports().
{
if(gate_library == NULL)
throw DegateLogicException("You can't remove a gate template, if there is no gate library.");
for(gate_collection::iterator iter = gates_begin();
iter != gates.end(); ++iter) {
Gate_shptr gate = (*iter).second;
if(gate->get_gate_template() == tmpl) {
remove_gate_ports(gate);
gate->remove_template();
}
}
}

| void LogicModel::remove_via | ( | Via_shptr | o | ) | [private] |
Remove a via from the logic model.
| o | A shared pointer to the object. |
Definition at line 221 of file LogicModel.cc.
References vias.
Referenced by remove_object().
{
if(o == NULL) throw InvalidPointerException();
vias.erase(o->get_object_id());
//removed_remote_oids.push_back(o->get_remote_object_id());
}

| void LogicModel::remove_wire | ( | Wire_shptr | o | ) | [private] |
Remove a wire from the logic model.
| o | A shared pointer to the object. |
Definition at line 216 of file LogicModel.cc.
References wires.
Referenced by remove_object().
{
if(o == NULL) throw InvalidPointerException();
wires.erase(o->get_object_id());
}

| void LogicModel::reset_removed_remote_objetcs_list | ( | ) |
Definition at line 775 of file LogicModel.cc.
References removed_remote_oids.
{
removed_remote_oids.clear();
}
| void LogicModel::set_current_layer | ( | layer_position_t | pos | ) |
Set the current layer you are working on.
Definition at line 634 of file LogicModel.cc.
References current_layer, and layers.
Referenced by LogicModel().
{
current_layer = layers[pos];
}

| void LogicModel::set_default_gate_port_diameter | ( | diameter_t | port_diameter | ) |
Set default gate port diameter.
Definition at line 797 of file LogicModel.cc.
References port_diameter.
{
this->port_diameter = port_diameter;
}
| void LogicModel::set_gate_library | ( | GateLibrary_shptr | new_gate_lib | ) |
Set the gate library.
Definition at line 646 of file LogicModel.cc.
References gate_library.
{
if(gate_library != NULL) {
// XXX
}
gate_library = new_gate_lib;
}
| void LogicModel::set_layers | ( | layer_collection | layers | ) |
Set layers.
Definition at line 581 of file LogicModel.cc.
References layers, and remove_layer().
{
std::list<Layer_shptr> layers_to_remove;
if(this->layers.size() > 0) {
/*
We have a vector of old layers and should set a vector with new layers.
Therefore we need to get a list of layers to remove.
*/
// iterate over present (old) layers
for(layer_collection::const_iterator i = this->layers.begin(); i != this->layers.end(); ++i) {
bool found_in_new = false;
for(layer_collection::const_iterator i2 = layers.begin(); i2 != layers.end(); ++i2) {
if((*i2)->get_layer_id() == (*i)->get_layer_id()) found_in_new = true;
}
if(!found_in_new) layers_to_remove.push_back(*i);
}
}
BOOST_FOREACH(Layer_shptr l, layers_to_remove) remove_layer(l);
// set new layers
this->layers = layers;
}

| void LogicModel::set_main_module | ( | Module_shptr | main_module | ) |
Set main module.
Definition at line 770 of file LogicModel.cc.
References main_module.
{
this->main_module = main_module;
main_module->set_main_module(); // set the root-node-state
}
| void LogicModel::update_ports | ( | Gate_shptr | gate | ) |
Compare ports of a gate with template ports of its associated template and update them.
Definition at line 434 of file LogicModel.cc.
References add_object(), debug(), get_new_object_id(), port_diameter, remove_object(), and TM.
Referenced by add_template_port_to_gate_template(), remove_template_port_from_gate_template(), and update_ports().
{
bool d = gate->get_object_id() == 639;
if(gate == NULL)
throw InvalidPointerException("Invalid parameter for update_ports()");
GateTemplate_shptr gate_template = gate->get_gate_template();
debug(TM, "update ports on gate %d", gate->get_object_id());
// in a first iteration over all template ports from the corresponding template
// we check if there are gate ports to add
if(gate->has_template()) {
// iterate over template ports from the corresponding template
debug(TM, "compare ports for gate with oid=%d with corresponding template (oid=%d)", gate->get_object_id(), gate_template->get_object_id());
for(GateTemplate::port_iterator tmpl_port_iter = gate_template->ports_begin();
tmpl_port_iter != gate_template->ports_end(); ++tmpl_port_iter) {
GateTemplatePort_shptr tmpl_port = *tmpl_port_iter;
assert(tmpl_port != NULL);
if(!gate->has_template_port(tmpl_port) && gate->has_orientation()) {
debug(TM, "adding a new port to gate, because the gate has no reference to the gate port template %d.", tmpl_port->get_object_id());
GatePort_shptr new_gate_port(new GatePort(gate, tmpl_port, port_diameter));
new_gate_port->set_object_id(get_new_object_id());
gate->add_port(new_gate_port); // will set coordinates, too
assert(gate->get_layer() != NULL);
add_object(gate->get_layer()->get_layer_pos(), new_gate_port);
}
}
}
std::list<GatePort_shptr> ports_to_remove;
// iterate over gate ports
for(Gate::port_iterator port_iter = gate->ports_begin();
port_iter != gate->ports_end(); ++port_iter) {
//debug(TM, "iterating over ports");
GatePort_shptr gate_port = *port_iter;
assert(gate_port != NULL);
if(gate->has_template()) {
GateTemplate_shptr tmpl = gate->get_gate_template();
assert(tmpl != NULL);
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
assert(tmpl_port != NULL);
bool has_template_port = tmpl->has_template_port(tmpl_port->get_object_id());
if(has_template_port) {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
// reset port coordinates
if(gate->has_orientation()) {
unsigned int x, y;
x = gate->get_relative_x_position_within_gate(tmpl_port->get_x());
y = gate->get_relative_y_position_within_gate(tmpl_port->get_y());
gate_port->set_x(x + gate->get_min_x());
gate_port->set_y(y + gate->get_min_y());
gate_port->set_name(tmpl_port->get_name());
}
}
// unset port coordinates
else {
debug(TM, "should remove port with oid=%d from gate with oid %d", gate_port->get_object_id(), gate->get_object_id());
ports_to_remove.push_back(gate_port);
}
}
else {
debug(TM, "should remove port with oid=%d from gate with oid=%d, because gate has no template", gate_port->get_object_id(), gate->get_object_id());
ports_to_remove.push_back(gate_port);
}
}
for(std::list<GatePort_shptr>::iterator iter = ports_to_remove.begin();
iter != ports_to_remove.end(); ++iter) {
debug(TM, "remove real port:");
(*iter)->print();
gate->remove_port(*iter);
remove_object(*iter);
}
}


| void LogicModel::update_ports | ( | GateTemplate_shptr | gate_template | ) |
Compare ports of all gates that reference a given template and update them.
Definition at line 524 of file LogicModel.cc.
References debug(), gates, TM, and update_ports().
{
if(gate_template == NULL)
throw InvalidPointerException("Invalid parameter for update_ports()");
// iterate over all gates ...
for(gate_collection::iterator g_iter = gates.begin();
g_iter != gates.end(); ++g_iter) {
Gate_shptr gate = (*g_iter).second;
if(gate->get_gate_template() == gate_template) {
debug(TM, "update ports on gate with id %d", gate->get_object_id());
update_ports(gate);
}
}
}

| void LogicModel::update_roid_mapping | ( | object_id_t | remote_oid, |
| object_id_t | local_oid | ||
| ) |
Definition at line 783 of file LogicModel.cc.
References roid_mapping.
Referenced by add_object().
{
roid_mapping[remote_oid] = local_oid;
}

| LogicModel::via_collection::iterator LogicModel::vias_begin | ( | ) |
Get a iterator to iterate over all vias.
Definition at line 729 of file LogicModel.cc.
References vias.
{
return vias.begin();
}
| LogicModel::via_collection::iterator LogicModel::vias_end | ( | ) |
Get an end iterator for the iteration over all vias.
Definition at line 733 of file LogicModel.cc.
References vias.
{
return vias.end();
}
Definition at line 85 of file LogicModel.h.
Referenced by add_annotation(), annotations_begin(), annotations_end(), and remove_annotation().
BoundingBox degate::LogicModel::bounding_box [private] |
Definition at line 74 of file LogicModel.h.
Referenced by add_layer(), get_height(), and get_width().
Layer_shptr degate::LogicModel::current_layer [private] |
Definition at line 77 of file LogicModel.h.
Referenced by add_layer(), get_current_layer(), and set_current_layer().
std::map<object_id_t, EMarker_shptr > degate::LogicModel::emarkers [private] |
Definition at line 84 of file LogicModel.h.
Referenced by add_emarker(), and remove_emarker().
std::tr1::shared_ptr<GateLibrary> degate::LogicModel::gate_library [private] |
Definition at line 79 of file LogicModel.h.
Referenced by add_gate_template(), get_gate_library(), LogicModel(), remove_gate_template(), remove_template_references(), and set_gate_library().
gate_collection degate::LogicModel::gates [private] |
Definition at line 81 of file LogicModel.h.
Referenced by add_gate(), gates_begin(), gates_end(), remove_gate(), remove_template_references(), and update_ports().
layer_collection degate::LogicModel::layers [private] |
Definition at line 76 of file LogicModel.h.
Referenced by add_layer(), get_layer(), get_layer_by_id(), get_num_layers(), layers_begin(), layers_end(), LogicModel(), remove_layer(), set_current_layer(), and set_layers().
Module_shptr degate::LogicModel::main_module [private] |
Definition at line 87 of file LogicModel.h.
Referenced by add_gate(), get_main_module(), remove_gate(), and set_main_module().
net_collection degate::LogicModel::nets [private] |
Definition at line 86 of file LogicModel.h.
Referenced by add_net(), get_net(), nets_begin(), nets_end(), and remove_net().
Counter to generate new object IDs.
Definition at line 98 of file LogicModel.h.
object_collection degate::LogicModel::objects [private] |
Contains any placeable object.
Definition at line 92 of file LogicModel.h.
Referenced by add_object(), get_object(), objects_begin(), objects_end(), remove_net(), remove_object(), and remove_remote_object().
diameter_t degate::LogicModel::port_diameter [private] |
Definition at line 113 of file LogicModel.h.
Referenced by set_default_gate_port_diameter(), and update_ports().
std::list<object_id_t> degate::LogicModel::removed_remote_oids [private] |
List of remote objects, that were deleted from the logic model.
Definition at line 104 of file LogicModel.h.
Referenced by get_removed_remote_objetcs_list(), remove_object(), and reset_removed_remote_objetcs_list().
Mapping from remote OIDs to local OIDs.
Definition at line 111 of file LogicModel.h.
Referenced by get_local_oid_for_roid(), remove_object(), and update_roid_mapping().
via_collection degate::LogicModel::vias [private] |
Definition at line 83 of file LogicModel.h.
Referenced by add_via(), remove_via(), vias_begin(), and vias_end().
std::map<object_id_t, Wire_shptr > degate::LogicModel::wires [private] |
Definition at line 82 of file LogicModel.h.
Referenced by add_wire(), and remove_wire().
1.7.4