|
degate 0.1.1
|
#include <LookupSubcircuit.h>
Public Member Functions | |
| LookupSubcircuit (LogicModel_shptr _lmodel) | |
| Construct a new net. | |
| virtual | ~LookupSubcircuit () |
| Destroy. | |
| virtual void | search () |
| void | trace_recursive (Gate_shptr start_gate, std::set< Gate_shptr > &closed_list) |
| std::set< Gate_shptr > | filter_connected_gates (Gate_shptr gate, GateTemplatePort::PORT_TYPE src_port_type, std::string const &src_port_name, std::string const &logic_class, GateTemplatePort::PORT_TYPE dst_port_type, std::string const &dst_port_name) const |
Check if there is a port on gate of type src_port_type that shares a net with another gate of type logic_class. | |
Protected Member Functions | |
| virtual void | initialize_openlist () |
Private Attributes | |
| LogicModel_shptr | lmodel |
| std::list< Gate_shptr > | openlist |
Definition at line 37 of file LookupSubcircuit.h.
| degate::LookupSubcircuit::LookupSubcircuit | ( | LogicModel_shptr | _lmodel | ) | [inline] |
| virtual degate::LookupSubcircuit::~LookupSubcircuit | ( | ) | [inline, virtual] |
| std::set<Gate_shptr> degate::LookupSubcircuit::filter_connected_gates | ( | Gate_shptr | gate, |
| GateTemplatePort::PORT_TYPE | src_port_type, | ||
| std::string const & | src_port_name, | ||
| std::string const & | logic_class, | ||
| GateTemplatePort::PORT_TYPE | dst_port_type, | ||
| std::string const & | dst_port_name | ||
| ) | const [inline] |
Check if there is a port on gate of type src_port_type that shares a net with another gate of type logic_class.
Definition at line 126 of file LookupSubcircuit.h.
References degate::get_port_type(), degate::get_template_port_name(), degate::is_logic_class(), and lmodel.
Referenced by trace_recursive().
{
std::set<Gate_shptr> connected;
for(Gate::port_iterator iter = gate->ports_begin();
iter != gate->ports_end(); ++iter) {
GatePort_shptr gport = *iter;
if(get_port_type(gport) == src_port_type) {
Net_shptr net = gport->get_net();
if(net != NULL) {
BOOST_FOREACH(object_id_t oid, *net) {
if(oid != gport->get_object_id()) {
PlacedLogicModelObject_shptr plmo = lmodel->get_object(oid);
assert(plmo != NULL);
if(GatePort_shptr other_port = std::tr1::dynamic_pointer_cast<GatePort>(plmo)) {
Gate_shptr other_gate = other_port->get_gate();
if(is_logic_class(other_gate, logic_class) &&
get_port_type(other_port) == dst_port_type) {
if((src_port_name.empty() && dst_port_name.empty()) ||
(src_port_name.empty() && dst_port_name == get_template_port_name(other_port)) ||
(dst_port_name.empty() && src_port_name == get_template_port_name(gport)) ||
(src_port_name == get_template_port_name(gport) &&
dst_port_name == get_template_port_name(other_port)))
connected.insert(other_gate);
}
}
}
}
}
}
}
return connected;
}


| virtual void degate::LookupSubcircuit::initialize_openlist | ( | ) | [inline, protected, virtual] |
Definition at line 46 of file LookupSubcircuit.h.
References degate::is_logic_class(), lmodel, and openlist.
Referenced by search().
{
// initialize openlist
for(LogicModel::gate_collection::const_iterator iter = lmodel->gates_begin();
iter != lmodel->gates_end(); ++iter) {
Gate_shptr gate = iter->second;
assert(gate != NULL);
if(is_logic_class(gate, "flipflop") ||
is_logic_class(gate, "xor") ||
is_logic_class(gate, "xnor")) openlist.push_back(gate);
}
}


| virtual void degate::LookupSubcircuit::search | ( | ) | [inline, virtual] |
Definition at line 74 of file LookupSubcircuit.h.
References initialize_openlist(), and openlist.
{
initialize_openlist();
Gate_shptr g = openlist.front();
openlist.pop_front();
/*
trace_recursive(g);
BOOST_FOREACH(Gate_shptr gate, openlist) {
}
*/
}

| void degate::LookupSubcircuit::trace_recursive | ( | Gate_shptr | start_gate, |
| std::set< Gate_shptr > & | closed_list | ||
| ) | [inline] |
Definition at line 92 of file LookupSubcircuit.h.
References filter_connected_gates(), degate::GateTemplatePort::PORT_TYPE_IN, and degate::GateTemplatePort::PORT_TYPE_OUT.
{
std::cout << "Gate " << start_gate->get_descriptive_identifier() << " connected with: " << std::endl;
std::set<Gate_shptr> other_gates;
BOOST_FOREACH(Gate_shptr g,
filter_connected_gates(start_gate, GateTemplatePort::PORT_TYPE_OUT, "Q",
"flipflop", GateTemplatePort::PORT_TYPE_IN, "D"))
if(closed_list.find(g) != closed_list.end()) {
other_gates.insert(g);
closed_list.insert(g);
}
BOOST_FOREACH(Gate_shptr g,
filter_connected_gates(start_gate, GateTemplatePort::PORT_TYPE_IN, "D",
"flipflop", GateTemplatePort::PORT_TYPE_OUT, "Q"))
if(closed_list.find(g) != closed_list.end()) {
other_gates.insert(g);
closed_list.insert(g);
}
BOOST_FOREACH(Gate_shptr g2, other_gates) {
std::cout << "\tGate " << g2->get_descriptive_identifier() << std::endl;
trace_recursive(g2, closed_list);
}
}

Definition at line 41 of file LookupSubcircuit.h.
Referenced by filter_connected_gates(), and initialize_openlist().
std::list<Gate_shptr> degate::LookupSubcircuit::openlist [private] |
Definition at line 42 of file LookupSubcircuit.h.
Referenced by initialize_openlist(), and search().
1.7.4