SILICON
Loading...
Searching...
No Matches
simulation_perf.cpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <core/circuit.hpp>
19#include <core/flipflops.hpp>
20#include <core/gates.hpp>
21#include <core/simulator.hpp>
22#include <logging/logger.hpp>
24
25#include <algorithm>
26#include <array>
27#include <chrono>
28#include <cstddef>
29#include <cstdlib>
30#include <exception>
31#include <functional>
32#include <iostream>
33#include <memory>
34#include <string>
35#include <string_view>
36#include <vector>
37
38using namespace SILICON::core;
39using namespace SILICON::simulation;
40using namespace SILICON::waveform;
41using namespace SILICON::logging;
42
43namespace {
44
45using Clock = std::chrono::steady_clock;
46
47struct Options {
48 std::string scenario = "all";
49 std::size_t width = 128;
50 std::size_t depth = 64;
51 std::size_t iterations = 100;
52 bool selfDesc = false;
53};
54
55struct CircuitBench {
56 std::shared_ptr<Circuit> circuit;
57 std::vector<Bus> inputs;
58 std::vector<Bus> outputs;
59 std::size_t components = 0;
60 std::size_t wires = 0;
61};
62
63struct Measurement {
64 CircuitBench bench;
65 double buildMs = 0.0;
66};
67
68double elapsedMs(const Clock::time_point start, const Clock::time_point end)
69{
70 return std::chrono::duration<double, std::milli>(end - start).count();
71}
72
73void setZeroDelay(const Component_ptr& component)
74{
75 component->setProperty("delay", 0);
76}
77
78Wire_ptr makeWire(const State state = State::LOW)
79{
80 return std::make_shared<Wire>(state);
81}
82
83void addGate(Component_set& components, const Component_ptr& gate,
84 const bool zeroDelay = true)
85{
86 if (zeroDelay)
87 setZeroDelay(gate);
88 components.insert(gate);
89}
90
91Measurement makeLayeredCircuit(const std::size_t width, const std::size_t depth)
92{
93 const auto start = Clock::now();
94
95 Component_set components;
96 std::vector<Wire_ptr> current;
97 std::vector<Bus> inputs;
98 current.reserve(width);
99 inputs.reserve(width);
100
101 for (std::size_t i = 0; i < width; ++i) {
102 auto wire = makeWire(i % 2 == 0 ? State::LOW : State::HIGH);
103 inputs.push_back(Bus{wire});
104 current.push_back(std::move(wire));
105 }
106
107 std::size_t wireCount = current.size();
108 for (std::size_t layer = 0; layer < depth; ++layer) {
109 std::vector<Wire_ptr> next;
110 next.reserve(width);
111
112 for (std::size_t bit = 0; bit < width; ++bit) {
113 auto output = makeWire(State::UNKNOWN);
114 const auto left = current[bit];
115 const auto right = current[(bit + layer + 1) % width];
116
117 switch ((layer + bit) % 3) {
118 case 0:
119 addGate(components,
120 std::make_shared<AndGate>(std::vector<Wire_ptr>{left, right}, output));
121 break;
122 case 1:
123 addGate(components,
124 std::make_shared<OrGate>(std::vector<Wire_ptr>{left, right}, output));
125 break;
126 default:
127 addGate(components, std::make_shared<XorGate>(
128 std::array<Wire_ptr, 2>{left, right}, output));
129 break;
130 }
131
132 next.push_back(std::move(output));
133 }
134
135 wireCount += next.size();
136 current = std::move(next);
137 }
138
139 std::vector<Bus> outputs;
140 outputs.reserve(current.size());
141 for (const auto& wire : current)
142 outputs.push_back(Bus{wire});
143
144 CircuitBench bench;
145 bench.circuit = std::make_shared<Circuit>(components, false);
146 bench.inputs = std::move(inputs);
147 bench.outputs = std::move(outputs);
148 bench.components = components.size();
149 bench.wires = wireCount;
150
151 return {std::move(bench), elapsedMs(start, Clock::now())};
152}
153
154Measurement makeFanoutCircuit(const std::size_t width, const std::size_t depth)
155{
156 const auto start = Clock::now();
157
158 Component_set components;
159 const auto root = makeWire(State::LOW);
160 std::vector<Bus> inputs{Bus{root}};
161 std::vector<Bus> outputs;
162 std::size_t wireCount = 1;
163
164 outputs.reserve(width);
165 for (std::size_t branch = 0; branch < width; ++branch) {
166 auto current = root;
167 auto salt = makeWire(branch % 2 == 0 ? State::LOW : State::HIGH);
168 ++wireCount;
169
170 for (std::size_t stage = 0; stage < depth; ++stage) {
171 auto output = makeWire(State::UNKNOWN);
172 if ((stage + branch) % 2 == 0) {
173 addGate(components,
174 std::make_shared<AndGate>(std::vector<Wire_ptr>{current, salt}, output));
175 } else {
176 addGate(components,
177 std::make_shared<OrGate>(std::vector<Wire_ptr>{current, salt}, output));
178 }
179 current = std::move(output);
180 ++wireCount;
181 }
182
183 outputs.push_back(Bus{current});
184 }
185
186 CircuitBench bench;
187 bench.circuit = std::make_shared<Circuit>(components, false);
188 bench.inputs = std::move(inputs);
189 bench.outputs = std::move(outputs);
190 bench.components = components.size();
191 bench.wires = wireCount;
192
193 return {std::move(bench), elapsedMs(start, Clock::now())};
194}
195
196Measurement makeDelayedChainsCircuit(const std::size_t width, const std::size_t depth)
197{
198 const auto start = Clock::now();
199
200 Component_set components;
201 std::vector<Bus> inputs;
202 std::vector<Bus> outputs;
203 std::size_t wireCount = 0;
204
205 inputs.reserve(width);
206 outputs.reserve(width);
207 for (std::size_t chain = 0; chain < width; ++chain) {
208 auto current = makeWire(chain % 2 == 0 ? State::LOW : State::HIGH);
209 inputs.push_back(Bus{current});
210 ++wireCount;
211
212 for (std::size_t stage = 0; stage < depth; ++stage) {
213 auto output = makeWire(State::UNKNOWN);
214 auto gate = std::make_shared<NotGate>(current, output);
215 gate->setProperty("delay", 1);
216 components.insert(gate);
217 current = std::move(output);
218 ++wireCount;
219 }
220
221 outputs.push_back(Bus{current});
222 }
223
224 CircuitBench bench;
225 bench.circuit = std::make_shared<Circuit>(components, false);
226 bench.inputs = std::move(inputs);
227 bench.outputs = std::move(outputs);
228 bench.components = components.size();
229 bench.wires = wireCount;
230
231 return {std::move(bench), elapsedMs(start, Clock::now())};
232}
233
234Measurement makeCyclicCombinationalCircuit(const std::size_t width,
235 const std::size_t depth)
236{
237 const auto start = Clock::now();
238
239 Component_set components;
240 std::vector<Bus> inputs;
241 std::vector<Bus> outputs;
242 std::size_t wireCount = 0;
243
244 inputs.reserve(width);
245 outputs.reserve(width);
246 for (std::size_t ring = 0; ring < width; ++ring) {
247 const auto forcingInput = makeWire(ring % 2 == 0 ? State::HIGH : State::LOW);
248 inputs.push_back(Bus{forcingInput});
249 ++wireCount;
250
251 std::vector<Wire_ptr> ringWires;
252 ringWires.reserve(depth);
253 for (std::size_t stage = 0; stage < depth; ++stage) {
254 ringWires.push_back(makeWire(State::UNKNOWN));
255 ++wireCount;
256 }
257
258 for (std::size_t stage = 0; stage < depth; ++stage) {
259 const auto input = ringWires[stage];
260 const auto output = ringWires[(stage + 1) % depth];
261
262 if ((stage + ring) % 2 == 0) {
263 addGate(components, std::make_shared<OrGate>(
264 std::vector<Wire_ptr>{input, forcingInput}, output));
265 } else {
266 addGate(components, std::make_shared<AndGate>(
267 std::vector<Wire_ptr>{input, forcingInput}, output));
268 }
269 }
270
271 outputs.push_back(Bus{ringWires.front()});
272 }
273
274 CircuitBench bench;
275 bench.circuit = std::make_shared<Circuit>(components, false);
276 bench.inputs = std::move(inputs);
277 bench.outputs = std::move(outputs);
278 bench.components = components.size();
279 bench.wires = wireCount;
280
281 return {std::move(bench), elapsedMs(start, Clock::now())};
282}
283
284Measurement makeRegisteredCyclicCircuit(const std::size_t width, const std::size_t depth)
285{
286 const auto start = Clock::now();
287
288 Component_set components;
289 const auto clock = makeWire(State::LOW);
290 const auto clear = makeWire(State::LOW);
291 const auto preset = makeWire(State::LOW);
292
293 std::vector<Bus> inputs{Bus{clock}};
294 std::vector<Bus> outputs;
295 std::vector<Wire_ptr> qWires;
296 std::vector<Wire_ptr> dWires;
297 std::size_t wireCount = 3;
298
299 qWires.reserve(width);
300 dWires.reserve(width);
301 outputs.reserve(width);
302 for (std::size_t bit = 0; bit < width; ++bit) {
303 qWires.push_back(makeWire(bit % 2 == 0 ? State::LOW : State::HIGH));
304 dWires.push_back(makeWire(State::UNKNOWN));
305 outputs.push_back(Bus{qWires.back()});
306 wireCount += 2;
307 }
308
309 for (std::size_t bit = 0; bit < width; ++bit) {
310 auto current = qWires[(bit + width - 1) % width];
311 for (std::size_t stage = 0; stage < depth; ++stage) {
312 const auto output = stage + 1 == depth ? dWires[bit] : makeWire(State::UNKNOWN);
313 addGate(components, std::make_shared<NotGate>(current, output));
314 current = output;
315 if (stage + 1 != depth)
316 ++wireCount;
317 }
318
319 auto notQ = makeWire(State::UNKNOWN);
320 auto ff =
321 std::make_shared<DFlipFlop>(dWires[bit], clock, clear, preset, qWires[bit], notQ);
322 ff->setProperty("propagationDelay", 0);
323 components.insert(ff);
324 ++wireCount;
325 }
326
327 CircuitBench bench;
328 bench.circuit = std::make_shared<Circuit>(components, false);
329 bench.inputs = std::move(inputs);
330 bench.outputs = std::move(outputs);
331 bench.components = components.size();
332 bench.wires = wireCount;
333
334 return {std::move(bench), elapsedMs(start, Clock::now())};
335}
336
337std::size_t checksum(const std::vector<Bus>& buses)
338{
339 std::size_t result = 0;
340 for (const auto& bus : buses) {
341 for (const auto state : bus.getCurrentValue())
342 result = result * 131U + static_cast<std::size_t>(std::to_underlying(state));
343 result = result * 17U + static_cast<std::size_t>(bus.hasUnknowns());
344 result = result * 17U + static_cast<std::size_t>(bus.isInErrorState());
345 }
346 return result;
347}
348
349template <typename Value>
350void printMetric(const std::string_view name, const Value& value,
351 const std::string_view description, const bool selfDesc)
352{
353 std::cout << " " << name << ": " << value;
354 if (selfDesc)
355 std::cout << " # " << description;
356 std::cout << '\n';
357}
358
359void printScenarioHeader(const std::string_view name, const std::string_view description,
360 const Measurement& measurement, const bool selfDesc)
361{
362 std::cout << name << '\n';
363 if (selfDesc)
364 printMetric("description", description, "scenario topology and measured behavior",
365 selfDesc);
366 printMetric("components", measurement.bench.components,
367 "number of simulated components in this generated circuit", selfDesc);
368 printMetric("wires", measurement.bench.wires,
369 "number of wires allocated by this generated circuit", selfDesc);
370 printMetric("build_ms", measurement.buildMs,
371 "milliseconds spent constructing the generated circuit", selfDesc);
372}
373
374void printUsage(const char* executable)
375{
376 std::cout
377 << "Usage: " << executable
378 << " [--scenario all|layered|fanout|delayed|cyclic|registered-cyclic]"
379 " [--width N]"
380 " [--depth N] [--iterations N] [--selfdesc]\n\n"
381 << "Runs self-contained simulator performance testbenches.\n\n"
382 << "Scenarios:\n"
383 << " layered wide acyclic gate layers; measures forward "
384 "propagation\n"
385 << " fanout one input feeding many gate chains; measures fanout "
386 "propagation\n"
387 << " delayed NOT chains with unit gate delays; measures event "
388 "queue draining\n"
389 << " cyclic forced combinational rings; measures cyclic "
390 "settling\n"
391 << " registered-cyclic flip-flop feedback rings; measures clocked "
392 "feedback\n\n"
393 << "Options:\n"
394 << " --width N number of parallel bits, branches, chains, or rings\n"
395 << " --depth N number of gate stages per topology\n"
396 << " --iterations N number of input toggles or clock cycles to measure\n"
397 << " --selfdesc include metric descriptions in benchmark output\n";
398}
399
400std::size_t parseSize(const char* value, const std::string_view option)
401{
402 try {
403 const auto parsed = std::stoull(value);
404 if (parsed == 0)
405 throw std::invalid_argument("zero");
406 return parsed;
407 } catch (const std::exception&) {
408 throw std::invalid_argument(std::string(option) + " expects a positive integer");
409 }
410}
411
412Options parseOptions(const int argc, char** argv)
413{
414 Options options;
415 for (int i = 1; i < argc; ++i) {
416 const std::string_view arg = argv[i];
417 auto requireValue = [&](const std::string_view option) -> char* {
418 if (i + 1 >= argc)
419 throw std::invalid_argument(std::string(option) + " requires a value");
420 return argv[++i];
421 };
422
423 if (arg == "--help" || arg == "-h") {
424 printUsage(argv[0]);
425 std::exit(0);
426 } else if (arg == "--scenario") {
427 options.scenario = requireValue(arg);
428 } else if (arg == "--width") {
429 options.width = parseSize(requireValue(arg), arg);
430 } else if (arg == "--depth") {
431 options.depth = parseSize(requireValue(arg), arg);
432 } else if (arg == "--iterations") {
433 options.iterations = parseSize(requireValue(arg), arg);
434 } else if (arg == "--selfdesc") {
435 options.selfDesc = true;
436 } else {
437 throw std::invalid_argument("unknown option: " + std::string(arg));
438 }
439 }
440
441 return options;
442}
443
444void runPropagationBenchmark(const std::string_view name, Measurement measurement,
445 const std::string_view description,
446 const std::size_t iterations, const bool selfDesc)
447{
448 const auto simulatorStart = Clock::now();
449 Simulator simulator(measurement.bench.circuit);
450 const auto simulatorMs = elapsedMs(simulatorStart, Clock::now());
451
452 const auto runStart = Clock::now();
453 for (std::size_t iteration = 0; iteration < iterations; ++iteration) {
454 const auto value = static_cast<unsigned int>(iteration & 1U);
455 for (const auto& input : measurement.bench.inputs) {
456 if (simulator.setBus(input, busValueFromInteger(value, input.size()))
458 throw std::runtime_error("setBus did not complete");
459 }
460 if (simulator.runUntilIdle() != Simulator::RunResult::Completed)
461 throw std::runtime_error("runUntilIdle did not complete");
462 }
463 const auto runMs = elapsedMs(runStart, Clock::now());
464
465 printScenarioHeader(name, description, measurement, selfDesc);
466 printMetric("simulator_construct_ms", simulatorMs,
467 "milliseconds spent constructing the Simulator from the circuit", selfDesc);
468 printMetric("iterations", iterations,
469 "number of input toggle and settle rounds measured", selfDesc);
470 printMetric("propagation_ms", runMs,
471 "total milliseconds spent applying inputs and settling propagation",
472 selfDesc);
473 printMetric("propagation_ms_per_iteration", runMs / iterations,
474 "average propagation milliseconds per input toggle and settle round",
475 selfDesc);
476 printMetric("checksum", checksum(measurement.bench.outputs),
477 "hash of final output states used to keep the benchmark work observable",
478 selfDesc);
479 std::cout << '\n';
480}
481
482void runDelayedBenchmark(Measurement measurement, const bool selfDesc)
483{
484 const auto previousMaxSteps = Simulator::getMaxSimulationSteps();
486 std::max<uint64_t>(previousMaxSteps, measurement.bench.components * 4U));
487
488 const auto simulatorStart = Clock::now();
489 Simulator simulator(measurement.bench.circuit);
490 const auto simulatorMs = elapsedMs(simulatorStart, Clock::now());
491
492 const auto runStart = Clock::now();
493 if (simulator.runUntilIdle() != Simulator::RunResult::Completed)
494 throw std::runtime_error("delayed benchmark did not reach idle");
495 const auto runMs = elapsedMs(runStart, Clock::now());
496
497 Simulator::setMaxSimulationSteps(previousMaxSteps);
498
499 printScenarioHeader("delayed",
500 "parallel NOT chains with unit gate delays; drains pending "
501 "events until idle",
502 measurement, selfDesc);
503 printMetric("simulator_construct_ms", simulatorMs,
504 "milliseconds spent constructing the Simulator from the circuit", selfDesc);
505 printMetric("event_queue_drain_ms", runMs,
506 "milliseconds spent processing delayed events until the queue reached idle",
507 selfDesc);
508 printMetric("final_time", simulator.getCurrentTime(),
509 "simulated timestamp reached after all delayed events settled", selfDesc);
510 printMetric("checksum", checksum(measurement.bench.outputs),
511 "hash of final output states used to keep the benchmark work observable",
512 selfDesc);
513 std::cout << '\n';
514}
515
516void runCyclicBenchmark(Measurement measurement, const std::size_t iterations,
517 const bool selfDesc)
518{
519 const auto previousMaxTransitions = Simulator::getMaxTransitionsPerDeltaCycle();
521 std::max<std::size_t>(previousMaxTransitions, measurement.bench.components * 4U)));
522
523 const auto simulatorStart = Clock::now();
524 Simulator simulator(measurement.bench.circuit);
525 const auto simulatorMs = elapsedMs(simulatorStart, Clock::now());
526
527 const auto runStart = Clock::now();
528 for (std::size_t iteration = 0; iteration < iterations; ++iteration) {
529 const auto value = static_cast<unsigned int>(iteration & 1U);
530 for (const auto& input : measurement.bench.inputs) {
531 if (simulator.setBus(input, busValueFromInteger(value, input.size()))
533 throw std::runtime_error("cyclic setBus did not complete");
534 }
535 if (simulator.runUntilIdle() != Simulator::RunResult::Completed)
536 throw std::runtime_error("cyclic benchmark did not reach idle");
537 }
538 const auto runMs = elapsedMs(runStart, Clock::now());
539
540 Simulator::setMaxTransitionsPerDeltaCycle(previousMaxTransitions);
541
542 printScenarioHeader("cyclic",
543 "combinational rings forced by external inputs; measures "
544 "delta-cycle settling",
545 measurement, selfDesc);
546 printMetric("simulator_construct_ms", simulatorMs,
547 "milliseconds spent constructing the Simulator from the circuit", selfDesc);
548 printMetric("iterations", iterations,
549 "number of cyclic input toggle and settle rounds measured", selfDesc);
550 printMetric("cyclic_settle_ms", runMs,
551 "total milliseconds spent toggling cyclic inputs and resolving "
552 "delta-cycle feedback",
553 selfDesc);
554 printMetric("cyclic_settle_ms_per_iteration", runMs / iterations,
555 "average cyclic settling milliseconds per input toggle round", selfDesc);
556 printMetric("checksum", checksum(measurement.bench.outputs),
557 "hash of final output states used to keep the benchmark work observable",
558 selfDesc);
559 std::cout << '\n';
560}
561
562void runRegisteredCyclicBenchmark(Measurement measurement, const std::size_t iterations,
563 const bool selfDesc)
564{
565 const auto simulatorStart = Clock::now();
566 Simulator simulator(measurement.bench.circuit);
567 const auto simulatorMs = elapsedMs(simulatorStart, Clock::now());
568
569 const auto runStart = Clock::now();
570 const auto clock = measurement.bench.inputs.front();
571 for (std::size_t iteration = 0; iteration < iterations; ++iteration) {
572 if (simulator.setBus(clock, busValueFromInteger(1, clock.size()))
574 throw std::runtime_error("registered cyclic rising clock did not complete");
575 if (simulator.runUntilIdle() != Simulator::RunResult::Completed)
576 throw std::runtime_error("registered cyclic rising settle did not complete");
577 if (simulator.setBus(clock, busValueFromInteger(0, clock.size()))
579 throw std::runtime_error("registered cyclic falling clock did not complete");
580 if (simulator.runUntilIdle() != Simulator::RunResult::Completed)
581 throw std::runtime_error("registered cyclic falling settle did not complete");
582 }
583 const auto runMs = elapsedMs(runStart, Clock::now());
584
585 printScenarioHeader("registered-cyclic",
586 "D flip-flop feedback rings separated by combinational NOT "
587 "chains; measures clocked feedback",
588 measurement, selfDesc);
589 printMetric("simulator_construct_ms", simulatorMs,
590 "milliseconds spent constructing the Simulator from the circuit", selfDesc);
591 printMetric("clock_cycles", iterations,
592 "number of full rising-plus-falling clock cycles measured", selfDesc);
593 printMetric("clocked_ms", runMs,
594 "total milliseconds spent clocking and settling registered feedback",
595 selfDesc);
596 printMetric("clocked_ms_per_cycle", runMs / iterations,
597 "average milliseconds per full clock cycle", selfDesc);
598 printMetric("checksum", checksum(measurement.bench.outputs),
599 "hash of final output states used to keep the benchmark work observable",
600 selfDesc);
601 std::cout << '\n';
602}
603
604bool shouldRun(const std::string& selected, const std::string_view scenario)
605{
606 return selected == "all" || selected == scenario;
607}
608
609} // namespace
610
611int main(int argc, char** argv)
612{
613 try {
615
616 const auto options = parseOptions(argc, argv);
617 if (!shouldRun(options.scenario, "layered") && !shouldRun(options.scenario, "fanout")
618 && !shouldRun(options.scenario, "delayed")
619 && !shouldRun(options.scenario, "cyclic")
620 && !shouldRun(options.scenario, "registered-cyclic")) {
621 throw std::invalid_argument(
622 "scenario must be all, layered, fanout, delayed, cyclic, or "
623 "registered-cyclic");
624 }
625
626 std::cout << "simulation_perf\n";
627 if (options.selfDesc)
628 printMetric("description", "self-contained simulator performance testbench",
629 "what this executable runs", options.selfDesc);
630 printMetric("scenario", options.scenario,
631 "selected topology group; all runs every scenario", options.selfDesc);
632 printMetric("width", options.width,
633 "parallel bits, branches, chains, or rings generated per scenario",
634 options.selfDesc);
635 printMetric("depth", options.depth, "gate stages generated per topology path",
636 options.selfDesc);
637 printMetric("iterations", options.iterations,
638 "input toggles or clock cycles requested for measured scenarios",
639 options.selfDesc);
640 std::cout << '\n';
641
642 if (shouldRun(options.scenario, "layered")) {
643 runPropagationBenchmark("layered", makeLayeredCircuit(options.width, options.depth),
644 "wide acyclic layers of AND/OR/XOR gates; measures "
645 "forward propagation",
646 options.iterations, options.selfDesc);
647 }
648
649 if (shouldRun(options.scenario, "fanout")) {
650 runPropagationBenchmark("fanout", makeFanoutCircuit(options.width, options.depth),
651 "one root input feeding many AND/OR gate chains; "
652 "measures fanout propagation",
653 options.iterations, options.selfDesc);
654 }
655
656 if (shouldRun(options.scenario, "delayed")) {
657 runDelayedBenchmark(makeDelayedChainsCircuit(options.width, options.depth),
658 options.selfDesc);
659 }
660
661 if (shouldRun(options.scenario, "cyclic")) {
662 runCyclicBenchmark(makeCyclicCombinationalCircuit(options.width, options.depth),
663 options.iterations, options.selfDesc);
664 }
665
666 if (shouldRun(options.scenario, "registered-cyclic")) {
667 runRegisteredCyclicBenchmark(
668 makeRegisteredCyclicCircuit(options.width, options.depth), options.iterations,
669 options.selfDesc);
670 }
671 } catch (const std::exception& e) {
672 std::cerr << "simulation_perf: " << e.what() << '\n';
673 printUsage(argv[0]);
674 return 1;
675 }
676
677 return 0;
678}
static void setMinimumLevel(LogLevel level)
Definition logger.cpp:231
Executes event-driven simulation of a Circuit.
Definition simulator.hpp:74
static uint64_t getMaxSimulationSteps()
static void setMaxSimulationSteps(uint64_t value)
static void setMaxTransitionsPerDeltaCycle(int value)
static int getMaxTransitionsPerDeltaCycle()
int width(RTLIL::Module *module, RTLIL::Cell *cell, RTLIL::IdString key)
std::optional< Gate > gate(Cell *cell, SigMap &signals)
std::shared_ptr< Component > Component_ptr
std::shared_ptr< Wire > Wire_ptr
Definition wire.hpp:116
std::set< Component_ptr, std::owner_less< Component_ptr > > Component_set
Definition wire.hpp:54
BusValue busValueFromInteger(const BigInt &value, const std::size_t width)
Builds an LSB-first BusValue from the low width bits of an integer. Negative values use two's complem...
QVariant value(const QSettings &settings, const Definition &setting)
Reads a setting value, falling back to its declared default when unset.
int main(int argc, char **argv)