CIRCT  20.0.0git
Firtool.cpp
Go to the documentation of this file.
1 //===- Firtool.cpp - Definitions for the firtool pipeline setup -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
18 #include "circt/Support/Passes.h"
20 #include "mlir/Transforms/Passes.h"
21 #include "llvm/Support/FileSystem.h"
22 #include "llvm/Support/Path.h"
23 
24 using namespace llvm;
25 using namespace circt;
26 
27 LogicalResult firtool::populatePreprocessTransforms(mlir::PassManager &pm,
28  const FirtoolOptions &opt) {
29  pm.nest<firrtl::CircuitOp>().addPass(
31  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createCheckLayers());
32  // Legalize away "open" aggregates to hw-only versions.
33  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerOpenAggsPass());
34 
35  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createResolvePathsPass());
36 
37  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerFIRRTLAnnotationsPass(
42 
43  if (opt.shouldEnableDebugInfo())
44  pm.nest<firrtl::CircuitOp>().addNestedPass<firrtl::FModuleOp>(
46 
47  pm.nest<firrtl::CircuitOp>().addPass(
49  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
51 
52  return success();
53 }
54 
55 LogicalResult firtool::populateCHIRRTLToLowFIRRTL(mlir::PassManager &pm,
56  const FirtoolOptions &opt,
57  StringRef inputFilename) {
58  // TODO: Ensure instance graph and other passes can handle instance choice
59  // then run this pass after all diagnostic passes have run.
60  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createSpecializeOptionPass(
62  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerSignaturesPass());
63 
64  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createInjectDUTHierarchyPass());
65 
66  if (!opt.shouldDisableOptimization()) {
67  if (opt.shouldDisableCSEinClasses())
68  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
69  mlir::createCSEPass());
70  else
71  pm.nest<firrtl::CircuitOp>().nestAny().addPass(mlir::createCSEPass());
72  }
73 
74  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
76 
77  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
79 
80  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
82 
83  // Run LowerMatches before InferWidths, as the latter does not support the
84  // match statement, but it does support what they lower to.
85  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
87 
88  // Width inference creates canonicalization opportunities.
89  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createInferWidthsPass());
90 
91  pm.nest<firrtl::CircuitOp>().addPass(
94 
95  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createInferResetsPass());
96 
97  if (opt.shouldExportChiselInterface()) {
98  StringRef outdir = opt.getChiselInterfaceOutputDirectory();
99  if (opt.isDefaultOutputFilename() && outdir.empty()) {
100  pm.nest<firrtl::CircuitOp>().addPass(createExportChiselInterfacePass());
101  } else {
102  if (outdir.empty())
103  outdir = opt.getOutputFilename();
104  pm.nest<firrtl::CircuitOp>().addPass(
106  }
107  }
108 
109  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createDropConstPass());
110 
111  if (opt.shouldDedup())
112  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createDedupPass());
113 
114  if (opt.shouldConvertVecOfBundle()) {
115  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createLowerFIRRTLTypesPass(
117  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createVBToBVPass());
118  }
119 
120  if (!opt.shouldLowerMemories())
121  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
123 
124  // The input mlir file could be firrtl dialect so we might need to clean
125  // things up.
126  // pm.addNestedPass<firrtl::CircuitOp>(firrtl::createLowerSignaturesPass());
127  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createLowerFIRRTLTypesPass(
128  opt.getPreserveAggregate(), firrtl::PreserveAggregate::None));
129 
130  {
131  auto &modulePM = pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>();
132  modulePM.addPass(firrtl::createExpandWhensPass());
133  modulePM.addPass(firrtl::createSFCCompatPass());
134  }
135 
136  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createCheckCombLoopsPass());
137 
138  // Must run this pass after all diagnostic passes have run, otherwise it can
139  // hide errors.
140  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createSpecializeLayersPass());
141 
142  // Run after inference, layer specialization.
144  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createProbesToSignalsPass());
145 
146  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createInlinerPass());
147 
148  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
150 
151  // Preset the random initialization parameters for each module. The current
152  // implementation assumes it can run at a time where every register is
153  // currently in the final module it will be emitted in, all registers have
154  // been created, and no registers have yet been removed.
155  if (opt.isRandomEnabled(FirtoolOptions::RandomKind::Reg))
156  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
158 
159  // If we parsed a FIRRTL file and have optimizations enabled, clean it up.
160  if (!opt.shouldDisableOptimization())
161  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
163 
164  // Run the infer-rw pass, which merges read and write ports of a memory with
165  // mutually exclusive enables.
166  if (!opt.shouldDisableOptimization())
167  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
169 
171  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerMemoryPass());
172 
173  if (opt.shouldAddCompanionAssume())
174  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
176 
177  if (!opt.shouldDisableOptimization())
178  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createIMConstPropPass());
179 
180  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createAddSeqMemPortsPass());
181 
185 
186  pm.addNestedPass<firrtl::CircuitOp>(firrtl::createExtractInstancesPass());
187 
188  // Run passes to resolve Grand Central features. This should run before
189  // BlackBoxReader because Grand Central needs to inform BlackBoxReader where
190  // certain black boxes should be placed. Note: all Grand Central Taps related
191  // collateral is resolved entirely by LowerAnnotations.
192  pm.addNestedPass<firrtl::CircuitOp>(
194 
195  // Run SymbolDCE as late as possible, but before InnerSymbolDCE. This is for
196  // hierpathop's and just for general cleanup.
197  pm.addNestedPass<firrtl::CircuitOp>(mlir::createSymbolDCEPass());
198 
199  // Run InnerSymbolDCE as late as possible, but before IMDCE.
200  pm.addPass(firrtl::createInnerSymbolDCEPass());
201 
202  // The above passes, IMConstProp in particular, introduce additional
203  // canonicalization opportunities that we should pick up here before we
204  // proceed to output-specific pipelines.
205  if (!opt.shouldDisableOptimization()) {
206  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
208  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
210  // Re-run IMConstProp to propagate constants produced by register
211  // optimizations.
212  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createIMConstPropPass());
213  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
215  pm.addPass(firrtl::createIMDeadCodeElimPass());
216  }
217 
218  // Always run this, required for legalization.
219  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
222 
223  if (!opt.shouldDisableOptimization())
224  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
226 
227  // Layer lowering passes. Move operations into layers when possible and
228  // remove layers by converting them to other constructs. This lowering
229  // process can create a few optimization opportunities.
230  //
231  // TODO: Improve LowerLayers to avoid the need for canonicalization. See:
232  // https://github.com/llvm/circt/issues/7896
233  if (!opt.shouldDisableLayerSink()) {
234  if (opt.shouldAdvancedLayerSink())
235  pm.nest<firrtl::CircuitOp>().addPass(
237  else
238  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
240  }
241  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerLayersPass());
242  if (!opt.shouldDisableOptimization())
243  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
245 
246  auto outputFilename = opt.getOutputFilename();
247  if (outputFilename == "-")
248  outputFilename = "";
249 
250  pm.nest<firrtl::CircuitOp>().addPass(
251  firrtl::createAssignOutputDirsPass(outputFilename));
252 
253  // Read black box source files into the IR.
254  StringRef blackBoxRoot = opt.getBlackBoxRootPath().empty()
255  ? llvm::sys::path::parent_path(inputFilename)
256  : opt.getBlackBoxRootPath();
257  pm.nest<firrtl::CircuitOp>().addPass(
258  firrtl::createBlackBoxReaderPass(blackBoxRoot));
259  return success();
260 }
261 
262 LogicalResult firtool::populateLowFIRRTLToHW(mlir::PassManager &pm,
263  const FirtoolOptions &opt) {
264  // Remove TraceAnnotations and write their updated paths to an output
265  // annotation file.
266  pm.nest<firrtl::CircuitOp>().addPass(
268 
269  // Lower the ref.resolve and ref.send ops and remove the RefType ports.
270  // LowerToHW cannot handle RefType so, this pass must be run to remove all
271  // RefType ports and ops.
272  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerXMRPass());
273 
274  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerDPIPass());
275  pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerClassesPass());
276  pm.nest<firrtl::CircuitOp>().addPass(om::createVerifyObjectFieldsPass());
277 
278  // Check for static asserts.
279  pm.nest<firrtl::CircuitOp>().nest<firrtl::FModuleOp>().addPass(
281 
283  opt.getVerificationFlavor()));
284 
285  if (!opt.shouldDisableOptimization()) {
286  auto &modulePM = pm.nest<hw::HWModuleOp>();
287  modulePM.addPass(mlir::createCSEPass());
288  modulePM.addPass(createSimpleCanonicalizerPass());
289  }
290 
291  // Check inner symbols and inner refs.
293 
294  // Check OM object fields.
295  pm.addPass(om::createVerifyObjectFieldsPass());
296 
297  // Run the verif op verification pass
298  pm.addNestedPass<hw::HWModuleOp>(verif::createVerifyClockedAssertLikePass());
299 
300  return success();
301 }
302 
303 LogicalResult firtool::populateHWToSV(mlir::PassManager &pm,
304  const FirtoolOptions &opt) {
305  pm.addPass(verif::createLowerFormalToHWPass());
306 
307  if (opt.shouldExtractTestCode())
312 
314  pm.addPass(circt::createLowerSimToSVPass());
316  {/*disableRegRandomization=*/!opt.isRandomEnabled(
317  FirtoolOptions::RandomKind::Reg),
318  /*disableMemRandomization=*/
319  !opt.isRandomEnabled(FirtoolOptions::RandomKind::Mem),
320  /*emitSeparateAlwaysBlocks=*/
322  pm.addNestedPass<hw::HWModuleOp>(createLowerVerifToSVPass());
323  pm.addPass(seq::createHWMemSimImplPass(
324  {/*disableMemRandomization=*/!opt.isRandomEnabled(
325  FirtoolOptions::RandomKind::Mem),
326  /*disableRegRandomization=*/
327  !opt.isRandomEnabled(FirtoolOptions::RandomKind::Reg),
328  /*replSeqMem=*/opt.shouldReplaceSequentialMemories(),
329  /*readEnableMode=*/opt.shouldIgnoreReadEnableMemories()
330  ? seq::ReadEnableMode::Ignore
331  : seq::ReadEnableMode::Undefined,
332  /*addMuxPragmas=*/opt.shouldAddMuxPragmas(),
333  /*addVivadoRAMAddressConflictSynthesisBugWorkaround=*/
335 
336  // If enabled, run the optimizer.
337  if (!opt.shouldDisableOptimization()) {
338  auto &modulePM = pm.nest<hw::HWModuleOp>();
339  modulePM.addPass(mlir::createCSEPass());
340  modulePM.addPass(createSimpleCanonicalizerPass());
341  modulePM.addPass(mlir::createCSEPass());
342  modulePM.addPass(sv::createHWCleanupPass(
343  /*mergeAlwaysBlocks=*/!opt.shouldEmitSeparateAlwaysBlocks()));
344  }
345 
346  // Check inner symbols and inner refs.
348 
349  // Check OM object fields.
350  pm.addPass(om::createVerifyObjectFieldsPass());
351 
352  return success();
353 }
354 
355 namespace detail {
356 LogicalResult
357 populatePrepareForExportVerilog(mlir::PassManager &pm,
358  const firtool::FirtoolOptions &opt) {
359 
360  // Run the verif op verification pass
361  pm.addNestedPass<hw::HWModuleOp>(verif::createVerifyClockedAssertLikePass());
362 
363  // Legalize unsupported operations within the modules.
364  pm.nest<hw::HWModuleOp>().addPass(sv::createHWLegalizeModulesPass());
365 
366  // Tidy up the IR to improve verilog emission quality.
367  if (!opt.shouldDisableOptimization())
368  pm.nest<hw::HWModuleOp>().addPass(sv::createPrettifyVerilogPass());
369 
370  if (opt.shouldStripFirDebugInfo())
371  pm.addPass(circt::createStripDebugInfoWithPredPass([](mlir::Location loc) {
372  if (auto fileLoc = dyn_cast<FileLineColLoc>(loc))
373  return fileLoc.getFilename().getValue().ends_with(".fir");
374  return false;
375  }));
376 
377  if (opt.shouldStripDebugInfo())
379  [](mlir::Location loc) { return true; }));
380 
381  // Emit module and testbench hierarchy JSON files.
382  if (opt.shouldExportModuleHierarchy())
384 
385  // Check inner symbols and inner refs.
387 
388  // Check OM object fields.
389  pm.addPass(om::createVerifyObjectFieldsPass());
390 
391  return success();
392 }
393 } // namespace detail
394 
395 LogicalResult
396 firtool::populateExportVerilog(mlir::PassManager &pm, const FirtoolOptions &opt,
397  std::unique_ptr<llvm::raw_ostream> os) {
398  if (failed(::detail::populatePrepareForExportVerilog(pm, opt)))
399  return failure();
400 
401  pm.addPass(createExportVerilogPass(std::move(os)));
402  return success();
403 }
404 
405 LogicalResult firtool::populateExportVerilog(mlir::PassManager &pm,
406  const FirtoolOptions &opt,
407  llvm::raw_ostream &os) {
408  if (failed(::detail::populatePrepareForExportVerilog(pm, opt)))
409  return failure();
410 
411  pm.addPass(createExportVerilogPass(os));
412  return success();
413 }
414 
415 LogicalResult firtool::populateExportSplitVerilog(mlir::PassManager &pm,
416  const FirtoolOptions &opt,
417  llvm::StringRef directory) {
418  if (failed(::detail::populatePrepareForExportVerilog(pm, opt)))
419  return failure();
420 
421  pm.addPass(createExportSplitVerilogPass(directory));
422  return success();
423 }
424 
425 LogicalResult firtool::populateFinalizeIR(mlir::PassManager &pm,
426  const FirtoolOptions &opt) {
427  pm.addPass(firrtl::createFinalizeIRPass());
428  pm.addPass(om::createFreezePathsPass());
429 
430  return success();
431 }
432 
433 LogicalResult firtool::populateHWToBTOR2(mlir::PassManager &pm,
434  const FirtoolOptions &opt,
435  llvm::raw_ostream &os) {
436  pm.addNestedPass<hw::HWModuleOp>(circt::createLowerLTLToCorePass());
437  pm.addNestedPass<hw::HWModuleOp>(circt::verif::createPrepareForFormalPass());
439  pm.addPass(circt::createConvertHWToBTOR2Pass(os));
440  return success();
441 }
442 
443 //===----------------------------------------------------------------------===//
444 // FIRTOOL CommandLine Options
445 //===----------------------------------------------------------------------===//
446 
447 namespace {
448 /// This struct contains command line options that can be used to initialize
449 /// various bits of a Firtool pipeline. This uses a struct wrapper to avoid the
450 /// need for global command line options.
451 struct FirtoolCmdOptions {
452  llvm::cl::opt<std::string> outputFilename{
453  "o",
454  llvm::cl::desc("Output filename, or directory for split output"),
455  llvm::cl::value_desc("filename"),
456  llvm::cl::init("-"),
457  };
458 
459  llvm::cl::opt<bool> disableAnnotationsUnknown{
460  "disable-annotation-unknown",
461  llvm::cl::desc("Ignore unknown annotations when parsing"),
462  llvm::cl::init(false)};
463 
464  llvm::cl::opt<bool> disableAnnotationsClassless{
465  "disable-annotation-classless",
466  llvm::cl::desc("Ignore annotations without a class when parsing"),
467  llvm::cl::init(false)};
468 
469  llvm::cl::opt<bool> lowerAnnotationsNoRefTypePorts{
470  "lower-annotations-no-ref-type-ports",
471  llvm::cl::desc(
472  "Create real ports instead of ref type ports when resolving "
473  "wiring problems inside the LowerAnnotations pass"),
474  llvm::cl::init(false), llvm::cl::Hidden};
475 
476  llvm::cl::opt<bool> allowAddingPortsOnPublic{
477  "allow-adding-ports-on-public-modules",
478  llvm::cl::desc("Allow adding ports to public modules"),
479  llvm::cl::init(false), llvm::cl::Hidden};
480 
481  llvm::cl::opt<bool> probesToSignals{
482  "probes-to-signals",
483  llvm::cl::desc("Convert probes to non-probe signals"),
484  llvm::cl::init(false), llvm::cl::Hidden};
485 
487  preserveAggregate{
488  "preserve-aggregate",
489  llvm::cl::desc("Specify input file format:"),
490  llvm::cl::values(
491  clEnumValN(circt::firrtl::PreserveAggregate::None, "none",
492  "Preserve no aggregate"),
493  clEnumValN(circt::firrtl::PreserveAggregate::OneDimVec, "1d-vec",
494  "Preserve only 1d vectors of ground type"),
495  clEnumValN(circt::firrtl::PreserveAggregate::Vec, "vec",
496  "Preserve only vectors"),
497  clEnumValN(circt::firrtl::PreserveAggregate::All, "all",
498  "Preserve vectors and bundles")),
500  };
501 
503  "preserve-values",
504  llvm::cl::desc("Specify the values which can be optimized away"),
505  llvm::cl::values(
506  clEnumValN(firrtl::PreserveValues::Strip, "strip",
507  "Strip all names. No name is preserved"),
508  clEnumValN(firrtl::PreserveValues::None, "none",
509  "Names could be preserved by best-effort unlike `strip`"),
510  clEnumValN(firrtl::PreserveValues::Named, "named",
511  "Preserve values with meaningful names"),
512  clEnumValN(firrtl::PreserveValues::All, "all",
513  "Preserve all values")),
514  llvm::cl::init(firrtl::PreserveValues::None)};
515 
516  llvm::cl::opt<bool> enableDebugInfo{
517  "g", llvm::cl::desc("Enable the generation of debug information"),
518  llvm::cl::init(false)};
519 
520  // Build mode options.
522  "O", llvm::cl::desc("Controls how much optimization should be performed"),
523  llvm::cl::values(clEnumValN(firtool::FirtoolOptions::BuildModeDebug,
524  "debug",
525  "Compile with only necessary optimizations"),
526  clEnumValN(firtool::FirtoolOptions::BuildModeRelease,
527  "release", "Compile with optimizations")),
528  llvm::cl::init(firtool::FirtoolOptions::BuildModeDefault)};
529 
530  llvm::cl::opt<bool> disableLayerSink{"disable-layer-sink",
531  llvm::cl::desc("Disable layer sink"),
532  cl::init(false)};
533 
534  llvm::cl::opt<bool> disableOptimization{
535  "disable-opt",
536  llvm::cl::desc("Disable optimizations"),
537  };
538 
540  "export-chisel-interface",
541  llvm::cl::desc("Generate a Scala Chisel interface to the top level "
542  "module of the firrtl circuit"),
543  llvm::cl::init(false)};
544 
545  llvm::cl::opt<std::string> chiselInterfaceOutDirectory{
546  "chisel-interface-out-dir",
547  llvm::cl::desc(
548  "The output directory for generated Chisel interface files"),
549  llvm::cl::init("")};
550 
551  llvm::cl::opt<bool> vbToBV{
552  "vb-to-bv",
553  llvm::cl::desc("Transform vectors of bundles to bundles of vectors"),
554  llvm::cl::init(false)};
555 
556  llvm::cl::opt<bool> noDedup{
557  "no-dedup",
558  llvm::cl::desc("Disable deduplication of structurally identical modules"),
559  llvm::cl::init(false)};
560 
562  "grand-central-companion-mode",
563  llvm::cl::desc("Specifies the handling of Grand Central companions"),
564  ::llvm::cl::values(
565  clEnumValN(firrtl::CompanionMode::Bind, "bind",
566  "Lower companion instances to SystemVerilog binds"),
567  clEnumValN(firrtl::CompanionMode::Instantiate, "instantiate",
568  "Instantiate companions in the design"),
569  clEnumValN(firrtl::CompanionMode::Drop, "drop",
570  "Remove companions from the design")),
571  llvm::cl::init(firrtl::CompanionMode::Bind),
572  llvm::cl::Hidden,
573  };
574 
575  llvm::cl::opt<bool> disableAggressiveMergeConnections{
576  "disable-aggressive-merge-connections",
577  llvm::cl::desc(
578  "Disable aggressive merge connections (i.e. merge all field-level "
579  "connections into bulk connections)"),
580  llvm::cl::init(false)};
581 
582  llvm::cl::opt<bool> advancedLayerSink{
583  "advanced-layer-sink",
584  llvm::cl::desc("Sink logic into layer blocks (advanced)"),
585  llvm::cl::init(false)};
586 
587  llvm::cl::opt<bool> lowerMemories{
588  "lower-memories",
589  llvm::cl::desc("Lower memories to have memories with masks as an "
590  "array with one memory per ground type"),
591  llvm::cl::init(false)};
592 
593  llvm::cl::opt<std::string> blackBoxRootPath{
594  "blackbox-path",
595  llvm::cl::desc(
596  "Optional path to use as the root of black box annotations"),
597  llvm::cl::value_desc("path"),
598  llvm::cl::init(""),
599  };
600 
601  llvm::cl::opt<bool> replSeqMem{
602  "repl-seq-mem",
603  llvm::cl::desc("Replace the seq mem for macro replacement and emit "
604  "relevant metadata"),
605  llvm::cl::init(false)};
606 
607  llvm::cl::opt<std::string> replSeqMemFile{
608  "repl-seq-mem-file", llvm::cl::desc("File name for seq mem metadata"),
609  llvm::cl::init("")};
610 
611  llvm::cl::opt<bool> extractTestCode{
612  "extract-test-code", llvm::cl::desc("Run the extract test code pass"),
613  llvm::cl::init(false)};
614 
615  llvm::cl::opt<bool> ignoreReadEnableMem{
616  "ignore-read-enable-mem",
617  llvm::cl::desc("Ignore the read enable signal, instead of "
618  "assigning X on read disable"),
619  llvm::cl::init(false)};
620 
622  llvm::cl::desc(
623  "Disable random initialization code (may break semantics!)"),
624  llvm::cl::values(
625  clEnumValN(firtool::FirtoolOptions::RandomKind::Mem,
626  "disable-mem-randomization",
627  "Disable emission of memory randomization code"),
628  clEnumValN(firtool::FirtoolOptions::RandomKind::Reg,
629  "disable-reg-randomization",
630  "Disable emission of register randomization code"),
632  "disable-all-randomization",
633  "Disable emission of all randomization code")),
634  llvm::cl::init(firtool::FirtoolOptions::RandomKind::None)};
635 
636  llvm::cl::opt<std::string> outputAnnotationFilename{
637  "output-annotation-file",
638  llvm::cl::desc("Optional output annotation file"),
639  llvm::cl::CommaSeparated, llvm::cl::value_desc("filename")};
640 
641  llvm::cl::opt<bool> enableAnnotationWarning{
642  "warn-on-unprocessed-annotations",
643  llvm::cl::desc(
644  "Warn about annotations that were not removed by lower-to-hw"),
645  llvm::cl::init(false)};
646 
647  llvm::cl::opt<bool> addMuxPragmas{
648  "add-mux-pragmas",
649  llvm::cl::desc("Annotate mux pragmas for memory array access"),
650  llvm::cl::init(false)};
651 
653  "verification-flavor",
654  llvm::cl::desc("Specify a verification flavor used in LowerFIRRTLToHW"),
655  llvm::cl::values(
656  clEnumValN(firrtl::VerificationFlavor::None, "none",
657  "Use the flavor specified by the op"),
658  clEnumValN(firrtl::VerificationFlavor::IfElseFatal, "if-else-fatal",
659  "Use Use `if(cond) else $fatal(..)` format"),
660  clEnumValN(firrtl::VerificationFlavor::Immediate, "immediate",
661  "Use immediate verif statements"),
662  clEnumValN(firrtl::VerificationFlavor::SVA, "sva", "Use SVA")),
663  llvm::cl::init(firrtl::VerificationFlavor::None)};
664 
665  llvm::cl::opt<bool> emitSeparateAlwaysBlocks{
666  "emit-separate-always-blocks",
667  llvm::cl::desc(
668  "Prevent always blocks from being merged and emit constructs into "
669  "separate always blocks whenever possible"),
670  llvm::cl::init(false)};
671 
672  llvm::cl::opt<bool> etcDisableInstanceExtraction{
673  "etc-disable-instance-extraction",
674  llvm::cl::desc("Disable extracting instances only that feed test code"),
675  llvm::cl::init(false)};
676 
677  llvm::cl::opt<bool> etcDisableRegisterExtraction{
678  "etc-disable-register-extraction",
679  llvm::cl::desc("Disable extracting registers that only feed test code"),
680  llvm::cl::init(false)};
681 
682  llvm::cl::opt<bool> etcDisableModuleInlining{
683  "etc-disable-module-inlining",
684  llvm::cl::desc("Disable inlining modules that only feed test code"),
685  llvm::cl::init(false)};
686 
687  llvm::cl::opt<bool> addVivadoRAMAddressConflictSynthesisBugWorkaround{
688  "add-vivado-ram-address-conflict-synthesis-bug-workaround",
689  llvm::cl::desc(
690  "Add a vivado specific SV attribute (* ram_style = "
691  "\"distributed\" *) to unpacked array registers as a workaronud "
692  "for a vivado synthesis bug that incorrectly modifies "
693  "address conflict behavivor of combinational memories"),
694  llvm::cl::init(false)};
695 
696  //===----------------------------------------------------------------------===
697  // External Clock Gate Options
698  //===----------------------------------------------------------------------===
699 
700  llvm::cl::opt<std::string> ckgModuleName{
701  "ckg-name", llvm::cl::desc("Clock gate module name"),
702  llvm::cl::init("EICG_wrapper")};
703 
704  llvm::cl::opt<std::string> ckgInputName{
705  "ckg-input", llvm::cl::desc("Clock gate input port name"),
706  llvm::cl::init("in")};
707 
708  llvm::cl::opt<std::string> ckgOutputName{
709  "ckg-output", llvm::cl::desc("Clock gate output port name"),
710  llvm::cl::init("out")};
711 
712  llvm::cl::opt<std::string> ckgEnableName{
713  "ckg-enable", llvm::cl::desc("Clock gate enable port name"),
714  llvm::cl::init("en")};
715 
716  llvm::cl::opt<std::string> ckgTestEnableName{
717  "ckg-test-enable",
718  llvm::cl::desc("Clock gate test enable port name (optional)"),
719  llvm::cl::init("test_en")};
720 
721  llvm::cl::opt<bool> exportModuleHierarchy{
722  "export-module-hierarchy",
723  llvm::cl::desc("Export module and instance hierarchy as JSON"),
724  llvm::cl::init(false)};
725 
726  llvm::cl::opt<bool> stripFirDebugInfo{
727  "strip-fir-debug-info",
728  llvm::cl::desc(
729  "Disable source fir locator information in output Verilog"),
730  llvm::cl::init(true)};
731 
732  llvm::cl::opt<bool> stripDebugInfo{
733  "strip-debug-info",
734  llvm::cl::desc("Disable source locator information in output Verilog"),
735  llvm::cl::init(false)};
736 
737  llvm::cl::opt<bool> fixupEICGWrapper{
738  "fixup-eicg-wrapper",
739  llvm::cl::desc("Lower `EICG_wrapper` modules into clock gate intrinsics"),
740  llvm::cl::init(false)};
741 
742  llvm::cl::opt<bool> addCompanionAssume{
743  "add-companion-assume",
744  llvm::cl::desc("Add companion assumes to assertions"),
745  llvm::cl::init(false)};
746 
747  llvm::cl::opt<bool> selectDefaultInstanceChoice{
748  "select-default-for-unspecified-instance-choice",
749  llvm::cl::desc(
750  "Specialize instance choice to default, if no option selected"),
751  llvm::cl::init(false)};
752 };
753 } // namespace
754 
755 static llvm::ManagedStatic<FirtoolCmdOptions> clOptions;
756 
757 /// Register a set of useful command-line options that can be used to configure
758 /// various flags within the MLIRContext. These flags are used when constructing
759 /// an MLIR context for initialization.
761  // Make sure that the options struct has been initialized.
762  *clOptions;
763 }
764 
765 // Initialize the firtool options with defaults supplied by the cl::opts above.
767  : outputFilename("-"), disableAnnotationsUnknown(false),
768  disableAnnotationsClassless(false), lowerAnnotationsNoRefTypePorts(false),
769  allowAddingPortsOnPublic(false), probesToSignals(false),
770  preserveAggregate(firrtl::PreserveAggregate::None),
771  preserveMode(firrtl::PreserveValues::None), enableDebugInfo(false),
772  buildMode(BuildModeRelease), disableLayerSink(false),
773  disableOptimization(false), exportChiselInterface(false),
774  chiselInterfaceOutDirectory(""), vbToBV(false), noDedup(false),
775  companionMode(firrtl::CompanionMode::Bind),
776  disableAggressiveMergeConnections(false), advancedLayerSink(false),
777  lowerMemories(false), blackBoxRootPath(""), replSeqMem(false),
778  replSeqMemFile(""), extractTestCode(false), ignoreReadEnableMem(false),
779  disableRandom(RandomKind::None), outputAnnotationFilename(""),
780  enableAnnotationWarning(false), addMuxPragmas(false),
781  verificationFlavor(firrtl::VerificationFlavor::None),
782  emitSeparateAlwaysBlocks(false), etcDisableInstanceExtraction(false),
783  etcDisableRegisterExtraction(false), etcDisableModuleInlining(false),
784  addVivadoRAMAddressConflictSynthesisBugWorkaround(false),
785  ckgModuleName("EICG_wrapper"), ckgInputName("in"), ckgOutputName("out"),
786  ckgEnableName("en"), ckgTestEnableName("test_en"), ckgInstName("ckg"),
787  exportModuleHierarchy(false), stripFirDebugInfo(true),
788  stripDebugInfo(false), fixupEICGWrapper(false), addCompanionAssume(false),
789  disableCSEinClasses(false), selectDefaultInstanceChoice(false) {
790  if (!clOptions.isConstructed())
791  return;
792  outputFilename = clOptions->outputFilename;
793  disableAnnotationsUnknown = clOptions->disableAnnotationsUnknown;
794  disableAnnotationsClassless = clOptions->disableAnnotationsClassless;
795  lowerAnnotationsNoRefTypePorts = clOptions->lowerAnnotationsNoRefTypePorts;
796  allowAddingPortsOnPublic = clOptions->allowAddingPortsOnPublic;
797  probesToSignals = clOptions->probesToSignals;
798  preserveAggregate = clOptions->preserveAggregate;
799  preserveMode = clOptions->preserveMode;
800  enableDebugInfo = clOptions->enableDebugInfo;
801  buildMode = clOptions->buildMode;
802  disableLayerSink = clOptions->disableLayerSink;
803  disableOptimization = clOptions->disableOptimization;
804  exportChiselInterface = clOptions->exportChiselInterface;
805  chiselInterfaceOutDirectory = clOptions->chiselInterfaceOutDirectory;
806  vbToBV = clOptions->vbToBV;
807  noDedup = clOptions->noDedup;
808  companionMode = clOptions->companionMode;
810  clOptions->disableAggressiveMergeConnections;
811  advancedLayerSink = clOptions->advancedLayerSink;
812  lowerMemories = clOptions->lowerMemories;
813  blackBoxRootPath = clOptions->blackBoxRootPath;
814  replSeqMem = clOptions->replSeqMem;
815  replSeqMemFile = clOptions->replSeqMemFile;
816  extractTestCode = clOptions->extractTestCode;
817  ignoreReadEnableMem = clOptions->ignoreReadEnableMem;
818  disableRandom = clOptions->disableRandom;
819  outputAnnotationFilename = clOptions->outputAnnotationFilename;
820  enableAnnotationWarning = clOptions->enableAnnotationWarning;
821  addMuxPragmas = clOptions->addMuxPragmas;
822  verificationFlavor = clOptions->verificationFlavor;
823  emitSeparateAlwaysBlocks = clOptions->emitSeparateAlwaysBlocks;
824  etcDisableInstanceExtraction = clOptions->etcDisableInstanceExtraction;
825  etcDisableRegisterExtraction = clOptions->etcDisableRegisterExtraction;
826  etcDisableModuleInlining = clOptions->etcDisableModuleInlining;
828  clOptions->addVivadoRAMAddressConflictSynthesisBugWorkaround;
829  ckgModuleName = clOptions->ckgModuleName;
830  ckgInputName = clOptions->ckgInputName;
831  ckgOutputName = clOptions->ckgOutputName;
832  ckgEnableName = clOptions->ckgEnableName;
833  ckgTestEnableName = clOptions->ckgTestEnableName;
834  exportModuleHierarchy = clOptions->exportModuleHierarchy;
835  stripFirDebugInfo = clOptions->stripFirDebugInfo;
836  stripDebugInfo = clOptions->stripDebugInfo;
837  fixupEICGWrapper = clOptions->fixupEICGWrapper;
838  addCompanionAssume = clOptions->addCompanionAssume;
839  selectDefaultInstanceChoice = clOptions->selectDefaultInstanceChoice;
840 }
static LogicalResult exportChiselInterface(CircuitOp circuit, llvm::raw_ostream &os)
Exports a Chisel interface to the output stream.
static llvm::ManagedStatic< FirtoolCmdOptions > clOptions
Definition: Firtool.cpp:755
Set of options used to control the behavior of the firtool pipeline.
Definition: Firtool.h:30
bool shouldStripDebugInfo() const
Definition: Firtool.h:117
firrtl::PreserveAggregate::PreserveMode getPreserveAggregate() const
Definition: Firtool.h:64
bool shouldAddVivadoRAMAddressConflictSynthesisBugWorkaround() const
Definition: Firtool.h:129
bool shouldDisableLayerSink() const
Definition: Firtool.h:99
firrtl::PreserveValues::PreserveMode preserveMode
Definition: Firtool.h:387
bool shouldAddCompanionAssume() const
Definition: Firtool.h:134
auto getVerificationFlavor() const
Definition: Firtool.h:124
bool isDefaultOutputFilename() const
Definition: Firtool.h:84
StringRef getOutputFilename() const
Definition: Firtool.h:54
bool shouldDisableAggressiveMergeConnections() const
Definition: Firtool.h:120
StringRef getReplaceSequentialMemoriesFile() const
Definition: Firtool.h:59
bool addVivadoRAMAddressConflictSynthesisBugWorkaround
Definition: Firtool.h:414
bool shouldExportChiselInterface() const
Definition: Firtool.h:106
bool shouldAdvancedLayerSink() const
Definition: Firtool.h:101
bool shouldExtractTestCode() const
Definition: Firtool.h:132
std::string chiselInterfaceOutDirectory
Definition: Firtool.h:393
bool shouldFixupEICGWrapper() const
Definition: Firtool.h:133
bool shouldConvertProbesToSignals() const
Definition: Firtool.h:97
firrtl::PreserveValues::PreserveMode getPreserveMode() const
Definition: Firtool.h:42
StringRef getBlackBoxRootPath() const
Definition: Firtool.h:55
bool shouldDisableCSEinClasses() const
Definition: Firtool.h:135
bool shouldDisableOptimization() const
Definition: Firtool.h:100
firrtl::CompanionMode getCompanionMode() const
Definition: Firtool.h:67
bool shouldDisableClasslessAnnotations() const
Definition: Firtool.h:88
bool shouldReplaceSequentialMemories() const
Definition: Firtool.h:98
bool shouldIgnoreReadEnableMemories() const
Definition: Firtool.h:105
bool isRandomEnabled(RandomKind kind) const
Definition: Firtool.h:38
bool shouldDisableUnknownAnnotations() const
Definition: Firtool.h:85
bool shouldAddMuxPragmas() const
Definition: Firtool.h:128
bool shouldEnableAnnotationWarning() const
Definition: Firtool.h:123
bool shouldEtcDisableInstanceExtraction() const
Definition: Firtool.h:108
bool shouldConvertVecOfBundle() const
Definition: Firtool.h:107
StringRef getOutputAnnotationFilename() const
Definition: Firtool.h:60
bool shouldStripFirDebugInfo() const
Definition: Firtool.h:118
bool shouldEtcDisableRegisterExtraction() const
Definition: Firtool.h:111
std::string outputAnnotationFilename
Definition: Firtool.h:406
firrtl::VerificationFlavor verificationFlavor
Definition: Firtool.h:409
firrtl::PreserveAggregate::PreserveMode preserveAggregate
Definition: Firtool.h:386
bool shouldLowerMemories() const
Definition: Firtool.h:102
bool shouldEtcDisableModuleInlining() const
Definition: Firtool.h:114
bool shouldAllowAddingPortsOnPublic() const
Definition: Firtool.h:94
bool shouldLowerNoRefTypePortAnnotations() const
Definition: Firtool.h:91
bool shouldExportModuleHierarchy() const
Definition: Firtool.h:119
firrtl::CompanionMode companionMode
Definition: Firtool.h:396
bool shouldSelectDefaultInstanceChoice() const
Definition: Firtool.h:136
seq::ExternalizeClockGateOptions getClockGateOptions() const
Definition: Firtool.h:69
bool shouldEnableDebugInfo() const
Definition: Firtool.h:104
bool shouldEmitSeparateAlwaysBlocks() const
Definition: Firtool.h:125
StringRef getChiselInterfaceOutputDirectory() const
Definition: Firtool.h:56
std::unique_ptr< mlir::Pass > createDedupPass()
Definition: Dedup.cpp:744
@ All
Preserve all aggregate values.
Definition: Passes.h:42
@ OneDimVec
Preserve only 1d vectors of ground type (e.g. UInt<2>[3]).
Definition: Passes.h:36
@ Vec
Preserve only vectors (e.g. UInt<2>[3][3]).
Definition: Passes.h:39
@ None
Don't preserve aggregate at all.
Definition: Passes.h:33
@ Strip
Strip all names. No name on declaration is preserved.
Definition: Passes.h:50
std::unique_ptr< mlir::Pass > createInferReadWritePass()
std::unique_ptr< mlir::Pass > createCheckCombLoopsPass()
std::unique_ptr< mlir::Pass > createCheckLayers()
std::unique_ptr< mlir::Pass > createCheckRecursiveInstantiation()
std::unique_ptr< mlir::Pass > createFinalizeIRPass()
Definition: FinalizeIR.cpp:45
std::unique_ptr< mlir::Pass > createLowerFIRRTLTypesPass(PreserveAggregate::PreserveMode mode=PreserveAggregate::None, PreserveAggregate::PreserveMode memoryMode=PreserveAggregate::None)
This is the pass constructor.
std::unique_ptr< mlir::Pass > createResolveTracesPass(mlir::StringRef outputAnnotationFilename="")
std::unique_ptr< mlir::Pass > createResolvePathsPass()
std::unique_ptr< mlir::Pass > createLowerFIRRTLAnnotationsPass(bool ignoreUnhandledAnnotations=false, bool ignoreClasslessAnnotations=false, bool noRefTypePorts=false, bool allowAddingPortsOnPublic=false)
This is the pass constructor.
std::unique_ptr< mlir::Pass > createLowerSignaturesPass()
This is the pass constructor.
std::unique_ptr< mlir::Pass > createVBToBVPass()
Definition: VBToBV.cpp:993
std::unique_ptr< mlir::Pass > createGrandCentralPass(CompanionMode companionMode=CompanionMode::Bind)
std::unique_ptr< mlir::Pass > createLowerDPIPass()
Definition: LowerDPI.cpp:294
std::unique_ptr< mlir::Pass > createLowerIntmodulesPass(bool fixupEICGWrapper=false)
This is the pass constructor.
std::unique_ptr< mlir::Pass > createIMConstPropPass()
std::unique_ptr< mlir::Pass > createBlackBoxReaderPass(std::optional< mlir::StringRef > inputPrefix={})
std::unique_ptr< mlir::Pass > createCreateCompanionAssume()
std::unique_ptr< mlir::Pass > createCreateSiFiveMetadataPass(bool replSeqMem=false, mlir::StringRef replSeqMemFile="")
std::unique_ptr< mlir::Pass > createAdvancedLayerSinkPass()
std::unique_ptr< mlir::Pass > createLayerMergePass()
Definition: LayerMerge.cpp:72
std::unique_ptr< mlir::Pass > createInlinerPass()
std::unique_ptr< mlir::Pass > createVectorizationPass()
std::unique_ptr< mlir::Pass > createLowerMemoryPass()
std::unique_ptr< mlir::Pass > createDropNamesPass(PreserveValues::PreserveMode mode=PreserveValues::None)
Definition: DropName.cpp:101
std::unique_ptr< mlir::Pass > createLowerLayersPass()
std::unique_ptr< mlir::Pass > createIMDeadCodeElimPass()
std::unique_ptr< mlir::Pass > createLintingPass()
Definition: Lint.cpp:77
std::unique_ptr< mlir::Pass > createPassiveWiresPass()
This is the pass constructor.
std::unique_ptr< mlir::Pass > createExtractInstancesPass()
std::unique_ptr< mlir::Pass > createSpecializeOptionPass(bool selectDefaultInstanceChoice=false)
std::unique_ptr< mlir::Pass > createLayerSinkPass()
Definition: LayerSink.cpp:58
std::unique_ptr< mlir::Pass > createSpecializeLayersPass()
std::unique_ptr< mlir::Pass > createLowerCHIRRTLPass()
std::unique_ptr< mlir::Pass > createInnerSymbolDCEPass()
std::unique_ptr< mlir::Pass > createExpandWhensPass()
std::unique_ptr< mlir::Pass > createLowerXMRPass()
Definition: LowerXMR.cpp:864
std::unique_ptr< mlir::Pass > createLowerIntrinsicsPass()
This is the pass constructor.
std::unique_ptr< mlir::Pass > createInferWidthsPass()
std::unique_ptr< mlir::Pass > createMemToRegOfVecPass(bool replSeqMem=false, bool ignoreReadEnable=false)
std::unique_ptr< mlir::Pass > createLowerOpenAggsPass()
This is the pass constructor.
std::unique_ptr< mlir::Pass > createAssignOutputDirsPass(mlir::StringRef outputDir="")
std::unique_ptr< mlir::Pass > createDropConstPass()
Definition: DropConst.cpp:110
std::unique_ptr< mlir::Pass > createSFCCompatPass()
Definition: SFCCompat.cpp:165
std::unique_ptr< mlir::Pass > createInjectDUTHierarchyPass()
std::unique_ptr< mlir::Pass > createRandomizeRegisterInitPass()
std::unique_ptr< mlir::Pass > createLowerClassesPass()
std::unique_ptr< mlir::Pass > createAddSeqMemPortsPass()
std::unique_ptr< mlir::Pass > createRegisterOptimizerPass()
std::unique_ptr< mlir::Pass > createLowerMatchesPass()
std::unique_ptr< mlir::Pass > createProbesToSignalsPass()
This is the pass constructor.
std::unique_ptr< mlir::Pass > createMergeConnectionsPass(bool enableAggressiveMerging=false)
std::unique_ptr< mlir::Pass > createInferResetsPass()
std::unique_ptr< mlir::Pass > createFlattenMemoryPass()
std::unique_ptr< mlir::Pass > createMaterializeDebugInfoPass()
LogicalResult populateHWToBTOR2(mlir::PassManager &pm, const FirtoolOptions &opt, llvm::raw_ostream &os)
Definition: Firtool.cpp:433
LogicalResult populateExportSplitVerilog(mlir::PassManager &pm, const FirtoolOptions &opt, llvm::StringRef directory)
Definition: Firtool.cpp:415
LogicalResult populateHWToSV(mlir::PassManager &pm, const FirtoolOptions &opt)
Definition: Firtool.cpp:303
LogicalResult populateLowFIRRTLToHW(mlir::PassManager &pm, const FirtoolOptions &opt)
Definition: Firtool.cpp:262
LogicalResult populateExportVerilog(mlir::PassManager &pm, const FirtoolOptions &opt, std::unique_ptr< llvm::raw_ostream > os)
Definition: Firtool.cpp:396
LogicalResult populatePreprocessTransforms(mlir::PassManager &pm, const FirtoolOptions &opt)
Definition: Firtool.cpp:27
void registerFirtoolCLOptions()
Register a set of useful command-line options that can be used to configure various flags within the ...
Definition: Firtool.cpp:760
LogicalResult populateFinalizeIR(mlir::PassManager &pm, const FirtoolOptions &opt)
Definition: Firtool.cpp:425
LogicalResult populateCHIRRTLToLowFIRRTL(mlir::PassManager &pm, const FirtoolOptions &opt, StringRef inputFilename)
Definition: Firtool.cpp:55
std::unique_ptr< mlir::Pass > createFlattenModulesPass()
std::unique_ptr< mlir::Pass > createVerifyInnerRefNamespacePass()
std::unique_ptr< mlir::Pass > createVerifyObjectFieldsPass()
std::unique_ptr< mlir::Pass > createFreezePathsPass(std::function< StringAttr(Operation *)> getOpNameFallback={})
std::unique_ptr< mlir::Pass > createHWMemSimImplPass(const HWMemSimImplOptions &options={})
std::unique_ptr< mlir::Pass > createExternalizeClockGatePass(const ExternalizeClockGateOptions &options={})
std::unique_ptr< mlir::Pass > createHWExportModuleHierarchyPass()
std::unique_ptr< mlir::Pass > createSVExtractTestCodePass(bool disableInstanceExtraction=false, bool disableRegisterExtraction=false, bool disableModuleInlining=false)
std::unique_ptr< mlir::Pass > createHWLegalizeModulesPass()
std::unique_ptr< mlir::Pass > createPrettifyVerilogPass()
std::unique_ptr< mlir::Pass > createHWCleanupPass(bool mergeAlwaysBlocks=true)
Definition: HWCleanup.cpp:252
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
std::unique_ptr< mlir::Pass > createExportSplitChiselInterfacePass(mlir::StringRef outputDirectory="./")
std::unique_ptr< mlir::Pass > createExportVerilogPass(std::unique_ptr< llvm::raw_ostream > os)
std::unique_ptr< mlir::Pass > createExportChiselInterfacePass(llvm::raw_ostream &os)
std::unique_ptr< mlir::Pass > createExportSplitVerilogPass(llvm::StringRef directory="./")
std::unique_ptr< mlir::Pass > createConvertHWToBTOR2Pass(llvm::raw_ostream &os)
Definition: HWToBTOR2.cpp:1044
std::unique_ptr< OperationPass< hw::HWModuleOp > > createLowerVerifToSVPass()
Create the Verif to SV conversion pass.
Definition: VerifToSV.cpp:243
std::unique_ptr< mlir::Pass > createLowerSeqToSVPass(const LowerSeqToSVOptions &options={})
Definition: SeqToSV.cpp:845
std::unique_ptr< mlir::Pass > createLowerLTLToCorePass()
Definition: LTLToCore.cpp:166
std::unique_ptr< mlir::Pass > createLowerFIRRTLToHWPass(bool enableAnnotationWarning=false, firrtl::VerificationFlavor assertionFlavor=firrtl::VerificationFlavor::None)
This is the pass constructor.
Definition: LowerToHW.cpp:583
std::unique_ptr< mlir::Pass > createLowerSimToSVPass()
Definition: SimToSV.cpp:370
std::unique_ptr< Pass > createSimpleCanonicalizerPass()
Create a simple canonicalizer pass.
Definition: Passes.cpp:15
std::unique_ptr< mlir::Pass > createStripDebugInfoWithPredPass(const std::function< bool(mlir::Location)> &pred)
Creates a pass to strip debug information from a function.
LogicalResult populatePrepareForExportVerilog(mlir::PassManager &pm, const firtool::FirtoolOptions &opt)
Definition: Firtool.cpp:357