1 package net.mograsim.logic.model.examples;
3 import java.io.IOException;
4 import java.nio.file.Files;
5 import java.nio.file.Path;
6 import java.util.Map.Entry;
8 import net.mograsim.logic.model.am2900.Am2900Loader;
9 import net.mograsim.logic.model.model.LogicModelModifiable;
10 import net.mograsim.logic.model.model.components.ModelComponent;
11 import net.mograsim.logic.model.modeladapter.CoreModelParameters;
12 import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
13 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
15 public class CountGatesPerComponent
17 public static void main(String[] args) throws IOException
21 Path root = Path.of("components");
22 Files.walk(root).map(Path::toString).filter(s -> s.endsWith(".json")).map("jsonfile:"::concat)
23 .forEach(CountGatesPerComponent::printGatesPerComponent);
26 private static void printGatesPerComponent(String componentID)
28 LogicModelModifiable model = new LogicModelModifiable();
29 IndirectModelComponentCreator.createComponent(model, componentID);
31 LogicCoreAdapter.gateCountsPerComponentClass.clear();
32 LogicCoreAdapter.convert(model, new CoreModelParameters());
34 System.out.println(componentID + ':');
35 for (Entry<Class<? extends ModelComponent>, Integer> e : LogicCoreAdapter.gateCountsPerComponentClass.entrySet())
36 System.out.println(" " + e.getKey().getSimpleName() + ": " + e.getValue());