|
degate 0.1.1
|
Electrical Rule Checks that detects unusual net configurations. More...
#include <ERCNet.h>

Public Member Functions | |
| ERCNet () | |
| void | run (LogicModel_shptr lmodel) |
| The run method is abstract and must be implemented in derived classes. | |
Private Member Functions | |
| void | check_net (LogicModel_shptr lmodel, Net_shptr net) |
Electrical Rule Checks that detects unusual net configurations.
These cases are checked:
It is possible, that the port direction is still undefined, because the user forgot to define it. This could be checked with a dedicated RC for gate template ports, but in order to simplify it, we generate a violation entry here. The drawback is, that it will generate more entries than necessary, because the template port direction is implicitly checked multiple times.
| ERCNet::ERCNet | ( | ) |
| void ERCNet::check_net | ( | LogicModel_shptr | lmodel, |
| Net_shptr | net | ||
| ) | [private] |
Definition at line 44 of file ERCNet.cc.
References degate::RCBase::add_rc_violation().
Referenced by run().
{
unsigned int
in_ports = 0,
out_ports = 0,
inout_ports = 0;
// iterate over all objects from a net
for(Net::connection_iterator c_iter = net->begin();
c_iter != net->end(); ++c_iter) {
object_id_t oid = *c_iter;
PlacedLogicModelObject_shptr plo = lmodel->get_object(oid);
if(GatePort_shptr gate_port = std::tr1::dynamic_pointer_cast<GatePort>(plo)) {
assert(gate_port->has_template_port() == true); // can't happen
if(gate_port->has_template_port()) {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
// Count in- and out-ports. Inout-ports must be counted first, because is_*port() will return true
// for inout-ports.
if(tmpl_port->is_inoutport()) inout_ports++;
if(tmpl_port->is_inport()) in_ports++;
else if(tmpl_port->is_outport()) out_ports++;
else {
boost::format f("For the corresponding gate template port of %1% the port "
"direction is undefined.");
f % gate_port->get_descriptive_identifier();
add_rc_violation(RCViolation_shptr(new RCViolation(gate_port, f.str(),
"undef_port_dir")));
}
}
}
}
if((in_ports > 0 && out_ports == 0) || (out_ports > 1)) {
for(Net::connection_iterator c_iter = net->begin();
c_iter != net->end(); ++c_iter) {
object_id_t oid = *c_iter;
PlacedLogicModelObject_shptr plo = lmodel->get_object(oid);
if(GatePort_shptr gate_port = std::tr1::dynamic_pointer_cast<GatePort>(plo)) {
GateTemplatePort_shptr tmpl_port = gate_port->get_template_port();
std::string error_msg;
std::string rc_class;
if(in_ports > 0 && out_ports == 0) {
boost::format f("In-Port %1% is not feeded. It is only connected "
"with %2% other in-ports.");
f % gate_port->get_descriptive_identifier() % (in_ports - 1);
error_msg = f.str();
rc_class = "net.not_feeded";
add_rc_violation(RCViolation_shptr(new RCViolation(gate_port, error_msg, rc_class)));
}
else if(out_ports > 1) {
if(tmpl_port->is_outport()) {
boost::format f("Out-Port %1% is connected with %2% other out-ports.");
f % gate_port->get_descriptive_identifier() % (out_ports - 1);
error_msg = f.str();
rc_class = "net.outputs_connected";
add_rc_violation(RCViolation_shptr(new RCViolation(gate_port, error_msg, rc_class)));
}
}
}
}
}
}


| void ERCNet::run | ( | LogicModel_shptr | lmodel | ) | [virtual] |
The run method is abstract and must be implemented in derived classes.
The implementation should check for design rule violations. Each RC violation must be stored via method add_rc_violation(). Note: Because run() can be called multiple times, at the beginning of run() you must clear the list of detected violations.
Implements degate::RCBase.
Definition at line 30 of file ERCNet.cc.
References check_net(), and degate::RCBase::clear_rc_violations().
{
clear_rc_violations();
if(lmodel == NULL) return;
// iterate over nets
for(LogicModel::net_collection::iterator net_iter = lmodel->nets_begin();
net_iter != lmodel->nets_end(); ++net_iter) {
check_net(lmodel, (*net_iter).second);
}
}

1.7.4