|
degate 0.1.1
|
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 __VIAMATCHING_H__ 00023 #define __VIAMATCHING_H__ 00024 00025 #include <Image.h> 00026 #include <Project.h> 00027 #include <TemplateMatching.h> 00028 #include <Via.h> 00029 00030 namespace degate { 00031 00032 class ViaMatching : public Matching { 00033 00034 private: 00035 00036 Layer_shptr layer; 00037 LogicModel_shptr lmodel; 00038 00039 double threshold_match; 00040 unsigned int via_diameter, merge_n_vias; 00041 BackgroundImage_shptr img; 00042 00043 BoundingBox bounding_box; 00044 00045 public: 00046 00047 typedef struct { 00048 unsigned int x, y; // absolut coordinates of the left upper corner 00049 double correlation; // the correlation value 00050 } match_found; 00051 00052 public: 00053 00054 ViaMatching(); 00055 00056 /** 00057 * @exception InvalidPointerException This exception is thrown, if \p 00058 * project is an invalid pointer. 00059 * @exception DegateRuntimeException This exception is thrown, if there 00060 * is no current layer in the logic model. This should not happen. 00061 */ 00062 virtual void init(BoundingBox const& bounding_box, Project_shptr project); 00063 00064 /** 00065 * Run the algorithm. 00066 * @exception DegateLogicException This exception is thrown, if the diameter was not set. 00067 */ 00068 virtual void run(); 00069 00070 void set_threshold_match(double threshold_match); 00071 void set_merge_n_vias(unsigned int merge_n_vias); 00072 double get_threshold_match() const; 00073 unsigned int get_merge_n_vias() const; 00074 00075 /** 00076 * Set the diameter for vias. 00077 */ 00078 void set_diameter(unsigned int diameter); 00079 00080 private: 00081 void scan(BoundingBox const& bbox, BackgroundImage_shptr bg_img, 00082 MemoryImage_GS_BYTE_shptr tmpl_img, Via::DIRECTION direction); 00083 00084 bool add_via(unsigned int x, unsigned int y, 00085 unsigned int diameter, 00086 Via::DIRECTION direction, 00087 double corr_val, double threshold_hc); 00088 00089 }; 00090 00091 typedef std::tr1::shared_ptr<ViaMatching> ViaMatching_shptr; 00092 } 00093 00094 #endif
1.7.4