degate  0.1.2
RuleChecker.h
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003   This file is part of the IC reverse engineering tool degate.
00004 
00005   Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007   Degate is free software: you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation, either version 3 of the License, or
00010   any later version.
00011 
00012   Degate is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __RULECHECKER_H__
00023 #define __RULECHECKER_H__
00024 
00025 #include <RCBase.h>
00026 #include <ERCOpenPorts.h>
00027 #include <ERCNet.h>
00028 
00029 namespace degate {
00030 
00031   class RuleChecker : public RCBase {
00032 
00033   private:
00034 
00035     std::list<RCBase_shptr> checks;
00036 
00037   public:
00038 
00039     RuleChecker() : RCBase("rc-all", "A collection of all RCs.") {
00040       checks.push_back(RCBase_shptr(new ERCOpenPorts()));
00041       checks.push_back(RCBase_shptr(new ERCNet()));
00042     }
00043 
00044     void run(LogicModel_shptr lmodel) {
00045 
00046       debug(TM, "run RC");
00047 
00048       clear_rc_violations();
00049 
00050       BOOST_FOREACH(RCBase_shptr check, checks) {
00051         std::cout << "RC: " << check->get_rc_class_name() << std::endl;
00052         check->run(lmodel);
00053         BOOST_FOREACH(RCViolation_shptr violation, check->get_rc_violations()) {
00054           add_rc_violation(violation);
00055         }
00056       }
00057 
00058       debug(TM, "found %d rc violations.", get_rc_violations().size());
00059     }
00060   };
00061 
00062 }
00063 
00064 #endif