2 Copyright 2010 Intel Corporation
4 Use, modification and distribution are subject to the Boost Software License,
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
8 #include "schematic_database.hpp"
9 #include "layout_pin.hpp"
10 #include "layout_rectangle.hpp"
11 #include "connectivity_database.hpp"
12 #include "compare_schematics.hpp"
13 #include "extract_devices.hpp"
14 #include "parse_layout.hpp"
15 #include "layout_database.hpp"
21 bool compare_files(std::string layout_file
, std::string schematic_file
) {
22 std::ifstream
sin(schematic_file
.c_str());
23 std::ifstream
lin(layout_file
.c_str());
25 std::vector
<layout_rectangle
> rects
;
26 std::vector
<layout_pin
> pins
;
27 parse_layout(rects
, pins
, lin
);
29 schematic_database reference_schematic
;
30 parse_schematic_database(reference_schematic
, sin
);
32 layout_database layout
;
33 populate_layout_database(layout
, rects
);
35 connectivity_database connectivity
;
36 populate_connectivity_database(connectivity
, pins
, layout
);
38 schematic_database schematic
;
39 std::vector
<device
>& devices
= schematic
.devices
;
40 for(std::size_t i
= 0; i
< pins
.size(); ++i
) {
41 devices
.push_back(device());
42 devices
.back().type
= "PIN";
43 devices
.back().terminals
.push_back(pins
[i
].net
);
45 extract_devices(devices
, connectivity
, layout
);
46 extract_netlist(schematic
.nets
, devices
);
48 return compare_schematics(reference_schematic
, schematic
);
51 int main(int argc
, char **argv
) {
53 std::cout
<< "usage: " << argv
[0] << " <layout_file> <schematic_file>" << std::endl
;
56 bool result
= compare_files(argv
[1], argv
[2]);
58 std::cout
<< "Layout does not match schematic." << std::endl
;
61 std::cout
<< "Layout does match schematic." << std::endl
;