From 28e22769068fc41f8c87349a180e76565a2c297b Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 6 Jun 2018 17:08:31 +0200 Subject: Add simple SVG generator to ice40 main Signed-off-by: Clifford Wolf --- ice40/main.cc | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'ice40/main.cc') diff --git a/ice40/main.cc b/ice40/main.cc index afdd1a4a..a32aa2db 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -24,6 +24,22 @@ #include #include "pybindings.h" +void svg_dump_el(const GraphicElement &el) +{ + float scale = 10.0; + std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\""; + + if (el.type == GraphicElement::G_BOX) { + std::cout << "\n"; + } + + if (el.type == GraphicElement::G_LINE) { + std::cout << "\n"; + } +} + int main(int argc, char *argv[]) { namespace po = boost::program_options; @@ -34,6 +50,7 @@ int main(int argc, char *argv[]) options.add_options()("help,h","show help"); options.add_options()("test","just a check"); options.add_options()("gui","start gui"); + options.add_options()("svg","dump SVG file"); options.add_options()("file", po::value(), "python file to execute"); options.add_options()("version,v","show version"); @@ -71,6 +88,11 @@ int main(int argc, char *argv[]) return 1; } + ChipArgs chipArgs; + chipArgs.type = ChipArgs::LP384; + + Design design(chipArgs); + if (vm.count("gui")) { QApplication a(argc, argv); @@ -82,10 +104,6 @@ int main(int argc, char *argv[]) if (vm.count("test")) { - ChipArgs chipArgs; - chipArgs.type = ChipArgs::LP384; - - Design design(chipArgs); int bel_count = 0, wire_count = 0, pip_count = 0; std::cout << "Checking bel names.\n"; @@ -143,6 +161,20 @@ int main(int argc, char *argv[]) return 0; } + if (vm.count("svg")) + { + std::cout << "\n"; + for (auto bel : design.chip.getBels()) { + std::cout << "\n"; + for (auto &el : design.chip.getBelGraphics(bel)) + svg_dump_el(el); + } + std::cout << "\n"; + for (auto &el : design.chip.getFrameGraphics()) + svg_dump_el(el); + std::cout << "\n"; + } + if (vm.count("file")) { std::string filename = vm["file"].as(); -- cgit v1.2.3